This patch is to flush all tunnel filters.

Signed-off-by: Beilei Xing <beilei.x...@intel.com>
---
 drivers/net/i40e/i40e_ethdev.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 26a8c5a..71d1f37 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -529,6 +529,7 @@ static int i40e_flow_destroy(struct rte_eth_dev *dev,
                             struct rte_flow_error *error);
 static int i40e_ethertype_filter_flush(struct i40e_pf *pf);
 static int i40e_macvlan_filter_flush(struct i40e_pf *pf);
+static int i40e_tunnel_filter_flush(struct i40e_pf *pf);
 static int i40e_flow_flush(struct rte_eth_dev *dev,
                             struct rte_flow_error *error);
 
@@ -11849,6 +11850,21 @@ i40e_macvlan_filter_flush(struct i40e_pf *pf)
        return ret;
 }
 
+/* Flush all tunnel filters */
+static int
+i40e_tunnel_filter_flush(struct i40e_pf *pf)
+{
+       struct i40e_tunnel_filter_list
+               *tunnel_list = &pf->tunnel.tunnel_list;
+       struct i40e_tunnel_filter *f;
+       int ret = 0;
+
+       while ((f = TAILQ_FIRST(tunnel_list)))
+               ret = i40e_dev_destroy_tunnel_filter(pf, f);
+
+       return ret;
+}
+
 static int
 i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
 {
@@ -11873,5 +11889,11 @@ i40e_flow_flush(struct rte_eth_dev *dev, struct 
rte_flow_error *error)
                return ret;
        }
 
+       ret = i40e_tunnel_filter_flush(pf);
+       if (ret) {
+               error->type = RTE_FLOW_ERROR_TYPE_HANDLE;
+               return ret;
+       }
+
        return ret;
 }
-- 
2.5.5

Reply via email to