1
0
Fork 0

aqc111: cleanup mtu related logic

Original fix b8b277525e 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: b8b277525e ("aqc111: fix endianness issue in aqc111_change_mtu")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
hifive-unleashed-5.2
Igor Russkikh 2019-05-16 14:52:25 +00:00 committed by David S. Miller
parent 9e598a65b9
commit 6ae6d33280
1 changed files with 2 additions and 4 deletions

View File

@ -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);