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 5224445E3E for ; Fri, 6 Dec 2024 01:59:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 415974068A; Fri, 6 Dec 2024 01:59:02 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2077.outbound.protection.outlook.com [40.107.93.77]) by mails.dpdk.org (Postfix) with ESMTP id 0A571402A8; Fri, 6 Dec 2024 01:58:59 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=w4FtTDPADsrX/Qs9kcNRPJ7V1LspZ93ZyeRukqOz6zOrfptlRTwqMnCTW+EB34QI7qmRNzwb1rh2VMl0rKiS5lXNsPJ1YeyG2hUz4lr23qmAeDGIzdi3tgWJJ+a8Yt4DUU9q3jpt5/r43lwyRCC8xKWBxlz66/O/px8YJ9tl5Q/fHErnMgfoShsW1+I93SkDbtyT0IOCVgCEYf1Xw9Gc3aQSBqhSURt6IPAdi0aVR4NyJB6VhMNoJvEfQ72AJvKxBmi+yeH03VgRZmapOl9Ilu/dWutAt+e3PD7TCMpkVBJTD3Q5tjNHI2qfmxeZF5nYpSZg/NeG95ySn8VGiVmL1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=VSEGEfq7Mm2HSF2bspSKfpii/ZlnaV0FOJSTwe1Sw9Y=; b=ti5q3MBBtjdhkb4vROQwOBMMLMYUyqGIDOxIBEYCFyk2ooHxsLS3lOM0Uu4Jwt6qdaeKjMKzThgNLSSlrjvLbdlln3X3PcHUzHucnaSPF6xTWf8VJODp7V+Ase1B/JhDEB6JtFD+2VQshdfpjyD9XQjHHzkpU+y3bhjrJNtAjFE3sWBd8U9L6LyRnmVuzy3t2y1uu7mDrDqRLaEDEUtiNBl0Gk+KrUpTTIN0KLzj1Iej+3f2imn9cmY8lIwZWkK/hjbMtYalEReIBBr0BqxlTbkMSs4847m2lyvZfe+HjSfSztOHtLW23XIeB4sCB6oMV7T0iB4jU19SNWv2VBbLPQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=dpdk.org 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 (0) 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=VSEGEfq7Mm2HSF2bspSKfpii/ZlnaV0FOJSTwe1Sw9Y=; b=JK+gzHrOLedYcD1bbL6S0nSpldwRtEU1n62HUhofbnjLqBeIKI9ORyy8hcVHlTyuRm+X5/e6lfl99sDF4zmoCI6gi28O8YHIcIEy//9PjhZ9eoK05u7MPHA4VnQpQu6BU1qwQGtldLft5rOPF2CANNVwIPObbRL+mhjKOR5mwAkSyrokqHf6oe/70HjRwwDSELRLonzZTN7tLrdLjkQjfmrujaEh42DRlCeA5/lH/6J6D0kRh2SsoItpvDn7cQqxSrgEMHBN9liXOW8XO4Rb3yrqXUuf29cJMsbh4xafQHP6nX1XGOtqsJMue0cKJxRyiqhqv5BZ2YRjfwlDj2qCOg== Received: from BLAPR03CA0164.namprd03.prod.outlook.com (2603:10b6:208:32f::20) by CYYPR12MB8990.namprd12.prod.outlook.com (2603:10b6:930:ba::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.18; Fri, 6 Dec 2024 00:58:52 +0000 Received: from BN1PEPF0000468C.namprd05.prod.outlook.com (2603:10b6:208:32f:cafe::3) by BLAPR03CA0164.outlook.office365.com (2603:10b6:208:32f::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8230.10 via Frontend Transport; Fri, 6 Dec 2024 00:58:52 +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 BN1PEPF0000468C.mail.protection.outlook.com (10.167.243.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.7 via Frontend Transport; Fri, 6 Dec 2024 00:58:52 +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.1544.4; Thu, 5 Dec 2024 16:58:35 -0800 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.1544.4; Thu, 5 Dec 2024 16:58:32 -0800 From: Gavin Hu To: CC: , Dariusz Sosnowski , "Viacheslav Ovsiienko" , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad , Alexander Kozyrev Subject: [PATCH] net/mlx5: do not poll CQEs when no available elts Date: Fri, 6 Dec 2024 02:58:11 +0200 Message-ID: <20241206005811.948293-1-gahu@nvidia.com> X-Mailer: git-send-email 2.18.2 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF0000468C:EE_|CYYPR12MB8990:EE_ X-MS-Office365-Filtering-Correlation-Id: 80c4c0d6-c651-46fd-f866-08dd159126fa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3UUMbNdUvxNO5Q94Iaq0WF2Fun1u51jCbooxpFM4+UIXG2jH4Q4FEpxb6qLn?= =?us-ascii?Q?26d0cb86/IWRHNCK5luPWX/f+rSRTbnETEAx6I1UgAEsT48wKEdm8lAtRV1B?= =?us-ascii?Q?duG7uGUDk6U9ohMWCloaWz3bLNeZGuD7ujJ02nmuJcXRUkaAWhyYUndEps4g?= =?us-ascii?Q?RNUuBwJoDANi1V7iuWsE3gGwCFdh5RdL0WUlP9rAGVo/04F0IGhmsroKFo8T?= =?us-ascii?Q?+nRaUO5VKZk9KR+7GVgzlHoja7ARcYB7nyMn/Ry0dANZ0bDzsSyeJjCR8hoa?= =?us-ascii?Q?y7TU0JihIvEXYl/0b5F01sWQhQMmoih02lpGofwLX5aexTam/z/s9WPeocA0?= =?us-ascii?Q?asO8JYUsn0zRMiShPKhvlsugHRX2sstYIBaqHhqk63oELHnRe9u4sQe8uSJr?= =?us-ascii?Q?aeZlLi6Mpy4IeBzP2uw1+7oPFHIWlIGK6Kww2GDsNj1scDL197YOnkS9oh7X?= =?us-ascii?Q?WjvJFifZsFHYDvebHchXFIJ/ebz2g1h8+hjxyHHRGY6RY/f+dS72N11oYkmv?= =?us-ascii?Q?8wJNTz+/c2OGwCI0nXvrfz8nepiALe6QCoEeHFK/p2SR7bsyKglqGhf3+pSQ?= =?us-ascii?Q?HxDa9QQiGuYg2rINKmg0EEi8rYCmeF6CahMxg30/gT4zdNgvHyRUtYuzAGpX?= =?us-ascii?Q?m4oMOB2elA5NnSXUGjghoLHeDsqxN002nx4Ka7ga5niYNHwI3s/cUK7I7V3L?= =?us-ascii?Q?QQp3NHR+C3YV2bDTmQ9BfyHVZs9rcjf+SVrF2B6zWU2cOi1xA0w9EFuMTsg8?= =?us-ascii?Q?SAXl0kBpviyc1K6NFW0OGxWt5AHMDTGWJ3K13DQu1laxI8hAIw7UsFdqIG8j?= =?us-ascii?Q?FJgO1HNA4ZHtiO+VGxpy9h7UD0K1/RG162SweIzKs4pDE7Ax7cDTApXY1Xu/?= =?us-ascii?Q?vgYLFiRWArh2/eDqjYLeXlOSFPEHllMtdG2TBpIgPLsg9QPSDLLJaKwmQn/x?= =?us-ascii?Q?YPH3Bbj5EK6CZ/pAkQNTDoX5tXT+0n/d2UwPWiTKbnCxYFD1ng0UDuXmxqzT?= =?us-ascii?Q?tO1KCDMiAG+hwaFkxTORtencvTqOkT0foQn8Qif0k6XTm6L/ntrk1a+8Dkkh?= =?us-ascii?Q?NOXe+IX9EcfRKZL2e0kaeNo9ViSskaDMnCk8gaiHXG6sBY0PAcaNT8dN2VZx?= =?us-ascii?Q?zIwvHdQltI7M1Irny9HAAOvGiMx6IBGgqRFkPo/rZaQmmZEQ8e8Nzw5V2tQ0?= =?us-ascii?Q?nzDr4aNf9EruvjjTeziF3Rizzd8wytwE+eOOqev0gv2vTovfppPeC7IWjHVp?= =?us-ascii?Q?iCGxbrCyI5V2TIl1uMkVYWi3sYFWOABtfBtolGcKWegIgtcafnIz8r01F8uI?= =?us-ascii?Q?4+3xZGApM2DN17c5ZW79jrona4gcXDn823My7K9Txu29gBW51oCSU9RxcvUF?= =?us-ascii?Q?HVZ8npTAynDvyOz4qQIvw5iESIpp/1laV+LTNO8Gf4MxXG1nQfDcWtMz16qB?= =?us-ascii?Q?/piWBkbN5HDKgaOoOMEptDcithvzlRn8?= 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:(13230040)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Dec 2024 00:58:52.2714 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80c4c0d6-c651-46fd-f866-08dd159126fa 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: BN1PEPF0000468C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8990 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 In certain situations, the receive queue (rxq) fails to replenish its internal ring with memory buffers (mbufs) from the pool. This can happen when the pool has a limited number of mbufs allocated, and the user application holds incoming packets for an extended period, resulting in a delayed release of mbufs. Consequently, the pool becomes depleted, preventing the rxq from replenishing from it. There was a bug in the behavior of the vectorized rxq_cq_process_v routine, which handled completion queue entries (CQEs) in batches of four. This routine consistently accessed four mbufs from the internal queue ring, regardless of whether they had been replenished. As a result, it could access mbufs that no longer belonged to the poll mode driver (PMD). The fix involves checking if there are four replenished mbufs available before allowing rxq_cq_process_v to handle the batch. Once replenishment succeeds during the polling process, the routine will resume its operation. Fixes: 1ded26239aa0 ("net/mlx5: refactor vectorized Rx") Cc: stable@dpdk.org Reported-by: Changqi Dingluo Signed-off-by: Gavin Hu --- drivers/net/mlx5/mlx5_rxtx_vec.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/mlx5/mlx5_rxtx_vec.c b/drivers/net/mlx5/mlx5_rxtx_vec.c index 1872bf310c..1b701801c5 100644 --- a/drivers/net/mlx5/mlx5_rxtx_vec.c +++ b/drivers/net/mlx5/mlx5_rxtx_vec.c @@ -325,6 +325,9 @@ rxq_burst_v(struct mlx5_rxq_data *rxq, struct rte_mbuf **pkts, /* Not to cross queue end. */ pkts_n = RTE_MIN(pkts_n, q_n - elts_idx); pkts_n = RTE_MIN(pkts_n, q_n - cq_idx); + /* Not to move past the allocated mbufs. */ + pkts_n = RTE_MIN(pkts_n, RTE_ALIGN_FLOOR(rxq->rq_ci - rxq->rq_pi, + MLX5_VPMD_DESCS_PER_LOOP)); if (!pkts_n) { *no_cq = !rcvd_pkt; return rcvd_pkt; -- 2.18.2