On 12/30/2016 7:52 AM, Wei Zhao wrote: > Add support for storing flow director filter in SW. > > Signed-off-by: Wenzhuo Lu <wenzhuo...@intel.com> > Signed-off-by: Wei Zhao <wei.zh...@intel.com> > --- > > v2: > --add a fdir initialization function in device start process > --- <...> > @@ -1276,6 +1278,9 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev) > > /* initialize SYN filter */ > filter_info->syn_info = 0; > + /* initialize flow director filter list & hash */ > + ixgbe_fdir_filter_init(eth_dev); > + > return 0; > } > > @@ -1284,6 +1289,9 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev) > { > struct rte_pci_device *pci_dev; > struct ixgbe_hw *hw; > + struct ixgbe_hw_fdir_info *fdir_info = > + IXGBE_DEV_PRIVATE_TO_FDIR_INFO(eth_dev->data->dev_private); > + struct ixgbe_fdir_filter *fdir_filter; > > PMD_INIT_FUNC_TRACE(); > > @@ -1317,9 +1325,56 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev) > rte_free(eth_dev->data->hash_mac_addrs); > eth_dev->data->hash_mac_addrs = NULL; > > + /* remove all the fdir filters & hash */ > + if (fdir_info->hash_map) > + rte_free(fdir_info->hash_map); > + if (fdir_info->hash_handle) > + rte_hash_free(fdir_info->hash_handle); > + > + while ((fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list))) { > + TAILQ_REMOVE(&fdir_info->fdir_list, > + fdir_filter, > + entries); > + rte_free(fdir_filter); > + } > +
What do you think extracting these into a function as done in init() ? <...>