liquidio: napi cleanup
authorIntiyaz Basha <intiyaz.basha@cavium.com>
Wed, 9 Aug 2017 02:34:28 +0000 (19:34 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 10 Aug 2017 05:42:07 +0000 (22:42 -0700)
Disable napi when interface is going down.
Delete napi when destroying the interface.

Signed-off-by: Intiyaz Basha <intiyaz.basha@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_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c

index 3ec0dd9b7201354c5c847d2313872081bd33ec36..cbd6287e578e2ad206fd94d2833cf1e5782e4077 100644 (file)
@@ -1736,6 +1736,10 @@ static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx)
                        oct->droq[0]->ops.poll_mode = 0;
        }
 
+       /* Delete NAPI */
+       list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
+               netif_napi_del(napi);
+
        if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED)
                unregister_netdev(netdev);
 
@@ -2770,6 +2774,17 @@ static int liquidio_stop(struct net_device *netdev)
 {
        struct lio *lio = GET_LIO(netdev);
        struct octeon_device *oct = lio->oct_dev;
+       struct napi_struct *napi, *n;
+
+       if (oct->props[lio->ifidx].napi_enabled) {
+               list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
+                       napi_disable(napi);
+
+               oct->props[lio->ifidx].napi_enabled = 0;
+
+               if (OCTEON_CN23XX_PF(oct))
+                       oct->droq[0]->ops.poll_mode = 0;
+       }
 
        ifstate_reset(lio, LIO_IFSTATE_RUNNING);
 
index 935ff299cdd92d8380fb9125ba37527dabc02398..c6f52f235647b59f7e2f859eea86191c8caadf2c 100644 (file)
@@ -1137,6 +1137,10 @@ static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx)
                oct->droq[0]->ops.poll_mode = 0;
        }
 
+       /* Delete NAPI */
+       list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
+               netif_napi_del(napi);
+
        if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED)
                unregister_netdev(netdev);
 
@@ -1784,6 +1788,16 @@ static int liquidio_stop(struct net_device *netdev)
 {
        struct lio *lio = GET_LIO(netdev);
        struct octeon_device *oct = lio->oct_dev;
+       struct napi_struct *napi, *n;
+
+       if (oct->props[lio->ifidx].napi_enabled) {
+               list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
+                       napi_disable(napi);
+
+               oct->props[lio->ifidx].napi_enabled = 0;
+
+               oct->droq[0]->ops.poll_mode = 0;
+       }
 
        netif_info(lio, ifdown, lio->netdev, "Stopping interface!\n");
        /* Inform that netif carrier is down */