From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <stable-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id DA164455AD
	for <public@inbox.dpdk.org>; Mon, 15 Jul 2024 17:31:01 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D609440DFB;
	Mon, 15 Jul 2024 17:31:01 +0200 (CEST)
Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com
 [209.85.128.43]) by mails.dpdk.org (Postfix) with ESMTP id 9E02340A71
 for <stable@dpdk.org>; Mon, 15 Jul 2024 17:31:00 +0200 (CEST)
Received: by mail-wm1-f43.google.com with SMTP id
 5b1f17b1804b1-4266b1f1b21so29889905e9.1
 for <stable@dpdk.org>; Mon, 15 Jul 2024 08:31:00 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1721057460; x=1721662260; darn=dpdk.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=oeGQEpjdye2CpOWRPFuEFP3RmfMG43R1AtiuVSlp8ek=;
 b=gj1ZBG1pjLYPJn1/GVbij4WkExP10fn3i98MUrZ4HCZhhpwXo+OJg5+5Izua8Tgddh
 /l3wdFJ0IZv4mz+BJ+Dd/6L9safnnJFpETsPzDVwlvHF0dIjn1sftn4pQvqx2lIruCl2
 NnXwDbRV6hrJBXmqP9RAbKq609RmuizuQjYeoKUme9F9TpgtU7hVvkjCV7be3uvOFz8V
 9U3nC/TP+fUMGNwklWpTc+J1UwCv7BvhPrYSvj4aiSHpK21ySSskWQ4S7ClCxNFIs3va
 q8FIFSzRrExtJZJ/KoRngpU6sYRTnI7uVLsEFiPklYjC7G1iYPAODNw9mnLljWZtClSF
 LvnA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1721057460; x=1721662260;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=oeGQEpjdye2CpOWRPFuEFP3RmfMG43R1AtiuVSlp8ek=;
 b=ZbGUiY6w45BKATZqWQGDva8JAecydEeNQDdMMva79/WcxdQTX8jdtaZq+XG63x3NgE
 aY3BGvx8lIRuelm0HntLauMUyeGxX7JODcOlLk7m/af3SUVpxx51tGdxttmB+Ee3QREC
 6GAgVixd9rAopYw2e2Tqe8BVc1i7WWMRkBOvsbDGEGlvh9JS5XWI8w5yedU0q7vQ7XHb
 mdcUZQfaSRLRfzv01+o72mTe0QJyW9NXezA0tEH6UkdGSXORSeYuPI5xjmrk/G5Ojne0
 O61au6G07B+Hob7dDO6X1P3Djy24V5+/MxH7sO9dus6WuQrCXi4400pMQjYwQIe7DxqM
 P6aQ==
X-Gm-Message-State: AOJu0YxoaqLYbtKHrZqAmW6jvaX5g9d25iip1MUnpqCDgep6AlwFa2sB
 RxiCr2UiPgB3gSe7wpu7jFEsd3sWYaIJKavVDAmqXnLbm03Df78PER2msCEoouI=
X-Google-Smtp-Source: AGHT+IGm1mhfJ/yWBfoD56PIyFeLP0m8gL5ueV4BfXgalg9k4EaI74VEC22gipGxVM8DvPUViTt9JQ==
X-Received: by 2002:a05:600c:460a:b0:426:51d1:63c3 with SMTP id
 5b1f17b1804b1-426708fa8e2mr126878835e9.38.1721057460185; 
 Mon, 15 Jul 2024 08:31:00 -0700 (PDT)
Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546])
 by smtp.gmail.com with ESMTPSA id
 ffacd0b85a97d-3680dafbe6fsm6740923f8f.66.2024.07.15.08.30.59
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 15 Jul 2024 08:30:59 -0700 (PDT)
From: luca.boccassi@gmail.com
To: Jiawen Wu <jiawenwu@trustnetic.com>
Cc: dpdk stable <stable@dpdk.org>
Subject: patch 'net/ngbe: fix memory leaks' has been queued to stable release
 22.11.6
Date: Mon, 15 Jul 2024 16:26:51 +0100
Message-Id: <20240715152704.2229503-73-luca.boccassi@gmail.com>
X-Mailer: git-send-email 2.39.2
In-Reply-To: <20240715152704.2229503-1-luca.boccassi@gmail.com>
References: <20240624235907.885628-81-luca.boccassi@gmail.com>
 <20240715152704.2229503-1-luca.boccassi@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
Errors-To: stable-bounces@dpdk.org

Hi,

FYI, your patch has been queued to stable release 22.11.6

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 07/17/24. 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/bluca/dpdk-stable

This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/bd6f2422df5e1232fff9ffacfcadf89b35ce6380

Thanks.

Luca Boccassi

---
>From bd6f2422df5e1232fff9ffacfcadf89b35ce6380 Mon Sep 17 00:00:00 2001
From: Jiawen Wu <jiawenwu@trustnetic.com>
Date: Tue, 18 Jun 2024 15:11:46 +0800
Subject: [PATCH] net/ngbe: fix memory leaks

[ upstream commit fea7422f7a4ec2b4c406865629b5ebea699f6588 ]

Fix some memory leaks caused by not release resource in time.

Fixes: 43b7e5ea60ac ("net/ngbe: support Rx queue setup/release")
Fixes: a58e7c312c6b ("net/ngbe: support Tx queue setup/release")

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/ngbe/ngbe_rxtx.c | 5 +++++
 drivers/net/ngbe/ngbe_rxtx.h | 2 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
index 54a6f6a887..8490b08318 100644
--- a/drivers/net/ngbe/ngbe_rxtx.c
+++ b/drivers/net/ngbe/ngbe_rxtx.c
@@ -1791,6 +1791,7 @@ ngbe_tx_queue_release(struct ngbe_tx_queue *txq)
 		if (txq->ops != NULL) {
 			txq->ops->release_mbufs(txq);
 			txq->ops->free_swring(txq);
+			rte_memzone_free(txq->mz);
 		}
 		rte_free(txq);
 	}
@@ -1995,6 +1996,7 @@ ngbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	txq->mz = tz;
 	txq->nb_tx_desc = nb_desc;
 	txq->tx_free_thresh = tx_free_thresh;
 	txq->pthresh = tx_conf->tx_thresh.pthresh;
@@ -2097,6 +2099,7 @@ ngbe_rx_queue_release(struct ngbe_rx_queue *rxq)
 		ngbe_rx_queue_release_mbufs(rxq);
 		rte_free(rxq->sw_ring);
 		rte_free(rxq->sw_sc_ring);
+		rte_memzone_free(rxq->mz);
 		rte_free(rxq);
 	}
 }
@@ -2187,6 +2190,7 @@ ngbe_reset_rx_queue(struct ngbe_adapter *adapter, struct ngbe_rx_queue *rxq)
 	rxq->rx_free_trigger = (uint16_t)(rxq->rx_free_thresh - 1);
 	rxq->rx_tail = 0;
 	rxq->nb_rx_hold = 0;
+	rte_pktmbuf_free(rxq->pkt_first_seg);
 	rxq->pkt_first_seg = NULL;
 	rxq->pkt_last_seg = NULL;
 }
@@ -2277,6 +2281,7 @@ ngbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
 		return -ENOMEM;
 	}
 
+	rxq->mz = rz;
 	/*
 	 * Zero init all the descriptors in the ring.
 	 */
diff --git a/drivers/net/ngbe/ngbe_rxtx.h b/drivers/net/ngbe/ngbe_rxtx.h
index 9130f9d0df..2914b9a756 100644
--- a/drivers/net/ngbe/ngbe_rxtx.h
+++ b/drivers/net/ngbe/ngbe_rxtx.h
@@ -276,6 +276,7 @@ struct ngbe_rx_queue {
 	struct rte_mbuf fake_mbuf;
 	/** hold packets to return to application */
 	struct rte_mbuf *rx_stage[RTE_PMD_NGBE_RX_MAX_BURST * 2];
+	const struct rte_memzone *mz;
 };
 
 /**
@@ -353,6 +354,7 @@ struct ngbe_tx_queue {
 	uint8_t              tx_deferred_start; /**< not in global dev start */
 
 	const struct ngbe_txq_ops *ops;       /**< txq ops */
+	const struct rte_memzone *mz;
 };
 
 struct ngbe_txq_ops {
-- 
2.39.2

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-07-15 16:19:38.250661800 +0100
+++ 0073-net-ngbe-fix-memory-leaks.patch	2024-07-15 16:19:34.708209452 +0100
@@ -1 +1 @@
-From fea7422f7a4ec2b4c406865629b5ebea699f6588 Mon Sep 17 00:00:00 2001
+From bd6f2422df5e1232fff9ffacfcadf89b35ce6380 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit fea7422f7a4ec2b4c406865629b5ebea699f6588 ]
+
@@ -10 +11,0 @@
-Cc: stable@dpdk.org
@@ -19 +20 @@
-index c54c67f7ee..f3eb797d0c 100644
+index 54a6f6a887..8490b08318 100644
@@ -22 +23 @@
-@@ -1813,6 +1813,7 @@ ngbe_tx_queue_release(struct ngbe_tx_queue *txq)
+@@ -1791,6 +1791,7 @@ ngbe_tx_queue_release(struct ngbe_tx_queue *txq)
@@ -30 +31 @@
-@@ -2030,6 +2031,7 @@ ngbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
+@@ -1995,6 +1996,7 @@ ngbe_dev_tx_queue_setup(struct rte_eth_dev *dev,
@@ -38 +39 @@
-@@ -2138,6 +2140,7 @@ ngbe_rx_queue_release(struct ngbe_rx_queue *rxq)
+@@ -2097,6 +2099,7 @@ ngbe_rx_queue_release(struct ngbe_rx_queue *rxq)
@@ -46 +47 @@
-@@ -2228,6 +2231,7 @@ ngbe_reset_rx_queue(struct ngbe_adapter *adapter, struct ngbe_rx_queue *rxq)
+@@ -2187,6 +2190,7 @@ ngbe_reset_rx_queue(struct ngbe_adapter *adapter, struct ngbe_rx_queue *rxq)
@@ -53,2 +54,2 @@
- 
-@@ -2323,6 +2327,7 @@ ngbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
+ }
+@@ -2277,6 +2281,7 @@ ngbe_dev_rx_queue_setup(struct rte_eth_dev *dev,
@@ -63 +64 @@
-index 41580ba0b9..7574db32d8 100644
+index 9130f9d0df..2914b9a756 100644
@@ -66 +67 @@
-@@ -291,6 +291,7 @@ struct ngbe_rx_queue {
+@@ -276,6 +276,7 @@ struct ngbe_rx_queue {
@@ -74 +75 @@
-@@ -373,6 +374,7 @@ struct ngbe_tx_queue {
+@@ -353,6 +354,7 @@ struct ngbe_tx_queue {