net/ixgbe: flush all the filter list
authorWei Zhao <wei.zhao1@intel.com>
Fri, 13 Jan 2017 08:13:12 +0000 (16:13 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:41:43 +0000 (19:41 +0100)
This patch adds a function to flush all the filter list
filter on a port.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Wei Dai <wei.dai@intel.com>
drivers/net/ixgbe/ixgbe_ethdev.c
drivers/net/ixgbe/ixgbe_ethdev.h
drivers/net/ixgbe/ixgbe_flow.c

index 7efe005..bdf4e2b 100644 (file)
@@ -1392,6 +1392,9 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev)
        /* Remove all ntuple filters of the device */
        ixgbe_ntuple_filter_uninit(eth_dev);
 
+       /* clear all the filters list */
+       ixgbe_filterlist_flush();
+
        return 0;
 }
 
index 23485c8..6695b68 100644 (file)
@@ -592,6 +592,7 @@ ixgbe_dev_l2_tunnel_filter_add(struct rte_eth_dev *dev,
 int
 ixgbe_dev_l2_tunnel_filter_del(struct rte_eth_dev *dev,
                               struct rte_eth_l2_tunnel_conf *l2_tunnel);
+void ixgbe_filterlist_flush(void);
 /*
  * Flow director function prototypes
  */
index 20aefa6..82aceed 100644 (file)
@@ -2444,6 +2444,60 @@ ixgbe_parse_fdir_filter(const struct rte_flow_attr *attr,
        return ret;
 }
 
+void
+ixgbe_filterlist_flush(void)
+{
+       struct ixgbe_ntuple_filter_ele *ntuple_filter_ptr;
+       struct ixgbe_ethertype_filter_ele *ethertype_filter_ptr;
+       struct ixgbe_eth_syn_filter_ele *syn_filter_ptr;
+       struct ixgbe_eth_l2_tunnel_conf_ele *l2_tn_filter_ptr;
+       struct ixgbe_fdir_rule_ele *fdir_rule_ptr;
+       struct ixgbe_flow_mem *ixgbe_flow_mem_ptr;
+
+       while ((ntuple_filter_ptr = TAILQ_FIRST(&filter_ntuple_list))) {
+               TAILQ_REMOVE(&filter_ntuple_list,
+                                ntuple_filter_ptr,
+                                entries);
+               rte_free(ntuple_filter_ptr);
+       }
+
+       while ((ethertype_filter_ptr = TAILQ_FIRST(&filter_ethertype_list))) {
+               TAILQ_REMOVE(&filter_ethertype_list,
+                                ethertype_filter_ptr,
+                                entries);
+               rte_free(ethertype_filter_ptr);
+       }
+
+       while ((syn_filter_ptr = TAILQ_FIRST(&filter_syn_list))) {
+               TAILQ_REMOVE(&filter_syn_list,
+                                syn_filter_ptr,
+                                entries);
+               rte_free(syn_filter_ptr);
+       }
+
+       while ((l2_tn_filter_ptr = TAILQ_FIRST(&filter_l2_tunnel_list))) {
+               TAILQ_REMOVE(&filter_l2_tunnel_list,
+                                l2_tn_filter_ptr,
+                                entries);
+               rte_free(l2_tn_filter_ptr);
+       }
+
+       while ((fdir_rule_ptr = TAILQ_FIRST(&filter_fdir_list))) {
+               TAILQ_REMOVE(&filter_fdir_list,
+                                fdir_rule_ptr,
+                                entries);
+               rte_free(fdir_rule_ptr);
+       }
+
+       while ((ixgbe_flow_mem_ptr = TAILQ_FIRST(&ixgbe_flow_list))) {
+               TAILQ_REMOVE(&ixgbe_flow_list,
+                                ixgbe_flow_mem_ptr,
+                                entries);
+               rte_free(ixgbe_flow_mem_ptr->flow);
+               rte_free(ixgbe_flow_mem_ptr);
+       }
+}
+
 /**
  * Create or destroy a flow rule.
  * Theorically one rule can match more than one filters.
@@ -2818,5 +2872,7 @@ ixgbe_flow_flush(struct rte_eth_dev *dev,
                return ret;
        }
 
+       ixgbe_filterlist_flush();
+
        return 0;
 }