From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7556F45489 for ; Tue, 18 Jun 2024 09:13:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5B41427E9; Tue, 18 Jun 2024 09:13:13 +0200 (CEST) Received: from smtpbgbr1.qq.com (smtpbgbr1.qq.com [54.207.19.206]) by mails.dpdk.org (Postfix) with ESMTP id D5A9240E11; Tue, 18 Jun 2024 09:12:30 +0200 (CEST) X-QQ-mid: bizesmtpsz1t1718694746tiyaf01 X-QQ-Originating-IP: 1M2mU2BdYrY1KTRXKbig+Wo5CBx0DZPyIPfViVxa6wQ= Received: from lap-jiawenwu.trustnetic.com ( [183.159.97.141]) by bizesmtp.qq.com (ESMTP) with id ; Tue, 18 Jun 2024 15:12:25 +0800 (CST) X-QQ-SSF: 0000000000000000000000000000000 X-QQ-GoodBg: 0 X-BIZMAIL-ID: 15075437092877475305 From: Jiawen Wu To: dev@dpdk.org Cc: Jiawen Wu , stable@dpdk.org Subject: [PATCH 15/19] net/ngbe: fix memory leak Date: Tue, 18 Jun 2024 15:11:46 +0800 Message-Id: <20240618071150.21564-16-jiawenwu@trustnetic.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20240618071150.21564-1-jiawenwu@trustnetic.com> References: <20240618071150.21564-1-jiawenwu@trustnetic.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtpsz:trustnetic.com:qybglogicsvrgz:qybglogicsvrgz8a-1 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 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") Cc: stable@dpdk.org Signed-off-by: Jiawen Wu --- drivers/net/ngbe/ngbe_rxtx.c | 8 ++++++++ drivers/net/ngbe/ngbe_rxtx.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c index c54c67f7ee..507bd3d526 100644 --- a/drivers/net/ngbe/ngbe_rxtx.c +++ b/drivers/net/ngbe/ngbe_rxtx.c @@ -1813,6 +1813,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); } @@ -2030,6 +2031,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; @@ -2138,6 +2140,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); } } @@ -2228,6 +2231,10 @@ 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; + + if (rxq->pkt_first_seg != NULL) + rte_pktmbuf_free(rxq->pkt_first_seg); + rxq->pkt_first_seg = NULL; rxq->pkt_last_seg = NULL; @@ -2323,6 +2330,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 41580ba0b9..7574db32d8 100644 --- a/drivers/net/ngbe/ngbe_rxtx.h +++ b/drivers/net/ngbe/ngbe_rxtx.h @@ -291,6 +291,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; }; /** @@ -373,6 +374,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.27.0