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 C395245CE3 for ; Mon, 11 Nov 2024 07:39:40 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B5C6D40E09; Mon, 11 Nov 2024 07:39:40 +0100 (CET) Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2085.outbound.protection.outlook.com [40.107.220.85]) by mails.dpdk.org (Postfix) with ESMTP id 27E614067A for ; Mon, 11 Nov 2024 07:39:39 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V1TXWsTIejIsGIYuit1mfHAjQvjoXG97br1XUt8dNFJXvVm3taK34gwjPdndWWXDPvL/lA7iHD50NawzLOorGfM8FfNmlDbwPotFFV/iVDrE+UPIU+s4xMKO6puTaQ1zn/lChBpEQMKef2GFGq/e4WKcMG9H4Pr925Gh5Cwj6sYsmGDXy7LrdgM+D4RxmDg9WQ7fUpQieMvAbrVsDnGtX3ShMBWpI1PeE5xNbZZQeliMAqruML3uK0zRJJZC913ppyyEkcyuQ0OIjeFY3GoIy5jZVoxH/2DVemjay0+npvAvA0xN1MwVkRtSzeotOeb93xA6l5DtbM+0quYQOpvQ2Q== 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=H6+x4y6TuYOWMLy7MltYYQQT1ztU/xiQ7Ts5xrY/m4E=; b=IVH6r8gbk4wYbL4rwFO16xHjOIV/bat9kzsAadX04BWQg/zA1dKhMce5amIr9tO+BpnW0w1x1PMhOuJG2hkJkahWKexkd8M17285fNkd5jr65+yLfV24nP7ZnT7aOf/+PQd9ZFXTOMONF857C0rJxM3ddQ4ts3CD23A0INb7C+tV/D8359/i5tqBV4gYHo5SMhOsJ4YZeRFZJyVIs9M0qXTDYnt2Ioz9ZEnxP4GnMl3Ltx0bNlFmj5s7IrFPI7tCNa4Tpm2HVC2VvPhOFpAOHSKW5Bz1KjxyLB7wIC1TtM8LR0AbxbrjkhO+7van8KMYbAkuLQ7BsU+G8HePL6j2zQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=networkplumber.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=H6+x4y6TuYOWMLy7MltYYQQT1ztU/xiQ7Ts5xrY/m4E=; b=fbJyYUGgS+3KBZFGL5VGCa3UgMtEiJw0soARhBat33Ph2AC0wKA85vbGsHc/EbuN9SXvXRgbsx4XysyThVXOpuvQUBL5UHZs0PJp0i/dA+yh1UnyY5Eshf6y58JtxCu0FZER58P4pJTJtW7D2Bg85om0E+mGUfKXhuW/jk4YL9gxkQ+dY+MP3b9DENQJtf0sW8AiTCDCAfN0ldd3YZqnvSh4oPqSpAFhZkSICEZnsbKWk/+JpeduCXBNnmJawmdBe0pKZpi9C9T3DyVGlzTXq+PSVEtaRDl9NhVHZiKiYRClEsW+gn/zgROOt7MTnrobD9pNVSc4GDuDyXczhH16/w== Received: from SA1P222CA0045.NAMP222.PROD.OUTLOOK.COM (2603:10b6:806:2d0::22) by IA1PR12MB6308.namprd12.prod.outlook.com (2603:10b6:208:3e4::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Mon, 11 Nov 2024 06:39:36 +0000 Received: from SN1PEPF00026368.namprd02.prod.outlook.com (2603:10b6:806:2d0:cafe::f5) by SA1P222CA0045.outlook.office365.com (2603:10b6:806:2d0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.27 via Frontend Transport; Mon, 11 Nov 2024 06:39:35 +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 SN1PEPF00026368.mail.protection.outlook.com (10.167.241.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.14 via Frontend Transport; Mon, 11 Nov 2024 06:39:35 +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; Sun, 10 Nov 2024 22:39:24 -0800 Received: from nvidia.com (10.126.231.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; Sun, 10 Nov 2024 22:39:22 -0800 From: Xueming Li To: Stephen Hemminger CC: , Ofer Dagan , dpdk stable Subject: patch 'net/pcap: fix blocking Rx' has been queued to stable release 23.11.3 Date: Mon, 11 Nov 2024 14:28:26 +0800 Message-ID: <20241111062847.216344-101-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241111062847.216344-1-xuemingl@nvidia.com> References: <20241111062847.216344-1-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.231.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: SN1PEPF00026368:EE_|IA1PR12MB6308:EE_ X-MS-Office365-Filtering-Correlation-Id: f39905e2-ceed-41a0-98b4-08dd021b9bcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?sM3m574ScRx2KAyWGBzWZoxZQKG345gtniNlfyQEdO/ji1AExjmcerM2opNg?= =?us-ascii?Q?CsgMCfIrmY4lpa4H1op9iSydS+OlLzP8tiQy6aHKbDnSIgmA2w8mODt/2a10?= =?us-ascii?Q?kOrR8tdSsUBtyoD3+/+xaq9TTSwmJmXc3PznHby937qiGOQE44OsPahTJUeu?= =?us-ascii?Q?GqMg8/oYWTHFAcoypVX8w+gKqf83MW4xfop2Yybd9qSyV3RRm75fPJQhYcXI?= =?us-ascii?Q?zhd7uq/+aH8K+AzLJYQz0RHoo1+ZRadyAFflSrIQC6oHEPCGV31HmJ3VIj5N?= =?us-ascii?Q?PN3iEhRt8VlSPleEGGGEM6SIcoIOL9euPJkmydFFiCcxST3Cs0XzJBt11gZp?= =?us-ascii?Q?qY6LmGkNcsCsjcQia3MV/sog9hcZePYTDYAUa+pESaleo68yrzlwofdWX+lj?= =?us-ascii?Q?Bv5TzynGMnyy5pWPq8NMl4g62TWQdEQwzzQ2KajekOR5ahsS4s/tRMgKX76b?= =?us-ascii?Q?Vrp7wJ+7KJ+w7eQ1Ia+bcnSLd0BomjKmV8oJXfNLbVWGJ8wla9t19iInd0FA?= =?us-ascii?Q?MJ802j9v/Q7Np7UrIxZBL7/6lw8hWETOE6DOXxQdrtpLvEqMMqVQ67olzpTC?= =?us-ascii?Q?7dmHy//ed70s4xt3VZRdoP5vhFKuc6fDCxGlodhc4CODRExcRKYDCVdokj1t?= =?us-ascii?Q?pSaFXB5QcNERvTPBxm3f3JFqiFplgRbAsdKK9Ahn5kMPTwnEtkE5h/LYvR+I?= =?us-ascii?Q?kBFHBAxwTCscMmWcvWtj8kDOkbjz3aIo/Uhl+C/P0So8e3AzH+0PcPQolr2k?= =?us-ascii?Q?vfcUOL04tomyA4YB3357gBHpbKcYabAZGLhIh15VE/ykT4gpJeSo+u8ZsC8m?= =?us-ascii?Q?JjvEwDOw+qqWxSJdgZRBqn4fWMoQLyI0AE5lxZUt+47mXEDae5Nz7jAs7s40?= =?us-ascii?Q?46Wzl4n4xnobYUw6oVHMBjM7fQpMCPd1fT3DHiEeHkljJachrkKdhnKXtGnL?= =?us-ascii?Q?ZzJSrHIkQ0FJXTruA2TvAcVHrv3iopQScDooEbvWc4z74PJfeCsmjBHLdAZe?= =?us-ascii?Q?J9ZGAhuAFAPpaXj4ro9bbbKDakMnCn7yr/Al6NfNIFBQasODffXcwFqwa6/I?= =?us-ascii?Q?MC1StVzGVGTSmdlHNqIi4YkkPS/h3aR/K1So0ABLJPklhvQtlkpN8plZ6mde?= =?us-ascii?Q?6+PBffMnfUmbFEW+64iQKpoiBnQUZh5dQX+B0VqN2zHz8CzcvgrOwrMoc5ru?= =?us-ascii?Q?BwQggwNHjUb9YdMnNta/fdOQRow/8I1ynYj+kO53scdVjI+q4vzOJSKkYD84?= =?us-ascii?Q?OHz62KQ3cIYb1w8aNcmDJObSTo34SzIa+E6SNOBBFr2KF5jz/2CJS0YaXF/A?= =?us-ascii?Q?oJF8VeVyG1AOjkaoSZmuGOJVH0EUzUVAdKQfXvVQj878pYWv5c/XHeyde7ig?= =?us-ascii?Q?h2FgY60MF7TMj/oIPND2eDH1Y0YF65aKSbnTNSYE0oiiqXUTkw=3D=3D?= 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)(1800799024)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Nov 2024 06:39:35.6387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f39905e2-ceed-41a0-98b4-08dd021b9bcd 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: SN1PEPF00026368.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6308 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 23.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 11/30/24. 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=23.11-staging This queued commit can be viewed at: https://git.dpdk.org/dpdk-stable/commit/?h=23.11-staging&id=586405a26eab30b8ba04b54197aee639f89410d0 Thanks. Xueming Li --- >From 586405a26eab30b8ba04b54197aee639f89410d0 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Thu, 5 Sep 2024 09:10:40 -0700 Subject: [PATCH] net/pcap: fix blocking Rx Cc: Xueming Li [ upstream commit f5ead8f84f205babb320a1d805fb436ba31a5532 ] Use pcap_next_ex rather than just pcap_next because pcap_next always blocks if there is no packets to receive. Bugzilla ID: 1526 Fixes: 4c173302c307 ("pcap: add new driver") Reported-by: Ofer Dagan Signed-off-by: Stephen Hemminger Tested-by: Ofer Dagan --- .mailmap | 1 + drivers/net/pcap/pcap_ethdev.c | 33 +++++++++++++++++---------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.mailmap b/.mailmap index 8d7fa55d9e..8a0ce733c3 100644 --- a/.mailmap +++ b/.mailmap @@ -1059,6 +1059,7 @@ Noa Ezra Nobuhiro Miki Norbert Ciosek Odi Assli +Ofer Dagan Ognjen Joldzic Ola Liljedahl Oleg Polyakov diff --git a/drivers/net/pcap/pcap_ethdev.c b/drivers/net/pcap/pcap_ethdev.c index 1fb98e3d2b..728ef85d53 100644 --- a/drivers/net/pcap/pcap_ethdev.c +++ b/drivers/net/pcap/pcap_ethdev.c @@ -274,7 +274,7 @@ static uint16_t eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) { unsigned int i; - struct pcap_pkthdr header; + struct pcap_pkthdr *header; struct pmd_process_private *pp; const u_char *packet; struct rte_mbuf *mbuf; @@ -294,9 +294,13 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) */ for (i = 0; i < nb_pkts; i++) { /* Get the next PCAP packet */ - packet = pcap_next(pcap, &header); - if (unlikely(packet == NULL)) + int ret = pcap_next_ex(pcap, &header, &packet); + if (ret != 1) { + if (ret == PCAP_ERROR) + pcap_q->rx_stat.err_pkts++; + break; + } mbuf = rte_pktmbuf_alloc(pcap_q->mb_pool); if (unlikely(mbuf == NULL)) { @@ -304,33 +308,30 @@ eth_pcap_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) break; } - if (header.caplen <= rte_pktmbuf_tailroom(mbuf)) { + uint32_t len = header->caplen; + if (len <= rte_pktmbuf_tailroom(mbuf)) { /* pcap packet will fit in the mbuf, can copy it */ - rte_memcpy(rte_pktmbuf_mtod(mbuf, void *), packet, - header.caplen); - mbuf->data_len = (uint16_t)header.caplen; + rte_memcpy(rte_pktmbuf_mtod(mbuf, void *), packet, len); + mbuf->data_len = len; } else { /* Try read jumbo frame into multi mbufs. */ if (unlikely(eth_pcap_rx_jumbo(pcap_q->mb_pool, - mbuf, - packet, - header.caplen) == -1)) { + mbuf, packet, len) == -1)) { pcap_q->rx_stat.err_pkts++; rte_pktmbuf_free(mbuf); break; } } - mbuf->pkt_len = (uint16_t)header.caplen; - *RTE_MBUF_DYNFIELD(mbuf, timestamp_dynfield_offset, - rte_mbuf_timestamp_t *) = - (uint64_t)header.ts.tv_sec * 1000000 + - header.ts.tv_usec; + mbuf->pkt_len = len; + uint64_t us = (uint64_t)header->ts.tv_sec * US_PER_S + header->ts.tv_usec; + + *RTE_MBUF_DYNFIELD(mbuf, timestamp_dynfield_offset, rte_mbuf_timestamp_t *) = us; mbuf->ol_flags |= timestamp_rx_dynflag; mbuf->port = pcap_q->port_id; bufs[num_rx] = mbuf; num_rx++; - rx_bytes += header.caplen; + rx_bytes += len; } pcap_q->rx_stat.pkts += num_rx; pcap_q->rx_stat.bytes += rx_bytes; -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-11-11 14:23:09.636059148 +0800 +++ 0100-net-pcap-fix-blocking-Rx.patch 2024-11-11 14:23:05.262192837 +0800 @@ -1 +1 @@ -From f5ead8f84f205babb320a1d805fb436ba31a5532 Mon Sep 17 00:00:00 2001 +From 586405a26eab30b8ba04b54197aee639f89410d0 Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit f5ead8f84f205babb320a1d805fb436ba31a5532 ] @@ -11 +13,0 @@ -Cc: stable@dpdk.org @@ -22 +24 @@ -index 3e9e8b416e..bd7958652a 100644 +index 8d7fa55d9e..8a0ce733c3 100644 @@ -25 +27,2 @@ -@@ -1103,6 +1103,7 @@ Nobuhiro Miki +@@ -1059,6 +1059,7 @@ Noa Ezra + Nobuhiro Miki @@ -27 +29,0 @@ - Norbert Zulinski @@ -32 +34 @@ - Oleg Akhrem + Oleg Polyakov