net/i40e: fix flow director Rx writeback packet
authorChenmin Sun <chenmin.sun@intel.com>
Fri, 17 Jul 2020 14:57:58 +0000 (22:57 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 21 Jul 2020 11:54:54 +0000 (13:54 +0200)
This patch fixes the fdir cannot receive rx writeback packet issue.
The root cause is FDIR interrupt is not correctly enabled.

Beside this, to make sure fdir programming works fine when the port
is stopped, move the fdir interrupt configure from start/stop to
setup/teardown.

Fixes: cfd662d22e7b ("net/i40e: fix interrupt throttling setting in PF")
Cc: stable@dpdk.org
Signed-off-by: Chenmin Sun <chenmin.sun@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h
drivers/net/i40e/i40e_fdir.c

index 6901643..05d5f28 100644 (file)
@@ -2184,7 +2184,7 @@ i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx)
        }
 }
 
-static void
+void
 i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)
 {
        struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2211,7 +2211,7 @@ i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi)
        I40E_WRITE_FLUSH(hw);
 }
 
-static void
+void
 i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi)
 {
        struct rte_eth_dev *dev = vsi->adapter->eth_dev;
@@ -2433,13 +2433,6 @@ i40e_dev_start(struct rte_eth_dev *dev)
                i40e_vsi_enable_queues_intr(pf->vmdq[i].vsi);
        }
 
-       /* enable FDIR MSIX interrupt */
-       if (pf->fdir.fdir_vsi) {
-               i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi,
-                                         I40E_ITR_INDEX_NONE);
-               i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
-       }
-
        /* Enable all queues which have been configured */
        for (nb_rxq = 0; nb_rxq < dev->data->nb_rx_queues; nb_rxq++) {
                ret = i40e_dev_rx_queue_start(dev, nb_rxq);
@@ -2575,10 +2568,6 @@ i40e_dev_stop(struct rte_eth_dev *dev)
                i40e_vsi_queues_unbind_intr(pf->vmdq[i].vsi);
        }
 
-       if (pf->fdir.fdir_vsi) {
-               i40e_vsi_queues_unbind_intr(pf->fdir.fdir_vsi);
-               i40e_vsi_disable_queues_intr(pf->fdir.fdir_vsi);
-       }
        /* Clear all queues and release memory */
        i40e_dev_clear_queues(dev);
 
index d3bda02..aef88ab 100644 (file)
@@ -1321,6 +1321,7 @@ void i40e_pf_enable_irq0(struct i40e_hw *hw);
 int i40e_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete);
 void i40e_vsi_queues_bind_intr(struct i40e_vsi *vsi, uint16_t itr_idx);
 void i40e_vsi_queues_unbind_intr(struct i40e_vsi *vsi);
+void i40e_vsi_disable_queues_intr(struct i40e_vsi *vsi);
 int i40e_vsi_vlan_pvid_set(struct i40e_vsi *vsi,
                           struct i40e_vsi_vlan_pvid_info *info);
 int i40e_vsi_config_vlan_stripping(struct i40e_vsi *vsi, bool on);
@@ -1330,6 +1331,7 @@ uint64_t i40e_parse_hena(const struct i40e_adapter *adapter, uint64_t flags);
 enum i40e_status_code i40e_fdir_setup_tx_resources(struct i40e_pf *pf);
 enum i40e_status_code i40e_fdir_setup_rx_resources(struct i40e_pf *pf);
 int i40e_fdir_setup(struct i40e_pf *pf);
+void i40e_vsi_enable_queues_intr(struct i40e_vsi *vsi);
 const struct rte_memzone *i40e_memzone_reserve(const char *name,
                                        uint32_t len,
                                        int socket_id);
index 9998e5d..8e87b4a 100644 (file)
@@ -231,6 +231,11 @@ i40e_fdir_setup(struct i40e_pf *pf)
                goto fail_mem;
        }
 
+       /* enable FDIR MSIX interrupt */
+       vsi->nb_used_qps = 1;
+       i40e_vsi_queues_bind_intr(vsi, I40E_ITR_INDEX_NONE);
+       i40e_vsi_enable_queues_intr(vsi);
+
        /* reserve memory for the fdir programming packet */
        snprintf(z_name, sizeof(z_name), "%s_%s_%d",
                        eth_dev->device->driver->name,
@@ -287,12 +292,18 @@ i40e_fdir_teardown(struct i40e_pf *pf)
        vsi = pf->fdir.fdir_vsi;
        if (!vsi)
                return;
+
+       /* disable FDIR MSIX interrupt */
+       i40e_vsi_queues_unbind_intr(vsi);
+       i40e_vsi_disable_queues_intr(vsi);
+
        int err = i40e_switch_tx_queue(hw, vsi->base_queue, FALSE);
        if (err)
                PMD_DRV_LOG(DEBUG, "Failed to do FDIR TX switch off");
        err = i40e_switch_rx_queue(hw, vsi->base_queue, FALSE);
        if (err)
                PMD_DRV_LOG(DEBUG, "Failed to do FDIR RX switch off");
+
        i40e_dev_rx_queue_release(pf->fdir.rxq);
        rte_eth_dma_zone_free(dev, "fdir_rx_ring", pf->fdir.rxq->queue_id);
        pf->fdir.rxq = NULL;