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 03EF341D8D for ; Mon, 27 Feb 2023 08:15:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EFBA4410DC; Mon, 27 Feb 2023 08:15:51 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2074.outbound.protection.outlook.com [40.107.243.74]) by mails.dpdk.org (Postfix) with ESMTP id 7A64B40ED6 for ; Mon, 27 Feb 2023 08:15:50 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c9rzGjOoEASVQZe7k9IrGKmziJ75CPZyNUtU/N46/xSLTYsHqSpQ7QhiGgc8ib5cnCxRRiTc9xnm6fZUpwDu+kYEJfG3ud4szTxHY/Y35Ki5JrAiwXzevTkXXLxQ7AmR40zKiP94uPSbSv7nkvAZHjkZlLGvPswg8Lrq8tIfSpsJ/UR4Weyl5cqJJT4MAuR2pm9G6fMzNIrlLcMQk+blw7yfSYjZX6PO3v/SMMA0c7cxAERZZXyDbxdE/euQPB/clMNYCShWFj1GhsU6Fs/Hqb72mEKS8+PHEfUwuIyvtBNYkzvyIPJ19ZPB90gchxYMvTp6jDzDi059fqHnWXHh2A== 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=ijNqY+TTzZk978qUGhCVaDrjpMxPmeA5DcKGxGnT1Js=; b=F3+Tn0wbZghqqM2R5FutoDysuGVxrgBJ1zUJBZspw/C5a11Y329Lg9un4MEC7zlmVm3cC2x6k1MfDgDXliwk8CQ4wNMfuvmBLdRxFITcdtpXH42yKGCXVMZCMOID+lpLQQ4nxvPLhz1DPutEi60x+JgtKMhOx+m2M+jt5BxpNXApADbN16eTbJt5G6VcqNqatJWn5vCiLy1AEeI5HKYY0EL1COnV4NWASz23i4xnyU4FJ29+d+VHNZPew8GPjvBhKy5OVTZR2a58TqyDnQKPsQGF8AmHC6jW0K35zCgOQ+AWDt9zi+BTJ6wVhGGwyj6gqstKoMBG25qzljWSqlM/dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=intel.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=ijNqY+TTzZk978qUGhCVaDrjpMxPmeA5DcKGxGnT1Js=; b=JmHHF1xWPX/JZkQ6cIarUX532iTpj28aO07wR+DV0Ns/lUkktlPrQKlIe/q8/+tbDoNP10q0XqpzvpAyhcZ8iogh9jWroRjvhb727VNXsEl+MMHSIob5hFohJkHXNQc3aIRLrxgXKcFrfpXUwW3IyNQ4yFuzLSKJGW2fHgYM9//BTgUqIATBz3bxuasHP0eevUwYlTNLPaZvAYDOUNGNavJZvRf6CFLfhAeamxX1HEAzHrr3WgIASP3GDnVwVQVDxn61lrdlqSpBlCD6yPfy8Q9vT+EClCCoW003Kd+ahVCBhoZyGquonexTGyeZEeglrFJqTKMYtnNxkL4NugP25g== Received: from MN2PR19CA0014.namprd19.prod.outlook.com (2603:10b6:208:178::27) by DM4PR12MB5134.namprd12.prod.outlook.com (2603:10b6:5:391::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.26; Mon, 27 Feb 2023 07:15:48 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:178:cafe::9b) by MN2PR19CA0014.outlook.office365.com (2603:10b6:208:178::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6111.20 via Frontend Transport; Mon, 27 Feb 2023 07:15:48 +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 BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.12 via Frontend Transport; Mon, 27 Feb 2023 07:15:48 +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.36; Sun, 26 Feb 2023 23:15:29 -0800 Received: from nvidia.com (10.126.230.37) 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; Sun, 26 Feb 2023 23:15:26 -0800 From: Xueming Li To: Jingjing Wu CC: Beilei Xing , Qi Zhang , "dpdk stable" Subject: patch 'net/idpf: fix mbuf leak in split Tx' has been queued to stable release 22.11.2 Date: Mon, 27 Feb 2023 15:00:40 +0800 Message-ID: <20230227070107.15664-132-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227070107.15664-1-xuemingl@nvidia.com> References: <20230227062349.13764-1-xuemingl@nvidia.com> <20230227070107.15664-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.37] 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: BL02EPF00010206:EE_|DM4PR12MB5134:EE_ X-MS-Office365-Filtering-Correlation-Id: ef6efd91-5440-4965-b875-08db1892736a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: F1IvKwz+cEGOVaHoyDdO+AqHSckpuYoAcHVpjSqE9fUuGtUcFcesXNRuG2QX44VduGrDHXcAANCdYZVhFqn9iwP6KavV/yMV2pA09l18eoLvDhtjw29sGa3xBB1QGNTUvl+kqsa/8EqiUsIntC98IaeLzDv0wYAXyYBf5KTWdkFtaSrPs4uFa9lkf/m9AoqJVZFyltarc4yq5SW9Gfh6hEsfMap+Yl9JxfTRMi+XqHV7NWgPZqf57wMwRw65oFxTNS+1zvkPTIwQBRREJ0Z2TSpnIVOF57gwQHlcbKlkAzebw5igCoT4cGPqd8QLbB06NpQtyWM5gPveI+Aj1JcXKwiIaDjjdKwXcL4Hn0zP1UcQPXVaC7Bp8QnGykHCqbNowpqDv+OtfVP9tWh90aqHtTNWZgoPABrLIOKJH1XqCCubCf22/yh84LLjhqM3K8Ip2kfFugSqNwDEXJGMT2IKWp5o1SvM1OgWxKXvioL3+52mw3k32ar/aEExOI16aujyQ9aJhLXBkjs1VNzd2cXeVcijLk0AK/ENsBR62Hn5r4gNjl7RUWEE4MRz+4KMS0G8L4MrdAcBP8cU3U45TJGECokK+VEVACL3qohfL/QqS5FMlqGG46LzcJPcpTIwhddh7uJ6ndFFNW6gCn6gZx6AniO+uOh88dR6uEnzJkX22RqfTcG3PvQuT6i2+vi7pkGdS0bzpaSahni9ZOdzYYA6pxegXZ/44HLksttazSAjLf5A2MneFbV+jX72TvpLe67W+Cbh0Oag4IEu5dZfpe4DorpYNUkx6Sn1CzY8tEzS1og= 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:(13230025)(4636009)(346002)(396003)(376002)(136003)(39860400002)(451199018)(36840700001)(46966006)(40470700004)(316002)(82740400003)(2906002)(478600001)(83380400001)(36756003)(5660300002)(40460700003)(8936002)(55016003)(4326008)(70206006)(6916009)(70586007)(40480700001)(356005)(8676002)(7636003)(54906003)(36860700001)(41300700001)(82310400005)(336012)(6666004)(86362001)(426003)(47076005)(53546011)(186003)(2616005)(16526019)(6286002)(1076003)(26005)(7696005)(966005); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:15:48.1379 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ef6efd91-5440-4965-b875-08db1892736a 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: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5134 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.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/01/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=96ccb4c28795fde0b0d1d4db727bb04df9e09acd Thanks. Xueming Li --- >From 96ccb4c28795fde0b0d1d4db727bb04df9e09acd Mon Sep 17 00:00:00 2001 From: Jingjing Wu Date: Fri, 6 Jan 2023 09:04:59 +0000 Subject: [PATCH] net/idpf: fix mbuf leak in split Tx Cc: Xueming Li [ upstream commit 9e199987a3143a7d705f2c06213e0cf4b9380653 ] When context descriptor is used during sending packets, mbuf is not freed correctly, it will cause mempool be exhausted. This patch refines the free function. Fixes: 770f4dfe0f79 ("net/idpf: support basic Tx data path") Signed-off-by: Jingjing Wu Signed-off-by: Beilei Xing Acked-by: Qi Zhang --- drivers/net/idpf/idpf_rxtx.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/idpf/idpf_rxtx.c b/drivers/net/idpf/idpf_rxtx.c index b4a396c3f5..5aef8ba2b6 100644 --- a/drivers/net/idpf/idpf_rxtx.c +++ b/drivers/net/idpf/idpf_rxtx.c @@ -1508,6 +1508,7 @@ idpf_split_tx_free(struct idpf_tx_queue *cq) struct idpf_tx_entry *txe; struct idpf_tx_queue *txq; uint16_t gen, qid, q_head; + uint16_t nb_desc_clean; uint8_t ctype; txd = &compl_ring[next]; @@ -1525,20 +1526,24 @@ idpf_split_tx_free(struct idpf_tx_queue *cq) switch (ctype) { case IDPF_TXD_COMPLT_RE: - if (q_head == 0) - txq->last_desc_cleaned = txq->nb_tx_desc - 1; - else - txq->last_desc_cleaned = q_head - 1; - if (unlikely((txq->last_desc_cleaned % 32) == 0)) { + /* clean to q_head which indicates be fetched txq desc id + 1. + * TODO: need to refine and remove the if condition. + */ + if (unlikely(q_head % 32)) { PMD_DRV_LOG(ERR, "unexpected desc (head = %u) completion.", q_head); return; } - + if (txq->last_desc_cleaned > q_head) + nb_desc_clean = (txq->nb_tx_desc - txq->last_desc_cleaned) + + q_head; + else + nb_desc_clean = q_head - txq->last_desc_cleaned; + txq->nb_free += nb_desc_clean; + txq->last_desc_cleaned = q_head; break; case IDPF_TXD_COMPLT_RS: - txq->nb_free++; - txq->nb_used--; + /* q_head indicates sw_id when ctype is 2 */ txe = &txq->sw_ring[q_head]; if (txe->mbuf != NULL) { rte_pktmbuf_free_seg(txe->mbuf); @@ -1693,12 +1698,16 @@ idpf_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, /* fill the last descriptor with End of Packet (EOP) bit */ txd->qw1.cmd_dtype |= IDPF_TXD_FLEX_FLOW_CMD_EOP; - if (unlikely((tx_id % 32) == 0)) - txd->qw1.cmd_dtype |= IDPF_TXD_FLEX_FLOW_CMD_RE; if (ol_flags & IDPF_TX_CKSUM_OFFLOAD_MASK) txd->qw1.cmd_dtype |= IDPF_TXD_FLEX_FLOW_CMD_CS_EN; txq->nb_free = (uint16_t)(txq->nb_free - nb_used); txq->nb_used = (uint16_t)(txq->nb_used + nb_used); + + if (txq->nb_used >= 32) { + txd->qw1.cmd_dtype |= IDPF_TXD_FLEX_FLOW_CMD_RE; + /* Update txq RE bit counters */ + txq->nb_used = 0; + } } /* update the tail pointer if any packets were processed */ -- 2.25.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2023-02-27 14:08:45.132215400 +0800 +++ 0133-net-idpf-fix-mbuf-leak-in-split-Tx.patch 2023-02-27 14:08:40.919237000 +0800 @@ -1 +1 @@ -From 9e199987a3143a7d705f2c06213e0cf4b9380653 Mon Sep 17 00:00:00 2001 +From 96ccb4c28795fde0b0d1d4db727bb04df9e09acd Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 9e199987a3143a7d705f2c06213e0cf4b9380653 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org