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 65D1C42D46 for ; Sun, 25 Jun 2023 08:40:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6111142D16; Sun, 25 Jun 2023 08:40:53 +0200 (CEST) Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2040.outbound.protection.outlook.com [40.107.100.40]) by mails.dpdk.org (Postfix) with ESMTP id 9ACD340ED8 for ; Sun, 25 Jun 2023 08:40:49 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EjeMrVZnBRIAwh4/Tol18qSDO+SwN4bdDwyyXzr91YytJIGrpFiuBvcqahsoua9y3KDtq7+rUEqoOSD/p3wCmtkhEoEvFMh5l61DAt57kpH+Vc6xkBGsbZubsLCPBq9VhPTjxkl7jq84wENQaKlUxNgLnq+JMDMdnfrWMVe27RzHhRWFZ6rX50KGMzgnBvwsuf9pFmT60YwarBeGxCABQFanVIBQlD4GUPntFo4kkzS1GL5MTWtw45ORGvyGUtAl/78tQR/PN/yAB/n5bqdlyc9FIKeJMiXL5zMMC0o0miE3VdZf+bNFkXFKG5e28R0PRDr69I5sSMMTKM72yj0Cbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kPrvGNyxXNdhlaPuoxo7/P0pActg6S0dOCb9VE6kZtM=; b=CmfhqqMOV+1lO53loZxqYPpFFVupoXdGyse3jjyINq0KoJc8PryGcnxVsTqe9rz5fza3UVGVYe4wczLoTBMcQggsoTjAskJm+V9u52xkOk3N7dEK2jn8nazT9lojUjkGpKO43Tdxb8NSuSJz6nRVMee6dqtefzZOiHygcJeo6dmuwOTOtXL89mWPB5eMiKzMXJAYNTCHR0mnSDl6cykDPSsafkwj/hAy3NH4/0xslcfB8R5T97snunspH4BptQXoCavzwGpxEYSmK2gGoAHNAgmUYQ6937fXEjWzEW64TLUKVbl3wUKZcysM1BmNxB/fa/FUJ22b6kRtNgEl9yUmwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=huawei.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kPrvGNyxXNdhlaPuoxo7/P0pActg6S0dOCb9VE6kZtM=; b=SmZhGxzin0dkcr74xwSTdpvO1GMVTa/k949A6bdr6JpvJdeqE4oqKt0exOj6nVnc6/WoyWXzKZ8sP3MUoP0hTcEUjNdt8EGlflZAcfl6EB5CPsoiKB6rgkkpLH6ebe1PyovRUGetd5bMlENqGG8tZLqm2zFIb0UcmA6lFYIHs/19NPsINL+KCOFPs6NzZmt60xEQKQ98Y0smVUI9I5Jr/CRyHQ4C1gf3O7B5lLVAekFZw3GS2xDaKZ/QJyU5bUHIVU/DL0epKrariHhNnP63gYFsdPOmRw4x3jpQ03Y779/DMpQoM5jtIoRzZhdBcu3ysiaYs3wXPuvHSIU5Q0O00A== Received: from BYAPR11CA0099.namprd11.prod.outlook.com (2603:10b6:a03:f4::40) by PH7PR12MB7307.namprd12.prod.outlook.com (2603:10b6:510:20b::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.26; Sun, 25 Jun 2023 06:40:45 +0000 Received: from DM6NAM11FT080.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:f4:cafe::51) by BYAPR11CA0099.outlook.office365.com (2603:10b6:a03:f4::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.33 via Frontend Transport; Sun, 25 Jun 2023 06:40:45 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by DM6NAM11FT080.mail.protection.outlook.com (10.13.173.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6500.47 via Frontend Transport; Sun, 25 Jun 2023 06:40:44 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Sat, 24 Jun 2023 23:40:29 -0700 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Sat, 24 Jun 2023 23:40:28 -0700 From: Xueming Li 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 22.11.3 Date: Sun, 25 Jun 2023 14:34:31 +0800 Message-ID: <20230625063544.11183-54-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230625063544.11183-1-xuemingl@nvidia.com> References: <20230625063544.11183-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail202.nvidia.com (10.129.68.7) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT080:EE_|PH7PR12MB7307:EE_ X-MS-Office365-Filtering-Correlation-Id: 89830a47-3224-4bce-f91c-08db75471a34 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YYTdqZITNF0+DWZZb/NoGMejdpaVfFG7cAqy+QjktUdI46wE6sdRj6mebTw5b5Wr5uT0fFbGypxQImhpiqYF2YxzHFXRldyAg6ArWUBGY8if6YDXegmh82r5rO6z29tgBe+HZxgqU2lGt1qs29lHzjS5Io5NN3NJ3E+1qNwRySXISCiqPw2l3vMQtCrQL8VGFhCUBsk8Vceo5iDAN48alKbW+sW2RvuG8cs3Kxq8ydwQXG2JnjoWFLouSdcBOp2Cj2ix1IfCcFthQ95+aBbEcN4iLA1fT5T45lORlWoVf8xGssfjJnYmxM/5zOlvmie9n+3coqkBgclWDJtH7w26hO2Q/0Vd4EpgRVnx4MzpNx1Ub84EutQB5tg+IRyt1elTVFXijrjILH3UFAjvixubpXvV71bhDWMvydAbrzp5+0EGbScdCZA68z7va2ctkBXAO6gjyOP2Tcabm/Dpvb0CdyWzgmO2GLNeHfXs0DVOfZQFqTF28zxHRWPllbh0NGhzvegq7bhngOfM6+O50fEgAkXBjOAqn9UxlmXGTSywtm2orecPEkB8AsocXac53/dJsqrDZXkayHqViSyz2PtItvCpE29CUC6l/B281Ucsab3MBYEC7nKobeb6rpvtBYU6tafQS2TylQbGVQ2DQ6FL1PMy9TNVt1o2/JSkJ/u9kCeUJ8f+JpLhyFcGnChRN4muS4Ivb9TfakKliboOwwwcwQGnI72ZyRzYItlgbixE5m93GNT0gIwmglh5UaPY1MoMzKpAGmQ/vbG4loScl1GVvQ== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(376002)(136003)(346002)(39860400002)(396003)(451199021)(46966006)(40470700004)(36840700001)(82310400005)(36860700001)(966005)(47076005)(478600001)(7696005)(6666004)(54906003)(2616005)(83380400001)(336012)(426003)(26005)(53546011)(186003)(1076003)(6286002)(16526019)(2906002)(5660300002)(40460700003)(36756003)(356005)(70206006)(4326008)(70586007)(82740400003)(7636003)(55016003)(316002)(40480700001)(8936002)(8676002)(41300700001)(86362001)(6916009); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2023 06:40:44.4301 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 89830a47-3224-4bce-f91c-08db75471a34 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT080.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7307 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 22.11.3 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/27/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://git.dpdk.org/dpdk-stable/log/?h=22.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=22.11-staging&id=19c20cef2781390fb32873c08606ab942c0dc766 Thanks. Xueming Li --- >From 19c20cef2781390fb32873c08606ab942c0dc766 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 Cc: Xueming Li [ 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 10ac4926a8..20babdc54c 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c @@ -50,6 +50,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++) @@ -4484,6 +4486,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.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-06-25 14:31:59.939813900 +0800 +++ 0053-net-hns3-fix-mbuf-leakage-when-RxQ-started-after-res.patch 2023-06-25 14:31:58.385773900 +0800 @@ -1 +1 @@ -From f81a18f491522c56ca7ee6ea78be10c784f2ae32 Mon Sep 17 00:00:00 2001 +From 19c20cef2781390fb32873c08606ab942c0dc766 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit f81a18f491522c56ca7ee6ea78be10c784f2ae32 ] @@ -24 +26,0 @@ -Cc: stable@dpdk.org @@ -33 +35 @@ -index 2bfc5507e3..2493748683 100644 +index 10ac4926a8..20babdc54c 100644 @@ -45 +47 @@ -@@ -4538,6 +4540,9 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) +@@ -4484,6 +4486,9 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)