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 C05174625C for ; Tue, 18 Feb 2025 13:39:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BA632402A0; Tue, 18 Feb 2025 13:39:33 +0100 (CET) Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2056.outbound.protection.outlook.com [40.107.93.56]) by mails.dpdk.org (Postfix) with ESMTP id F1971402A0 for ; Tue, 18 Feb 2025 13:39:31 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=knT78/+GYnSOd9CoS74h0vpA7IB5hkUqgCNI/LIMK3kOBkZTKEuu6hE3y1SU9VZMxXtU6YTW/+uanAlsf5zTDPPpvhDZPYLW1BOCGZ+kRPtmpcPWRkz+Vb87bBWR+2Sa7lu2gWDXqlLoyKK7O44qgdXU5PXm8KLWEAaIPHHSgSnJ1bPrVyx8Ei3oTuhkWSb7hYWHSy9GTIF1FA6z6vUN0e0it0vtC6ODZe24xeG1JsbSvPGiOhFlhsAE/Ju3morY3gpWjUjBGCylQb6Kimn1Kbf5V85R07o9su7e7CvS9FYGXxhhNUfcVe1T5CvzlgOcflPeLg8vk9wxtgNHYkExSA== 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=SKKQA8W5ckebP7X3EofXpwfN9ISgPHUmr98H0O2zrZY=; b=xQ1FoAHOV12TsrMBQo19vU+rCa7lTvpcNiM2nOznxoGkNxFKv/X4HBrnK/pDfQ5T1Zo+wCMJJhJ7U6JuKyP2MhVnHEbBM9v+z0+gjJubgy2YwZIbOO0E2c1kj4GRv/ZGY1+bAyDbKEnr/OOrvpUY9kVJdrcLeqjr5RV4h+F20rUVkSux0ssstJI3fasf/8SODEgkOCslkvp8pVodjTOrtrbijQCwyAfx5XDli+e67b6ictxXQfC31JdxCjRWAtosiweTboRlPYWyJdx7X9RePCmpX5hUGFJ2Ay/Y4sZgeM4IiWtBeTj8BplDQVPDcADO8XVdv8MqqYRapR/2BvYMew== 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 (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=SKKQA8W5ckebP7X3EofXpwfN9ISgPHUmr98H0O2zrZY=; b=HnpuKuHwNpYz+AoHeQMxIsgze3JBPIc7PykWq+7nL6VmJlSFXynSLwUm4ZQzft6FwfvNwmrI0wbDmXajro6i9WYzfpTFVjCJcmPoV6aDWNcniL7tvBfy2b3nPgkeXVvUohDzgqbV8iwpVlTit9zeckX+fenvbCBZr1vWP5um5COmzf7DFh33ni+I+/yJqpixMImJjRQMRI1XHCOn+Ol9cbKHWoAh8LWFa5YCfHykeCB9KpiPRtBtMZnyInEzC4uRy3xdZOqdPFbDNVWdM3XDYi1QABI2txLZ1N9M5/SWdV6fCz3MHSiCD3YP6S2SBqS5j7h3Cq/KkCsGVYZlk0NEXA== Received: from MW4PR04CA0147.namprd04.prod.outlook.com (2603:10b6:303:84::32) by DM4PR12MB5844.namprd12.prod.outlook.com (2603:10b6:8:67::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8445.19; Tue, 18 Feb 2025 12:39:27 +0000 Received: from MWH0EPF000989E9.namprd02.prod.outlook.com (2603:10b6:303:84:cafe::f9) by MW4PR04CA0147.outlook.office365.com (2603:10b6:303:84::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8445.17 via Frontend Transport; Tue, 18 Feb 2025 12:39:27 +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 MWH0EPF000989E9.mail.protection.outlook.com (10.167.241.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8466.11 via Frontend Transport; Tue, 18 Feb 2025 12:39:26 +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; Tue, 18 Feb 2025 04:39:18 -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.14; Tue, 18 Feb 2025 04:39:16 -0800 From: Xueming Li To: Huisong Li CC: , Thomas Monjalon , dpdk stable Subject: patch 'ethdev: fix functions available in new device event' has been queued to stable release 23.11.4 Date: Tue, 18 Feb 2025 20:34:31 +0800 Message-ID: <20250218123523.36836-37-xuemingl@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250218123523.36836-1-xuemingl@nvidia.com> References: <20250218123523.36836-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: 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: MWH0EPF000989E9:EE_|DM4PR12MB5844:EE_ X-MS-Office365-Filtering-Correlation-Id: 85a6b2c9-3f79-47a7-c156-08dd5019478a X-LD-Processed: 43083d15-7273-40c1-b7db-39efd9ccc17a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|82310400026|36860700013|13003099007|7053199007; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?UQRU17XqgGf/ktP3wZ3AlW/JYpKP+YpgFYvnph4vDMNP48Uqs8gcGhBF7hDu?= =?us-ascii?Q?rIaunlATzSvi5moR7ErFmdsaVicUjLY+qsFIICRKEoyB+oHaMFHzhpMHK8V0?= =?us-ascii?Q?VwkEDDtkvs8ZSb3yfFiEcJfAWp7DtO8X4PPLN3WYREH97jvPpBJ8W+fU2MHB?= =?us-ascii?Q?Puzbsb/08xMaKIWG3RwCpLicBNaq4q6Lz3uegzOb8gG0JC271A4XB02QNvsX?= =?us-ascii?Q?9LeG1K2+MDVpNPslHEQsBmHjf6cMq+fkKQQga/dbh6P8yQrpFV+dNyaU5kdl?= =?us-ascii?Q?Zgd0k3YQ+sHx7luyiZ6IKwjxpQw5glAHZLQHXg4wxyVkMpP8foB/hzHSZ4wb?= =?us-ascii?Q?pzYeRVlwLzbdmM8WunsNNDqvAYtjJM0QyAxpdLRrw+P2aWwooACQhzQu4OVu?= =?us-ascii?Q?0x+w1SoU0qlbj1x+xoI1cl2NN0lv7g8eHxwH66SB1EQVZtLd5jJvEIaOeKk3?= =?us-ascii?Q?Wi7A7ztSB/+MlHJ//Dt/cvMbqgmMnHlmKahIwhQvBUthOVo9bVmiHlpvw25C?= =?us-ascii?Q?s8d/Q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7?= =?us-ascii?Q?F+BSB2S1w7fTIb4bZgajfSFtGSydrIUW1teRM/Z5rdjf+3QRaoV4rm19Ah3I?= =?us-ascii?Q?krqPbPt378MiNKI=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)(376014)(1800799024)(82310400026)(36860700013)(13003099007)(7053199007); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2025 12:39:26.0221 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85a6b2c9-3f79-47a7-c156-08dd5019478a 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: MWH0EPF000989E9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5844 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.4 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. 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=c1c2fd8405a0f6bef24a1a1375ddafdecf285f7e Thanks. Xueming Li --- >From c1c2fd8405a0f6bef24a1a1375ddafdecf285f7e Mon Sep 17 00:00:00 2001 From: Huisong Li Date: Fri, 17 Jan 2025 17:12:10 +0800 Subject: [PATCH] ethdev: fix functions available in new device event Cc: Xueming Li [ upstream commit 0b8f35358ceb0178878f72b66a36dc0ab7924377 ] During probing, before the port becomes generally available, the rte_eth_dev_socket_id() and rte_eth_dev_owner_*() are available to the application. Fixes: 7dcd73e37965 ("drivers/bus: set device NUMA node to unknown by default") Fixes: 53ef1b34776b ("ethdev: add sanity checks in control APIs") Signed-off-by: Huisong Li Acked-by: Thomas Monjalon --- lib/ethdev/rte_ethdev.c | 14 +++++++++++--- lib/ethdev/rte_ethdev.h | 8 +++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c index dfcdf76fee..86fd457f78 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -600,9 +600,10 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) struct rte_eth_dev *ethdev; int ret; - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); - ethdev = &rte_eth_devices[port_id]; + if (port_id >= RTE_MAX_ETHPORTS) + return -ENODEV; + ethdev = &rte_eth_devices[port_id]; if (!eth_dev_is_allocated(ethdev)) { RTE_ETHDEV_LOG(ERR, "Port ID %"PRIu16" is not allocated\n", port_id); @@ -635,8 +636,15 @@ int rte_eth_dev_socket_id(uint16_t port_id) { int socket_id = SOCKET_ID_ANY; + struct rte_eth_dev *ethdev; - if (!rte_eth_dev_is_valid_port(port_id)) { + if (port_id >= RTE_MAX_ETHPORTS) { + rte_errno = EINVAL; + return socket_id; + } + + ethdev = &rte_eth_devices[port_id]; + if (!eth_dev_is_allocated(ethdev)) { rte_errno = EINVAL; } else { socket_id = rte_eth_devices[port_id].data->numa_node; diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 545799c341..089bf3626d 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -4029,7 +4029,13 @@ enum rte_eth_event_type { RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */ RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */ RTE_ETH_EVENT_INTR_RMV, /**< device removal event */ - RTE_ETH_EVENT_NEW, /**< port is probed */ + /** + * The port is being probed, i.e. allocated and not yet available. + * It is too early to check validity, query infos, and configure + * the port. But some functions, like rte_eth_dev_socket_id() and + * rte_eth_dev_owner_*() are available to the application. + */ + RTE_ETH_EVENT_NEW, RTE_ETH_EVENT_DESTROY, /**< port is released */ RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */ RTE_ETH_EVENT_FLOW_AGED,/**< New aged-out flows is detected */ -- 2.34.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-18 19:39:02.017703608 +0800 +++ 0036-ethdev-fix-functions-available-in-new-device-event.patch 2025-02-18 19:39:00.538244063 +0800 @@ -1 +1 @@ -From 0b8f35358ceb0178878f72b66a36dc0ab7924377 Mon Sep 17 00:00:00 2001 +From c1c2fd8405a0f6bef24a1a1375ddafdecf285f7e Mon Sep 17 00:00:00 2001 @@ -4,0 +5,3 @@ +Cc: Xueming Li + +[ upstream commit 0b8f35358ceb0178878f72b66a36dc0ab7924377 ] @@ -12 +14,0 @@ -Cc: stable@dpdk.org @@ -18,2 +20,2 @@ - lib/ethdev/rte_ethdev.h | 3 ++- - 2 files changed, 13 insertions(+), 4 deletions(-) + lib/ethdev/rte_ethdev.h | 8 +++++++- + 2 files changed, 18 insertions(+), 4 deletions(-) @@ -22 +24 @@ -index b7cb26f0d3..c4079bb924 100644 +index dfcdf76fee..86fd457f78 100644 @@ -25 +27 @@ -@@ -602,9 +602,10 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) +@@ -600,9 +600,10 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) @@ -36 +38 @@ - RTE_ETHDEV_LOG_LINE(ERR, "Port ID %"PRIu16" is not allocated", + RTE_ETHDEV_LOG(ERR, "Port ID %"PRIu16" is not allocated\n", @@ -38 +40 @@ -@@ -637,8 +638,15 @@ int +@@ -635,8 +636,15 @@ int @@ -56 +58 @@ -index 978104d232..40d97b17d4 100644 +index 545799c341..089bf3626d 100644 @@ -59,5 +61,8 @@ -@@ -4162,7 +4162,8 @@ enum rte_eth_event_type { - /** - * The port is being probed, i.e. allocated and not yet available. - * It is too early to check validity, query infos, and configure -- * the port. +@@ -4029,7 +4029,13 @@ enum rte_eth_event_type { + RTE_ETH_EVENT_VF_MBOX, /**< message from the VF received by PF */ + RTE_ETH_EVENT_MACSEC, /**< MACsec offload related event */ + RTE_ETH_EVENT_INTR_RMV, /**< device removal event */ +- RTE_ETH_EVENT_NEW, /**< port is probed */ ++ /** ++ * The port is being probed, i.e. allocated and not yet available. ++ * It is too early to check validity, query infos, and configure @@ -66,2 +71,2 @@ - */ - RTE_ETH_EVENT_NEW, ++ */ ++ RTE_ETH_EVENT_NEW, @@ -68,0 +74,2 @@ + RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */ + RTE_ETH_EVENT_FLOW_AGED,/**< New aged-out flows is detected */