patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Kevin Traynor <ktraynor@redhat.com>
To: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: [dpdk-stable] patch 'net/cxgbe: fix double MPS alloc by flow validate and create' has been queued to LTS release 18.11.10
Date: Wed,  2 Sep 2020 10:12:01 +0100	[thread overview]
Message-ID: <20200902091201.123509-2-ktraynor@redhat.com> (raw)
In-Reply-To: <20200902091201.123509-1-ktraynor@redhat.com>

Hi,

FYI, your patch has been queued to LTS release 18.11.10

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

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable-queue

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable-queue/commit/b82919008c7462a0f2e117e65210754ccb7470f1

Thanks.

Kevin.

---
From b82919008c7462a0f2e117e65210754ccb7470f1 Mon Sep 17 00:00:00 2001
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Date: Sat, 13 Jun 2020 03:37:25 +0530
Subject: [PATCH] net/cxgbe: fix double MPS alloc by flow validate and create

[ upstream commit be5f4d5ced10f9d7edc8ba4b3f1d98b9d476d367 ]

The Multi Port Switch (MPS) entry is allocated twice when both
flow validate and create are invoked, but only freed once during
flow destroy. Avoid double alloc by moving MPS entry allocation
closer to when the filter create request is sent to hardware and
will be ignored for filter validate request.

Fixes: fefee7a619a4 ("net/cxgbe: add flow ops to match based on dest MAC")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/cxgbe/cxgbe_filter.c | 32 ++++++++++++++++++++++++++++++++
 drivers/net/cxgbe/cxgbe_filter.h |  4 +++-
 drivers/net/cxgbe/cxgbe_flow.c   | 28 +++-------------------------
 3 files changed, 38 insertions(+), 26 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c
index 489c23249c..ffb669731e 100644
--- a/drivers/net/cxgbe/cxgbe_filter.c
+++ b/drivers/net/cxgbe/cxgbe_filter.c
@@ -8,4 +8,5 @@
 #include "t4_regs.h"
 #include "cxgbe_filter.h"
+#include "mps_tcam.h"
 #include "clip_tbl.h"
 #include "l2t.h"
@@ -274,7 +275,12 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries)
 static void clear_filter(struct filter_entry *f)
 {
+	struct port_info *pi = ethdev2pinfo(f->dev);
+
 	if (f->clipt)
 		cxgbe_clip_release(f->dev, f->clipt);
 
+	if (f->fs.mask.macidx)
+		cxgbe_mpstcam_remove(pi, f->fs.val.macidx);
+
 	/* The zeroing of the filter rule below clears the filter valid,
 	 * pending, locked flags etc. so it's all we need for
@@ -574,4 +580,17 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
 	f->fs.iq = iq;
 
+	/* Allocate MPS TCAM entry to match Destination MAC. */
+	if (f->fs.mask.macidx) {
+		int idx;
+
+		idx = cxgbe_mpstcam_alloc(pi, f->fs.val.dmac, f->fs.mask.dmac);
+		if (idx <= 0) {
+			ret = -ENOMEM;
+			goto out_err;
+		}
+
+		f->fs.val.macidx = idx;
+	}
+
 	/*
 	 * If the new filter requires loopback Destination MAC and/or VLAN
@@ -1006,4 +1025,17 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
 	f->dev = dev;
 
+	/* Allocate MPS TCAM entry to match Destination MAC. */
+	if (f->fs.mask.macidx) {
+		int idx;
+
+		idx = cxgbe_mpstcam_alloc(pi, f->fs.val.dmac, f->fs.mask.dmac);
+		if (idx <= 0) {
+			ret = -ENOMEM;
+			goto free_tid;
+		}
+
+		f->fs.val.macidx = idx;
+	}
+
 	/* Allocate a clip table entry only if we have non-zero IPv6 address. */
 	if (chip_ver > CHELSIO_T5 && f->fs.type &&
diff --git a/drivers/net/cxgbe/cxgbe_filter.h b/drivers/net/cxgbe/cxgbe_filter.h
index 06bac8ef09..5f7ca9c5c6 100644
--- a/drivers/net/cxgbe/cxgbe_filter.h
+++ b/drivers/net/cxgbe/cxgbe_filter.h
@@ -70,6 +70,8 @@ struct ch_filter_tuple {
 	uint16_t fport;		/* foreign port */
 
+	uint8_t dmac[6];        /* Destination MAC to match */
+
 	/* reservations for future additions */
-	uint8_t rsvd[12];
+	uint8_t rsvd[6];
 };
 
diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c
index d2466f29e4..feb5bb8bd2 100644
--- a/drivers/net/cxgbe/cxgbe_flow.c
+++ b/drivers/net/cxgbe/cxgbe_flow.c
@@ -122,18 +122,7 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item,
 
 	if (!is_zero_ether_addr(&mask->dst)) {
-		const u8 *addr = (const u8 *)&spec->dst.addr_bytes[0];
-		const u8 *m = (const u8 *)&mask->dst.addr_bytes[0];
-		struct rte_flow *flow = (struct rte_flow *)fs->private;
-		struct port_info *pi = (struct port_info *)
-					(flow->dev->data->dev_private);
-		int idx;
-
-		idx = cxgbe_mpstcam_alloc(pi, addr, m);
-		if (idx <= 0)
-			return rte_flow_error_set(e, idx,
-						  RTE_FLOW_ERROR_TYPE_ITEM,
-						  NULL, "unable to allocate mac"
-						  " entry in h/w");
-		CXGBE_FILL_FS(idx, 0x1ff, macidx);
+		CXGBE_FILL_FS(0, 0x1ff, macidx);
+		CXGBE_FILL_FS_MEMCPY(spec->dst.addr_bytes, mask->dst.addr_bytes,
+				     dmac);
 	}
 
@@ -922,15 +911,4 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)
 	}
 
-	fs = &flow->fs;
-	if (fs->mask.macidx) {
-		struct port_info *pi = (struct port_info *)
-					(dev->data->dev_private);
-		int ret;
-
-		ret = cxgbe_mpstcam_remove(pi, fs->val.macidx);
-		if (!ret)
-			return ret;
-	}
-
 	return 0;
 }
-- 
2.26.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2020-09-02 10:08:36.612933337 +0100
+++ 0002-net-cxgbe-fix-double-MPS-alloc-by-flow-validate-and-.patch	2020-09-02 10:08:36.560496766 +0100
@@ -1 +1 @@
-From be5f4d5ced10f9d7edc8ba4b3f1d98b9d476d367 Mon Sep 17 00:00:00 2001
+From b82919008c7462a0f2e117e65210754ccb7470f1 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit be5f4d5ced10f9d7edc8ba4b3f1d98b9d476d367 ]
+
@@ -13 +14,0 @@
-Cc: stable@dpdk.org
@@ -23 +24 @@
-index 06233e41e7..317830f58b 100644
+index 489c23249c..ffb669731e 100644
@@ -26,2 +27,2 @@
-@@ -9,4 +9,5 @@
- #include "base/t4_regs.h"
+@@ -8,4 +8,5 @@
+ #include "t4_regs.h"
@@ -32 +33 @@
-@@ -291,4 +292,6 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries)
+@@ -274,7 +275,12 @@ int cxgbe_alloc_ftid(struct adapter *adap, u8 nentries)
@@ -39,2 +39,0 @@
-@@ -297,4 +300,7 @@ static void clear_filter(struct filter_entry *f)
- 		cxgbe_l2t_release(f->l2t);
@@ -47 +46 @@
-@@ -610,4 +616,17 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
+@@ -574,4 +580,17 @@ static int cxgbe_set_hash_filter(struct rte_eth_dev *dev,
@@ -65 +64 @@
-@@ -1068,4 +1087,17 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
+@@ -1006,4 +1025,17 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
@@ -84 +83 @@
-index e79c052de6..46ebf83338 100644
+index 06bac8ef09..5f7ca9c5c6 100644
@@ -98 +97 @@
-index 166c39ba55..dd8ee7bbd6 100644
+index d2466f29e4..feb5bb8bd2 100644
@@ -101 +100 @@
-@@ -195,18 +195,7 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item,
+@@ -122,18 +122,7 @@ ch_rte_parsetype_eth(const void *dmask, const struct rte_flow_item *item,
@@ -103 +102 @@
- 	if (!rte_is_zero_ether_addr(&mask->dst)) {
+ 	if (!is_zero_ether_addr(&mask->dst)) {
@@ -123 +122 @@
-@@ -1213,15 +1202,4 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)
+@@ -922,15 +911,4 @@ static int __cxgbe_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow)


      reply	other threads:[~2020-09-02  9:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02  9:12 [dpdk-stable] patch 'app/testpmd: fix stats error message' " Kevin Traynor
2020-09-02  9:12 ` Kevin Traynor [this message]

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=20200902091201.123509-2-ktraynor@redhat.com \
    --to=ktraynor@redhat.com \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=stable@dpdk.org \
    /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).