[dpdk-stable] patch 'net/bnxt: fix duplicate filter pattern creation error' has been queued to LTS release 17.11.1

Yuanhan Liu yliu at fridaylinux.org
Wed Jan 24 16:32:37 CET 2018


Hi,

FYI, your patch has been queued to LTS release 17.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 01/26/18. So please
shout if anyone has objections.

Thanks.

	--yliu

---
>From 94859d52f3f5aa3f55a2c5401c511a587228faaf Mon Sep 17 00:00:00 2001
From: Somnath Kotur <somnath.kotur at broadcom.com>
Date: Mon, 8 Jan 2018 12:24:34 -0800
Subject: [PATCH] net/bnxt: fix duplicate filter pattern creation error

[ upstream commit 46667f9377ffcb48af3c6d8998dd4bc6df8436f5 ]

If the attribute/pattern for a flow is the same, with only the 'action'
i.e the destination queue index changing, allow it by cleaning up
the older ntuple filter and updating the existing flow with
the new filter rule having the new destination queue ID.
Also, clear the L2 filter during flow_destroy after destroying
the ntuple filter, otherwise the flow record is not completely purged
from the HW.

Fixes: 5ef3b79fdfe6 ("net/bnxt: support flow filter ops")

Signed-off-by: Somnath Kotur <somnath.kotur at broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde at broadcom.com>
---
 drivers/net/bnxt/bnxt_filter.c | 42 +++++++++++++++++++++++++++++++++++++-----
 drivers/net/bnxt/bnxt_hwrm.c   |  1 -
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_filter.c b/drivers/net/bnxt/bnxt_filter.c
index 65d30fb..32af606 100644
--- a/drivers/net/bnxt/bnxt_filter.c
+++ b/drivers/net/bnxt/bnxt_filter.c
@@ -1042,8 +1042,23 @@ bnxt_match_filter(struct bnxt *bp, struct bnxt_filter_info *nf)
 			    !memcmp(mf->dst_ipaddr, nf->dst_ipaddr,
 				    sizeof(nf->dst_ipaddr)) &&
 			    !memcmp(mf->dst_ipaddr_mask, nf->dst_ipaddr_mask,
-				    sizeof(nf->dst_ipaddr_mask)))
-				return -EEXIST;
+				    sizeof(nf->dst_ipaddr_mask))) {
+				if (mf->dst_id == nf->dst_id)
+					return -EEXIST;
+				/* Same Flow, Different queue
+				 * Clear the old ntuple filter
+				 */
+				if (nf->filter_type == HWRM_CFA_EM_FILTER)
+					bnxt_hwrm_clear_em_filter(bp, mf);
+				if (nf->filter_type == HWRM_CFA_NTUPLE_FILTER)
+					bnxt_hwrm_clear_ntuple_filter(bp, mf);
+				/* Free the old filter, update flow
+				 * with new filter
+				 */
+				bnxt_free_filter(bp, mf);
+				flow->filter = nf;
+				return -EXDEV;
+			}
 		}
 	}
 	return 0;
@@ -1059,6 +1074,7 @@ bnxt_flow_create(struct rte_eth_dev *dev,
 	struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
 	struct bnxt_filter_info *filter;
 	struct bnxt_vnic_info *vnic = NULL;
+	bool update_flow = false;
 	struct rte_flow *flow;
 	unsigned int i;
 	int ret = 0;
@@ -1089,9 +1105,17 @@ bnxt_flow_create(struct rte_eth_dev *dev,
 		goto free_filter;
 
 	ret = bnxt_match_filter(bp, filter);
-	if (ret != 0) {
+	if (ret == -EEXIST) {
 		RTE_LOG(DEBUG, PMD, "Flow already exists.\n");
+		/* Clear the filter that was created as part of
+		 * validate_and_parse_flow() above
+		 */
+		bnxt_hwrm_clear_l2_filter(bp, filter);
 		goto free_filter;
+	} else if (ret == -EXDEV) {
+		RTE_LOG(DEBUG, PMD, "Flow with same pattern exists");
+		RTE_LOG(DEBUG, PMD, "Updating with different destination\n");
+		update_flow = true;
 	}
 
 	if (filter->filter_type == HWRM_CFA_EM_FILTER) {
@@ -1114,22 +1138,29 @@ bnxt_flow_create(struct rte_eth_dev *dev,
 	if (!ret) {
 		flow->filter = filter;
 		flow->vnic = vnic;
+		if (update_flow) {
+			ret = -EXDEV;
+			goto free_flow;
+		}
 		RTE_LOG(ERR, PMD, "Successfully created flow.\n");
 		STAILQ_INSERT_TAIL(&vnic->flow_list, flow, next);
 		return flow;
 	}
 free_filter:
-	filter->fw_l2_filter_id = -1;
 	bnxt_free_filter(bp, filter);
 free_flow:
 	if (ret == -EEXIST)
 		rte_flow_error_set(error, ret,
 				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
 				   "Matching Flow exists.");
+	else if (ret == -EXDEV)
+		rte_flow_error_set(error, ret,
+				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
+				   "Flow with pattern exists, updating destination queue");
 	else
 		rte_flow_error_set(error, -ret,
 				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-			   "Failed to create flow.");
+				   "Failed to create flow.");
 	rte_free(flow);
 	flow = NULL;
 	return flow;
@@ -1153,6 +1184,7 @@ bnxt_flow_destroy(struct rte_eth_dev *dev,
 	if (filter->filter_type == HWRM_CFA_NTUPLE_FILTER)
 		ret = bnxt_hwrm_clear_ntuple_filter(bp, filter);
 
+	bnxt_hwrm_clear_l2_filter(bp, filter);
 	if (!ret) {
 		STAILQ_REMOVE(&vnic->flow_list, flow, rte_flow, next);
 		rte_free(flow);
diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c
index 564e3f7..3b93bb5 100644
--- a/drivers/net/bnxt/bnxt_hwrm.c
+++ b/drivers/net/bnxt/bnxt_hwrm.c
@@ -3569,7 +3569,6 @@ int bnxt_hwrm_clear_ntuple_filter(struct bnxt *bp,
 	HWRM_UNLOCK();
 
 	filter->fw_ntuple_filter_id = -1;
-	filter->fw_l2_filter_id = -1;
 
 	return 0;
 }
-- 
2.7.4



More information about the stable mailing list