liquidio: update VF's netdev->max_mtu if there's a change in PF's MTU
authorVeerasenareddy Burru <veerasenareddy.burru@cavium.com>
Tue, 15 Aug 2017 23:26:22 +0000 (16:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Aug 2017 18:07:55 +0000 (11:07 -0700)
A VF's MTU is capped at the parent PF's MTU.  So if there's a change in the
PF's MTU, then update the VF's netdev->max_mtu.

Also remove duplicate log messages for MTU change.

Signed-off-by: Veerasenareddy Burru <veerasenareddy.burru@cavium.com>
Signed-off-by: Raghu Vatsavayi <raghu.vatsavayi@cavium.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_core.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c

index 8b8e78f04f94884a6640538044ced105e7c46e1c..d4f0646084b71de42b49ee7c7bbcb94603baee09 100644 (file)
@@ -165,9 +165,6 @@ void liquidio_link_ctrl_cmd_completion(void *nctrl_ptr)
                /* If command is successful, change the MTU. */
                netif_info(lio, probe, lio->netdev, "MTU Changed from %d to %d\n",
                           netdev->mtu, nctrl->ncmd.s.param1);
-               dev_info(&oct->pci_dev->dev, "%s MTU Changed from %d to %d\n",
-                        netdev->name, netdev->mtu,
-                        nctrl->ncmd.s.param1);
                netdev->mtu = nctrl->ncmd.s.param1;
                queue_delayed_work(lio->link_status_wq.wq,
                                   &lio->link_status_wq.wk.work, 0);
index 35a977abc7c406dae15332384e198dc66fc345c0..0402b18d46892cf35157dabd9736ec366591daa4 100644 (file)
@@ -630,6 +630,12 @@ static void update_link_status(struct net_device *netdev,
                        txqs_stop(netdev);
                }
 
+               if (lio->linfo.link.s.mtu != netdev->max_mtu) {
+                       dev_info(&oct->pci_dev->dev, "Max MTU Changed from %d to %d\n",
+                                netdev->max_mtu, lio->linfo.link.s.mtu);
+                       netdev->max_mtu = lio->linfo.link.s.mtu;
+               }
+
                if (lio->linfo.link.s.mtu < netdev->mtu) {
                        dev_warn(&oct->pci_dev->dev,
                                 "PF has changed the MTU for gmx port. Reducing the mtu from %d to %d\n",
@@ -1539,14 +1545,11 @@ static struct net_device_stats *liquidio_get_stats(struct net_device *netdev)
 static int liquidio_change_mtu(struct net_device *netdev, int new_mtu)
 {
        struct lio *lio = GET_LIO(netdev);
-       struct octeon_device *oct = lio->oct_dev;
 
        lio->mtu = new_mtu;
 
        netif_info(lio, probe, lio->netdev, "MTU Changed from %d to %d\n",
                   netdev->mtu, new_mtu);
-       dev_info(&oct->pci_dev->dev, "%s MTU Changed from %d to %d\n",
-                netdev->name, netdev->mtu, new_mtu);
 
        netdev->mtu = new_mtu;