From: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
This patch does the following
1. Gets the ulp session information from eth_dev
2. Fetches the flow associated with the flow id from the flow table
3. Calls ulp_mapper_resources_free which releases the key & action
tables associated with that flow
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
@@ -232,10 +232,40 @@ bnxt_ulp_flow_validate(struct rte_eth_dev *dev __rte_unused,
return -EINVAL;
}
+/* Function to destroy the rte flow. */
+static int
+bnxt_ulp_flow_destroy(struct rte_eth_dev *dev,
+ struct rte_flow *flow,
+ struct rte_flow_error *error)
+{
+ int ret = 0;
+ struct bnxt_ulp_context *ulp_ctx;
+ uint32_t fid;
+
+ ulp_ctx = bnxt_ulp_eth_dev_ptr2_cntxt_get(dev);
+ if (!ulp_ctx) {
+ BNXT_TF_DBG(ERR, "ULP context is not initialized\n");
+ rte_flow_error_set(error, EINVAL,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Failed to destroy flow.");
+ return -EINVAL;
+ }
+
+ fid = (uint32_t)(uintptr_t)flow;
+
+ ret = ulp_mapper_flow_destroy(ulp_ctx, fid);
+ if (ret)
+ rte_flow_error_set(error, -ret,
+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+ "Failed to destroy flow.");
+
+ return ret;
+}
+
const struct rte_flow_ops bnxt_ulp_rte_flow_ops = {
.validate = bnxt_ulp_flow_validate,
.create = bnxt_ulp_flow_create,
- .destroy = NULL,
+ .destroy = bnxt_ulp_flow_destroy,
.flush = NULL,
.query = NULL,
.isolate = NULL