Commit 6ae6d332 authored by Igor Russkikh's avatar Igor Russkikh Committed by David S. Miller
Browse files

aqc111: cleanup mtu related logic



Original fix b8b27752 was done under impression that invalid data
could be written for mtu configuration higher that 16334.

But the high limit will anyway be rejected my max_mtu check in caller.
Thus, make the code cleaner and allow it doing the configuration without
checking for maximum mtu value.

Fixes: b8b27752 ("aqc111: fix endianness issue in aqc111_change_mtu")
Signed-off-by: default avatarIgor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9e598a65
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -437,7 +437,7 @@ static int aqc111_change_mtu(struct net_device *net, int new_mtu)
	aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_MEDIUM_STATUS_MODE,
			   2, &reg16);

	if (dev->net->mtu > 12500 && dev->net->mtu <= 16334) {
	if (dev->net->mtu > 12500) {
		memcpy(buf, &AQC111_BULKIN_SIZE[2], 5);
		/* RX bulk configuration */
		aqc111_write_cmd(dev, AQ_ACCESS_MAC, SFR_RX_BULKIN_QCTRL,
@@ -451,10 +451,8 @@ static int aqc111_change_mtu(struct net_device *net, int new_mtu)
		reg16 = 0x1020;
	else if (dev->net->mtu <= 12500)
		reg16 = 0x1420;
	else if (dev->net->mtu <= 16334)
		reg16 = 0x1A20;
	else
		return 0;
		reg16 = 0x1A20;

	aqc111_write16_cmd(dev, AQ_ACCESS_MAC, SFR_PAUSE_WATERLVL_LOW,
			   2, &reg16);