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 653E742CBC for ; Thu, 15 Jun 2023 03:34:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 60B0542D44; Thu, 15 Jun 2023 03:34:43 +0200 (CEST) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mails.dpdk.org (Postfix) with ESMTP id 0E94E40E0F for ; Thu, 15 Jun 2023 03:34:42 +0200 (CEST) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-3f8d5262dc8so1843745e9.0 for ; Wed, 14 Jun 2023 18:34:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686792882; x=1689384882; 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=IayKy3gCLLUAfjgF6htE0IFvnGHI1wo45kxV9yl/EhI=; b=Nisqp75OBk56+cYeeB4emfBq0r6qqFPGA14/zQSIK8wXMJ5qTHXDFyZTFU5/3DnL8Q lHf6jQIeSlW1pjXYRvR6wBgolIsXibZQdM4KMtcCY+0Hc/46IlkmNWrueTqvpTZUWcl2 H6qeBI8SKd1goMRUqWPKA5fxRQelqw/reoSqWdRvpzLAFxWzSsyzejwdQDP8I4ns5VnV G1HBw+MAR84ecW149ON7hMMmwtj26PQq6WOij8yi2z51TXll7tTs4t+nh/aapOnlOwwk WdcSjzQJJRlF1a+Wq8hH1Xg/sYtp4iD3NlybOTdVvnTT9bpKX7C9GKnvkAXEqkpPFvYC Yk9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686792882; x=1689384882; 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=IayKy3gCLLUAfjgF6htE0IFvnGHI1wo45kxV9yl/EhI=; b=G+bISzBVoi8212SdaLZiTesm0U9LQxeahYnWLpxa0sANmaB378XPzhOTiALJojdOQb OH5nU2sKke6p/Ek8lSjhJ1fmgF5X5Pm15AmazXpuv2NVOztON8cE2U7WcQwBk1ZCtxoi rqTuxtWEms6ozdgFtIyO64J8+G0fEy5PnuCk7wCIgYQJbbZF1wT87dGB0f241kjHbHd+ g76Of9ii0vV5MdiKKKeGfbnjLbzpFTPYTEefxdY9yBi6umgtKevdYLkKQQed0jiA5maR rMt8s/aF3BXcgKw88fhrff0pbr1wgYzVIOYLwfqzijV1j7Q8/3vaYvxKYKs7ql/Jzj/g NdyQ== X-Gm-Message-State: AC+VfDwBLIcbF7Ue5+OApsKXqEELQjsbYxqcavVtQrQNi15xlGxOGr06 /CKY76dS+QPLVLGTMGciXgBL8/rZk7gZFCJq X-Google-Smtp-Source: ACHHUZ6xGm84/mIjux4pvqjWYKOW10eT1O/s0lQipvJ5xnUDbC3ilw4C8fKFaPeZZwjovceMXUmHHA== X-Received: by 2002:a1c:720c:0:b0:3f1:731e:cdb1 with SMTP id n12-20020a1c720c000000b003f1731ecdb1mr2852893wmc.6.1686792881718; Wed, 14 Jun 2023 18:34:41 -0700 (PDT) Received: from localhost ([2a01:4b00:d307:1000:f1d3:eb5e:11f4:a7d9]) by smtp.gmail.com with ESMTPSA id f26-20020a1c6a1a000000b003f7ea771b5dsm19087405wmc.1.2023.06.14.18.34.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jun 2023 18:34:41 -0700 (PDT) From: luca.boccassi@gmail.com To: Chengwen Feng Cc: Dongdong Liu , dpdk stable Subject: patch 'net/hns3: fix mbuf leakage when RxQ started after reset' has been queued to stable release 20.11.9 Date: Thu, 15 Jun 2023 02:32:28 +0100 Message-Id: <20230615013258.1439718-33-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230615013258.1439718-1-luca.boccassi@gmail.com> References: <20230615013258.1439718-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Hi, FYI, your patch has been queued to stable release 20.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/17/23. 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/755159ae805c7d106b72f8a2157e338581454377 Thanks. Luca Boccassi --- >From 755159ae805c7d106b72f8a2157e338581454377 Mon Sep 17 00:00:00 2001 From: Chengwen Feng Date: Fri, 2 Jun 2023 19:42:00 +0800 Subject: [PATCH] net/hns3: fix mbuf leakage when RxQ started after reset [ upstream commit f81a18f491522c56ca7ee6ea78be10c784f2ae32 ] In the reset restore-conf phase, the reset process will allocate for the Rx ring mbufs unconditionlly. And the rte_eth_dev_rx_queue_start() will also allocate for the Rx ring mbufs unconditionlly. So if the rte_eth_dev_rx_queue_start() is invoked after restore-conf phase, then the mbufs allocated in restore-conf phase will leak. So fix it by conditional release Rx ring mbufs in rte_eth_dev_rx_queue_start(): if the Rx ring mbufs were allocated then release them first. This patch also set all sw-ring[]'s mbuf is NULL when release Rx ring mbufs so that we can determine whether the Rx ring mbufs were allocated based only on the first sw-ring[0]'s mbuf. Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") Signed-off-by: Chengwen Feng Signed-off-by: Dongdong Liu --- drivers/net/hns3/hns3_rxtx.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c index 86fac45d5f..bf07a5071a 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -54,6 +54,8 @@ hns3_rx_queue_release_mbufs(struct hns3_rx_queue *rxq) rxq->sw_ring[i].mbuf = NULL; } } + for (i = 0; i < rxq->rx_rearm_nb; i++) + rxq->sw_ring[rxq->rx_rearm_start + i].mbuf = NULL; } for (i = 0; i < rxq->bulk_mbuf_num; i++) @@ -4012,6 +4014,9 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) return ret; } + if (rxq->sw_ring[0].mbuf != NULL) + hns3_rx_queue_release_mbufs(rxq); + ret = hns3_init_rxq(hns, rx_queue_id); if (ret) { hns3_err(hw, "fail to init Rx queue %u, ret = %d.", -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-15 01:56:36.451052121 +0100 +++ 0033-net-hns3-fix-mbuf-leakage-when-RxQ-started-after-res.patch 2023-06-15 01:56:34.611542265 +0100 @@ -1 +1 @@ -From f81a18f491522c56ca7ee6ea78be10c784f2ae32 Mon Sep 17 00:00:00 2001 +From 755159ae805c7d106b72f8a2157e338581454377 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit f81a18f491522c56ca7ee6ea78be10c784f2ae32 ] + @@ -24 +25,0 @@ -Cc: stable@dpdk.org @@ -33 +34 @@ -index 2bfc5507e3..2493748683 100644 +index 86fac45d5f..bf07a5071a 100644 @@ -36 +37 @@ -@@ -50,6 +50,8 @@ hns3_rx_queue_release_mbufs(struct hns3_rx_queue *rxq) +@@ -54,6 +54,8 @@ hns3_rx_queue_release_mbufs(struct hns3_rx_queue *rxq) @@ -45 +46 @@ -@@ -4538,6 +4540,9 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) +@@ -4012,6 +4014,9 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)