diff options
author | Pavel Belous <pavel.belous@aquantia.com> | 2017-02-20 22:36:41 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-20 17:11:09 -0500 |
commit | 5513e16421cb9538f4e394734e4b96ea0d857b23 (patch) | |
tree | 89227b661823bf9686670dbbed84786ac19e7949 /drivers/net/ethernet/aquantia | |
parent | 15e32a5e1e016f40712c3c843c84078385c49db2 (diff) |
net: ethernet: aquantia: Fixes for aq_ndev_change_mtu
1)Removed unnecessary comparsion "old_mtu == new_mtu".
This check is not needed. Function aq_ndev_change_mtu wont be called
if mtu has not changed.
2)Removed extra assignment ndev->mtu = new_mtu;
This assignment already done inside __dev_set_mtu().
3)Use core MTU checking for min_mtu.
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_main.c | 12 | ||||
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 1 |
2 files changed, 2 insertions, 11 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_main.c b/drivers/net/ethernet/aquantia/atlantic/aq_main.c index c17c70adef0d..45c769e8c22a 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_main.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_main.c @@ -100,20 +100,10 @@ err_exit: static int aq_ndev_change_mtu(struct net_device *ndev, int new_mtu) { struct aq_nic_s *aq_nic = netdev_priv(ndev); - int err = 0; + int err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN); - if (new_mtu == ndev->mtu) { - err = 0; - goto err_exit; - } - if (new_mtu < 68) { - err = -EINVAL; - goto err_exit; - } - err = aq_nic_set_mtu(aq_nic, new_mtu + ETH_HLEN); if (err < 0) goto err_exit; - ndev->mtu = new_mtu; if (netif_running(ndev)) { aq_ndev_close(ndev); diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index a153750523bd..4b8d074a8450 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -214,6 +214,7 @@ struct aq_nic_s *aq_nic_alloc_cold(const struct net_device_ops *ndev_ops, SET_NETDEV_DEV(ndev, dev); ndev->if_port = port; + ndev->min_mtu = ETH_MIN_MTU; self->ndev = ndev; self->aq_pci_func = aq_pci_func; |