aqc111: cleanup mtu related logic
authorIgor Russkikh <Igor.Russkikh@aquantia.com>
Thu, 16 May 2019 14:52:25 +0000 (14:52 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 16 May 2019 21:22:13 +0000 (14:22 -0700)
Original fix b8b277525e9d 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: b8b277525e9d ("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>
drivers/net/usb/aqc111.c

index 408df2d335e3a648d46e1f00626761c510b741d9..7e44110746dd00f11382b9a03d8c56e724e00c59 100644 (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);