DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ajit Khaparde <ajit.khaparde@broadcom.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com
Subject: [dpdk-dev] [PATCH 1/2] net/bnxt: fix duplicate creation of ntuple filter
Date: Thu,  9 Nov 2017 11:46:27 -0600	[thread overview]
Message-ID: <20171109174628.44636-1-ajit.khaparde@broadcom.com> (raw)

Prevent the creation of duplicate 5tuple filters.
Fixes: b7435d660a8c ("net/bnxt: add ntuple filtering support")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
---
 drivers/net/bnxt/bnxt_ethdev.c | 36 ++++++++++++++++++++----------------
 1 file changed, 20 insertions(+), 16 deletions(-)

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e8c7d0e7c..dc437b480 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -1956,25 +1956,29 @@ parse_ntuple_filter(struct bnxt *bp,
 }
 
 static struct bnxt_filter_info*
-bnxt_match_ntuple_filter(struct bnxt_vnic_info *vnic,
+bnxt_match_ntuple_filter(struct bnxt *bp,
 			 struct bnxt_filter_info *bfilter)
 {
 	struct bnxt_filter_info *mfilter = NULL;
+	int i;
 
-	STAILQ_FOREACH(mfilter, &vnic->filter, next) {
-		if (bfilter->src_ipaddr[0] == mfilter->src_ipaddr[0] &&
-		    bfilter->src_ipaddr_mask[0] ==
-		    mfilter->src_ipaddr_mask[0] &&
-		    bfilter->src_port == mfilter->src_port &&
-		    bfilter->src_port_mask == mfilter->src_port_mask &&
-		    bfilter->dst_ipaddr[0] == mfilter->dst_ipaddr[0] &&
-		    bfilter->dst_ipaddr_mask[0] ==
-		    mfilter->dst_ipaddr_mask[0] &&
-		    bfilter->dst_port == mfilter->dst_port &&
-		    bfilter->dst_port_mask == mfilter->dst_port_mask &&
-		    bfilter->flags == mfilter->flags &&
-		    bfilter->enables == mfilter->enables)
-			return mfilter;
+	for (i = bp->nr_vnics - 1; i >= 0; i--) {
+		struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+		STAILQ_FOREACH(mfilter, &vnic->filter, next) {
+			if (bfilter->src_ipaddr[0] == mfilter->src_ipaddr[0] &&
+			    bfilter->src_ipaddr_mask[0] ==
+			    mfilter->src_ipaddr_mask[0] &&
+			    bfilter->src_port == mfilter->src_port &&
+			    bfilter->src_port_mask == mfilter->src_port_mask &&
+			    bfilter->dst_ipaddr[0] == mfilter->dst_ipaddr[0] &&
+			    bfilter->dst_ipaddr_mask[0] ==
+			    mfilter->dst_ipaddr_mask[0] &&
+			    bfilter->dst_port == mfilter->dst_port &&
+			    bfilter->dst_port_mask == mfilter->dst_port_mask &&
+			    bfilter->flags == mfilter->flags &&
+			    bfilter->enables == mfilter->enables)
+				return mfilter;
+		}
 	}
 	return NULL;
 }
@@ -2023,7 +2027,7 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
 	bfilter->ethertype = 0x800;
 	bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE;
 
-	mfilter = bnxt_match_ntuple_filter(vnic, bfilter);
+	mfilter = bnxt_match_ntuple_filter(bp, bfilter);
 
 	if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD) {
 		RTE_LOG(ERR, PMD, "filter exists.");
-- 
2.13.6 (Apple Git-96)

             reply	other threads:[~2017-11-09 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-09 17:46 Ajit Khaparde [this message]
2017-11-09 17:46 ` [dpdk-dev] [PATCH 2/2] net/bnxt: fix link handling and configuration Ajit Khaparde
2017-11-10  1:15   ` Ferruh Yigit
2017-11-10  9:54 ` [dpdk-dev] [PATCH 1/2] net/bnxt: fix duplicate creation of ntuple filter Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171109174628.44636-1-ajit.khaparde@broadcom.com \
    --to=ajit.khaparde@broadcom.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).