From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 78BE7376C for ; Fri, 30 Dec 2016 08:58:16 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga102.jf.intel.com with ESMTP; 29 Dec 2016 23:58:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,428,1477983600"; d="scan'208";a="803524576" Received: from dpdk1.bj.intel.com ([172.16.182.84]) by FMSMGA003.fm.intel.com with ESMTP; 29 Dec 2016 23:58:12 -0800 From: Wei Zhao To: dev@dpdk.org Cc: Wei Zhao , Wenzhuo Lu Date: Fri, 30 Dec 2016 15:53:10 +0800 Message-Id: <1483084390-53159-19-git-send-email-wei.zhao1@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1483084390-53159-1-git-send-email-wei.zhao1@intel.com> References: <1483084390-53159-1-git-send-email-wei.zhao1@intel.com> Subject: [dpdk-dev] [PATCH v2 18/18] net/ixgbe: flush all the filter list X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 30 Dec 2016 07:58:16 -0000 This patch adds a function to flush all the fliter list filter on a port. Signed-off-by: Wei Zhao Signed-off-by: Wenzhuo Lu --- --- drivers/net/ixgbe/ixgbe_ethdev.c | 59 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 8f2182c..e12eee0 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -478,6 +478,7 @@ static int ixgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow_error *error); static int ixgbe_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error); +static void ixgbe_filterlist_flush(void); /* * Define VF Stats MACRO for Non "cleared on read" register */ @@ -1526,6 +1527,9 @@ eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev) rte_free(l2_tn_filter); } + /* clear all the filters list */ + ixgbe_filterlist_flush(); + return 0; } @@ -10318,6 +10322,8 @@ ixgbe_flow_flush(struct rte_eth_dev *dev, return ret; } + ixgbe_filterlist_flush(); + return 0; } @@ -10394,6 +10400,59 @@ ixgbe_flow_validate(__rte_unused struct rte_eth_dev *dev, return ret; } +static 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. -- 2.5.5