DPDK patches and discussions
 help / color / mirror / Atom feed
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, nirranjan@chelsio.com
Subject: [dpdk-dev] [PATCH 2/5] net/cxgbe: fix L2T leak in filter error and free path
Date: Sat, 13 Jun 2020 03:37:24 +0530	[thread overview]
Message-ID: <44ebac5f5138fe050834f6d6e1d71d358a613016.1591998771.git.rahul.lakkireddy@chelsio.com> (raw)
In-Reply-To: <cover.1591998771.git.rahul.lakkireddy@chelsio.com>
In-Reply-To: <cover.1591998771.git.rahul.lakkireddy@chelsio.com>

Free up Layer 2 Table (L2T) entry properly during filter create
failure and filter delete.

Fixes: 1decc62b1cbe ("net/cxgbe: add flow operations to offload VLAN actions")
Cc: stable@dpdk.org

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
---
 drivers/net/cxgbe/cxgbe_filter.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe_filter.c b/drivers/net/cxgbe/cxgbe_filter.c
index 45602d468..06233e41e 100644
--- a/drivers/net/cxgbe/cxgbe_filter.c
+++ b/drivers/net/cxgbe/cxgbe_filter.c
@@ -293,6 +293,9 @@ static void clear_filter(struct filter_entry *f)
 	if (f->clipt)
 		cxgbe_clip_release(f->dev, f->clipt);
 
+	if (f->l2t)
+		cxgbe_l2t_release(f->l2t);
+
 	/* The zeroing of the filter rule below clears the filter valid,
 	 * pending, locked flags etc. so it's all we need for
 	 * this operation.
@@ -755,20 +758,6 @@ static int set_filter_wr(struct rte_eth_dev *dev, unsigned int fidx)
 	unsigned int port_id = ethdev2pinfo(dev)->port_id;
 	int ret;
 
-	/*
-	 * If the new filter requires loopback Destination MAC and/or VLAN
-	 * rewriting then we need to allocate a Layer 2 Table (L2T) entry for
-	 * the filter.
-	 */
-	if (f->fs.newvlan || f->fs.newdmac) {
-		/* allocate L2T entry for new filter */
-		f->l2t = cxgbe_l2t_alloc_switching(f->dev, f->fs.vlan,
-						   f->fs.eport, f->fs.dmac);
-
-		if (!f->l2t)
-			return -ENOMEM;
-	}
-
 	/* If the new filter requires Source MAC rewriting then we need to
 	 * allocate a SMT entry for the filter
 	 */
@@ -1088,6 +1077,19 @@ int cxgbe_set_filter(struct rte_eth_dev *dev, unsigned int filter_id,
 		}
 	}
 
+	/* If the new filter requires loopback Destination MAC and/or VLAN
+	 * rewriting then we need to allocate a Layer 2 Table (L2T) entry for
+	 * the filter.
+	 */
+	if (f->fs.newvlan || f->fs.newdmac) {
+		f->l2t = cxgbe_l2t_alloc_switching(f->dev, f->fs.vlan,
+						   f->fs.eport, f->fs.dmac);
+		if (!f->l2t) {
+			ret = -ENOMEM;
+			goto free_tid;
+		}
+	}
+
 	iconf = adapter->params.tp.ingress_config;
 
 	/* Either PFVF or OVLAN can be active, but not both
-- 
2.24.0


  parent reply	other threads:[~2020-06-12 22:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-12 22:07 [dpdk-dev] [PATCH 0/5] net/cxgbe: fix rte_flow related hardware resource leaks Rahul Lakkireddy
2020-06-12 22:07 ` [dpdk-dev] [PATCH 1/5] net/cxgbe: fix CLIP leak in filter error path Rahul Lakkireddy
2020-06-12 22:07 ` Rahul Lakkireddy [this message]
2020-06-12 22:07 ` [dpdk-dev] [PATCH 3/5] net/cxgbe: fix double MPS alloc due to flow validate and create Rahul Lakkireddy
2020-06-12 22:07 ` [dpdk-dev] [PATCH 4/5] net/cxgbe: fix SMT leak in filter error and free path Rahul Lakkireddy
2020-06-12 22:07 ` [dpdk-dev] [PATCH 5/5] net/cxgbe: ignore flow default masks for unrequested fields Rahul Lakkireddy
2020-06-17 13:33 ` [dpdk-dev] [dpdk-stable] [PATCH 0/5] net/cxgbe: fix rte_flow related hardware resource leaks 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=44ebac5f5138fe050834f6d6e1d71d358a613016.1591998771.git.rahul.lakkireddy@chelsio.com \
    --to=rahul.lakkireddy@chelsio.com \
    --cc=dev@dpdk.org \
    --cc=nirranjan@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).