This patch is to flush all macvlan filters.

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

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index e685c99..26a8c5a 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -528,6 +528,7 @@ static int i40e_flow_destroy(struct rte_eth_dev *dev,
                             struct rte_flow *flow,
                             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_flow_flush(struct rte_eth_dev *dev,
                             struct rte_flow_error *error);
 
@@ -11831,6 +11832,23 @@ i40e_ethertype_filter_flush(struct i40e_pf *pf)
        return ret;
 }
 
+/* Flush all macvlan filters */
+static int
+i40e_macvlan_filter_flush(struct i40e_pf *pf)
+{
+       struct i40e_mac_filter *f;
+       struct i40e_vsi *vsi;
+       int i, ret = 0;
+
+       for (i = 0; i < pf->vf_num; i++) {
+               vsi = pf->vfs[i].vsi;
+               while ((f = TAILQ_FIRST(&vsi->mac_list)))
+                       ret = i40e_dev_destroy_macvlan_filter(pf, vsi, f);
+       }
+
+       return ret;
+}
+
 static int
 i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
 {
@@ -11849,5 +11867,11 @@ i40e_flow_flush(struct rte_eth_dev *dev, struct 
rte_flow_error *error)
                return ret;
        }
 
+       ret = i40e_macvlan_filter_flush(pf);
+       if (ret) {
+               error->type = RTE_FLOW_ERROR_TYPE_HANDLE;
+               return ret;
+       }
+
        return ret;
 }
-- 
2.5.5

Reply via email to