liquidio: Disabling tasklet when NAPI is active
authorIntiyaz Basha <intiyaz.basha@cavium.com>
Mon, 10 Sep 2018 06:34:16 +0000 (23:34 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 12 Sep 2018 06:37:06 +0000 (23:37 -0700)
Control packets are processed in tasklet when interface is down and in
NAPI when interface is up. So tasklet can be disabled when interface up
and re-enabled when interface is down.

Signed-off-by: Intiyaz Basha <intiyaz.basha@cavium.com>
Acked-by: Derek Chickles <derek.chickles@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 40f941fb5888663570cf3f1928e3c994e11a364a..0aba1f7ffefe7eb139f4650c799a764c5c3ac076 100644 (file)
@@ -1239,8 +1239,10 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
 static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx)
 {
        struct net_device *netdev = oct->props[ifidx].netdev;
-       struct lio *lio;
+       struct octeon_device_priv *oct_priv =
+               (struct octeon_device_priv *)oct->priv;
        struct napi_struct *napi, *n;
+       struct lio *lio;
 
        if (!netdev) {
                dev_err(&oct->pci_dev->dev, "%s No netdevice ptr for index %d\n",
@@ -1269,6 +1271,8 @@ static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx)
        list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
                netif_napi_del(napi);
 
+       tasklet_enable(&oct_priv->droq_tasklet);
+
        if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED)
                unregister_netdev(netdev);
 
@@ -1805,9 +1809,13 @@ static int liquidio_open(struct net_device *netdev)
 {
        struct lio *lio = GET_LIO(netdev);
        struct octeon_device *oct = lio->oct_dev;
+       struct octeon_device_priv *oct_priv =
+               (struct octeon_device_priv *)oct->priv;
        struct napi_struct *napi, *n;
 
        if (oct->props[lio->ifidx].napi_enabled == 0) {
+               tasklet_disable(&oct_priv->droq_tasklet);
+
                list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
                        napi_enable(napi);
 
@@ -1861,6 +1869,8 @@ static int liquidio_stop(struct net_device *netdev)
 {
        struct lio *lio = GET_LIO(netdev);
        struct octeon_device *oct = lio->oct_dev;
+       struct octeon_device_priv *oct_priv =
+               (struct octeon_device_priv *)oct->priv;
        struct napi_struct *napi, *n;
 
        ifstate_reset(lio, LIO_IFSTATE_RUNNING);
@@ -1907,6 +1917,8 @@ static int liquidio_stop(struct net_device *netdev)
 
                if (OCTEON_CN23XX_PF(oct))
                        oct->droq[0]->ops.poll_mode = 0;
+
+               tasklet_enable(&oct_priv->droq_tasklet);
        }
 
        dev_info(&oct->pci_dev->dev, "%s interface is stopped\n", netdev->name);
index 8fa7ac38dce71dc41b9fa916a13f0498f8c8cf55..0ec4bfe6a147c037ca53bc12ea436366a64333a0 100644 (file)
@@ -444,6 +444,8 @@ static void octeon_pci_flr(struct octeon_device *oct)
  */
 static void octeon_destroy_resources(struct octeon_device *oct)
 {
+       struct octeon_device_priv *oct_priv =
+               (struct octeon_device_priv *)oct->priv;
        struct msix_entry *msix_entries;
        int i;
 
@@ -587,6 +589,8 @@ static void octeon_destroy_resources(struct octeon_device *oct)
                /* Nothing to be done here either */
                break;
        }
+
+       tasklet_kill(&oct_priv->droq_tasklet);
 }
 
 /**
@@ -652,6 +656,8 @@ static void send_rx_ctrl_cmd(struct lio *lio, int start_stop)
 static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx)
 {
        struct net_device *netdev = oct->props[ifidx].netdev;
+       struct octeon_device_priv *oct_priv =
+               (struct octeon_device_priv *)oct->priv;
        struct napi_struct *napi, *n;
        struct lio *lio;
 
@@ -681,6 +687,8 @@ static void liquidio_destroy_nic_device(struct octeon_device *oct, int ifidx)
        list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
                netif_napi_del(napi);
 
+       tasklet_enable(&oct_priv->droq_tasklet);
+
        if (atomic_read(&lio->ifstate) & LIO_IFSTATE_REGISTERED)
                unregister_netdev(netdev);
 
@@ -898,9 +906,13 @@ static int liquidio_open(struct net_device *netdev)
 {
        struct lio *lio = GET_LIO(netdev);
        struct octeon_device *oct = lio->oct_dev;
+       struct octeon_device_priv *oct_priv =
+               (struct octeon_device_priv *)oct->priv;
        struct napi_struct *napi, *n;
 
        if (!oct->props[lio->ifidx].napi_enabled) {
+               tasklet_disable(&oct_priv->droq_tasklet);
+
                list_for_each_entry_safe(napi, n, &netdev->napi_list, dev_list)
                        napi_enable(napi);
 
@@ -938,6 +950,8 @@ static int liquidio_stop(struct net_device *netdev)
 {
        struct lio *lio = GET_LIO(netdev);
        struct octeon_device *oct = lio->oct_dev;
+       struct octeon_device_priv *oct_priv =
+               (struct octeon_device_priv *)oct->priv;
        struct napi_struct *napi, *n;
 
        /* tell Octeon to stop forwarding packets to host */
@@ -967,6 +981,8 @@ static int liquidio_stop(struct net_device *netdev)
                oct->props[lio->ifidx].napi_enabled = 0;
 
                oct->droq[0]->ops.poll_mode = 0;
+
+               tasklet_enable(&oct_priv->droq_tasklet);
        }
 
        cancel_delayed_work_sync(&lio->stats_wk.work);