i40e: tear down flow director
authorJingjing Wu <jingjing.wu@intel.com>
Fri, 21 Nov 2014 00:46:36 +0000 (08:46 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 24 Nov 2014 22:47:05 +0000 (23:47 +0100)
release fortville resources on flow director, includes
 - queue 0 pair release
 - release vsi

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
lib/librte_pmd_i40e/i40e_ethdev.c
lib/librte_pmd_i40e/i40e_ethdev.h
lib/librte_pmd_i40e/i40e_fdir.c

index 16b4f79..4ebb981 100644 (file)
@@ -504,6 +504,7 @@ eth_i40e_dev_init(__rte_unused struct eth_driver *eth_drv,
 err_mac_alloc:
        i40e_vsi_release(pf->main_vsi);
 err_setup_pf_switch:
+       i40e_fdir_teardown(pf);
 err_get_mac_addr:
 err_configure_lan_hmc:
        (void)i40e_shutdown_lan_hmc(hw);
@@ -860,11 +861,16 @@ i40e_dev_stop(struct rte_eth_dev *dev)
                i40e_vsi_queues_unbind_intr(pf->vmdq[i].vsi);
        }
 
+       if (pf->flags & I40E_FLAG_FDIR) {
+               i40e_vsi_queues_bind_intr(pf->fdir.fdir_vsi);
+               i40e_vsi_enable_queues_intr(pf->fdir.fdir_vsi);
+       }
        /* Clear all queues and release memory */
        i40e_dev_clear_queues(dev);
 
        /* Set link down */
        i40e_dev_set_link_down(dev);
+
 }
 
 static void
@@ -886,6 +892,7 @@ i40e_dev_close(struct rte_eth_dev *dev)
        i40e_shutdown_lan_hmc(hw);
 
        /* release all the existing VSIs and VEBs */
+       i40e_fdir_teardown(pf);
        i40e_vsi_release(pf->main_vsi);
 
        /* shutdown the adminq */
index ceda53a..eeae8bc 100644 (file)
@@ -425,6 +425,7 @@ const struct rte_memzone *i40e_memzone_reserve(const char *name,
                                        uint32_t len,
                                        int socket_id);
 int i40e_fdir_configure(struct rte_eth_dev *dev);
+void i40e_fdir_teardown(struct i40e_pf *pf);
 
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
index 66ff8ad..23196f6 100644 (file)
@@ -225,6 +225,27 @@ fail_setup_tx:
        return err;
 }
 
+/*
+ * i40e_fdir_teardown - release the Flow Director resources
+ * @pf: board private structure
+ */
+void
+i40e_fdir_teardown(struct i40e_pf *pf)
+{
+       struct i40e_hw *hw = I40E_PF_TO_HW(pf);
+       struct i40e_vsi *vsi;
+
+       vsi = pf->fdir.fdir_vsi;
+       i40e_switch_tx_queue(hw, vsi->base_queue, FALSE);
+       i40e_switch_rx_queue(hw, vsi->base_queue, FALSE);
+       i40e_dev_rx_queue_release(pf->fdir.rxq);
+       pf->fdir.rxq = NULL;
+       i40e_dev_tx_queue_release(pf->fdir.txq);
+       pf->fdir.txq = NULL;
+       i40e_vsi_release(vsi);
+       pf->fdir.fdir_vsi = NULL;
+}
+
 /* check whether the flow director table in empty */
 static inline int
 i40e_fdir_empty(struct i40e_hw *hw)