From: wei zhao1 <wei.zh...@intel.com>

This patch adds a function to flush all the flow directory
filter on a port.

Signed-off-by: wei zhao1 <wei.zh...@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo...@intel.com>
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 23efc57..e420a3f 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -458,6 +458,8 @@ struct ixgbe_flow *ixgbe_flow_create(struct rte_eth_dev 
*dev,
 int ixgbe_flow_destroy(struct rte_eth_dev *dev,
                struct rte_flow *flow,
                struct rte_flow_error *error);
+int ixgbe_flow_flush(struct rte_eth_dev *dev,
+               struct rte_flow_error *error);
 
 /*
  * Define VF Stats MACRO for Non "cleared on read" register
@@ -847,7 +849,7 @@ static const struct rte_flow_ops ixgbe_flow_ops = {
        ixgbe_flow_validate,
        (void *)ixgbe_flow_create,
        ixgbe_flow_destroy,
-       NULL,
+       ixgbe_flow_flush,
        NULL,
 };
 /* ntuple filter list structure */
@@ -9946,6 +9948,22 @@ ixgbe_flow_destroy(struct rte_eth_dev *dev,
 
 }
 
+/*  Destroy all flow rules associated with a port on ixgbe. */
+int
+ixgbe_flow_flush(struct rte_eth_dev *dev,
+               struct rte_flow_error *error)
+{
+       int ret = 0;
+
+       error->type = RTE_FLOW_ERROR_TYPE_NONE;
+       if((ret = ixgbe_flush_all_filter(dev)) != 0) {
+               error->type = RTE_FLOW_ERROR_TYPE_HANDLE;
+               return ret;
+       }
+
+       return ret;
+}
+
 RTE_PMD_REGISTER_PCI(net_ixgbe, rte_ixgbe_pmd.pci_drv);
 RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe, pci_id_ixgbe_map);
 RTE_PMD_REGISTER_PCI(net_ixgbe_vf, rte_ixgbevf_pmd.pci_drv);
-- 
2.5.5

Reply via email to