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 4FFC34624E for ; Mon, 17 Feb 2025 18:06:13 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4BD8C402AB; Mon, 17 Feb 2025 18:06:13 +0100 (CET) Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id 22DCB402C6 for ; Mon, 17 Feb 2025 18:06:11 +0100 (CET) Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-4396424d173so45296815e9.0 for ; Mon, 17 Feb 2025 09:06:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739811971; x=1740416771; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5NZOB2OC7rHHMd7UlDCUx2Tcp9tjcZPnYRROixLhzWc=; b=OyTt32hr0E2/gTp5jbRdIypqYaZDU51b1KPB37GPEF8sD4hI5JlGtrF42Y5hwvXBnW SsVDREOqueZRuGV1uB99Nzg825WxecyrCdpRA49OuA2u7WkLvw9DmKPcFJA0fJEm079h oG5wPaQIE48f+MCLCntmSDyBpHaTxl5/syK3ZKC2OSftprBHzkCfRJZ4+HsY/4Eh3tq9 2lKj1PAuU2DxC1ESZgTYRj11TFiIGfnnmNFhmSYtta3uuPPx01iybznOn5w6rGtWbn8r l9yZBMl0Ioea80uBdsR70wH7nlqk2F0ItHuqg2Ye2YCHJiKJmDo6FzScbpSOw/ejQPfS t8rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739811971; x=1740416771; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5NZOB2OC7rHHMd7UlDCUx2Tcp9tjcZPnYRROixLhzWc=; b=sY2Gm/P32PuKK72WCL4ncvRAPkVTkeOQLunIJB6kQn8xedsSPyEnhXDSKoZ9p5tsXm es6CDwg0J1SG8MNDRvdHI5hRTHsyZ2rS6VFsnFJCidd/Mr17HDGiaVcMg6o8z7KWx4Rd W+i2KYgr7Vbaj7EOB6/0rGSdA2lcaFtDQz6nGU70lFOH4BJAZntLRkjvGoxbgAOkeyvq 72k+LYHzUw8BdfrYYIMBP/H27OTJ/ptdbkE7AWi1YzBX4/61FNNZmYQPDLCEQ6WAGWKb Qm28ZeDqTqyNdSKrSjwzkImx61VSKSr1BHA3G7i6WT9Hwbm93gG2mQwYkDuzQfCCkcs5 SLtA== X-Forwarded-Encrypted: i=1; AJvYcCXV6ZVwTLYyURBRaxQ0fRkx868Ny0oy0hgkSjZbDsCDeJipZMszfLnEHeWYhNutP7l75x57+Ak=@dpdk.org X-Gm-Message-State: AOJu0YwglKZBmnHdmB15xQxEtQv2nTOpqx9nnsmO1CF9kxym4JNJ+BWw opr4kp/i73U4w2gk2ZPxrcaSZBDSuw/HBe/yENFlRb8cu3/vFlr8A7kP2xkHIY2nlg== X-Gm-Gg: ASbGncu3+q4y6uITKqHMeqZqcr2TAKaVuyZyn/uhfaeyzb677ro10UPIjKdtsOMoac6 pC9e9SJWVnarJMtcJultZPP2kdJubzrP7WkZftQLIgqqNUsBsAh+qlYQ/8lXfY0nUW/fAoIu1gJ /IpW4LIc5nAx5Rsy98G/06yf1toyDf7ax9G6Lo69f3aa8/jcf/XURoOMeFA+FWJNUF8I+FrevLM Wq37JSqcgLp3/lUN4S6phNLPyTcyiMvDDJzV3MOFIragA7AeJqis74q15WWjJirX1KB/45w8CkG D7ltxkvdSGHawZW3nvtmJg== X-Google-Smtp-Source: AGHT+IFc98CoblFj475nrP+aMP/s9N5kIcMyhqlKnuu7TXTaCfkMhgsLCttQeZQtYIOy5bVVuR/lXQ== X-Received: by 2002:a05:600c:5104:b0:439:8c9c:6d32 with SMTP id 5b1f17b1804b1-4398c9c6f8amr26194225e9.13.1739811970504; Mon, 17 Feb 2025 09:06:10 -0800 (PST) Received: from localhost ([2a01:4b00:d036:ae00:f83c:95e7:29fd:a997]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-43967bc44a0sm89608645e9.1.2025.02.17.09.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Feb 2025 09:06:09 -0800 (PST) From: luca.boccassi@gmail.com To: Huisong Li Cc: Thomas Monjalon , dpdk stable Subject: patch 'ethdev: fix functions available in new device event' has been queued to stable release 22.11.8 Date: Mon, 17 Feb 2025 17:03:58 +0000 Message-ID: <20250217170456.1068278-25-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250217170456.1068278-1-luca.boccassi@gmail.com> References: <20250217170456.1068278-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.8 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/19/25. 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://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/121d61206b7575fb0d492ad171c05221ecbab4df Thanks. Luca Boccassi --- >From 121d61206b7575fb0d492ad171c05221ecbab4df 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 [ 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 99b16e4dcc..f08cf5ccad 100644 --- a/lib/ethdev/rte_ethdev.c +++ b/lib/ethdev/rte_ethdev.c @@ -534,9 +534,10 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) { struct rte_eth_dev *ethdev; - 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); @@ -562,8 +563,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 e73244822a..896be82ee0 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -3885,7 +3885,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.47.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2025-02-17 16:13:17.749951361 +0000 +++ 0025-ethdev-fix-functions-available-in-new-device-event.patch 2025-02-17 16:13:16.810441593 +0000 @@ -1 +1 @@ -From 0b8f35358ceb0178878f72b66a36dc0ab7924377 Mon Sep 17 00:00:00 2001 +From 121d61206b7575fb0d492ad171c05221ecbab4df Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 0b8f35358ceb0178878f72b66a36dc0ab7924377 ] + @@ -12 +13,0 @@ -Cc: stable@dpdk.org @@ -18,2 +19,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 +23 @@ -index b7cb26f0d3..c4079bb924 100644 +index 99b16e4dcc..f08cf5ccad 100644 @@ -25 +26,2 @@ -@@ -602,9 +602,10 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) +@@ -534,9 +534,10 @@ rte_eth_dev_owner_get(const uint16_t port_id, struct rte_eth_dev_owner *owner) + { @@ -27 +28,0 @@ - int ret; @@ -36 +37 @@ - RTE_ETHDEV_LOG_LINE(ERR, "Port ID %"PRIu16" is not allocated", + RTE_ETHDEV_LOG(ERR, "Port ID %"PRIu16" is not allocated\n", @@ -38 +39 @@ -@@ -637,8 +638,15 @@ int +@@ -562,8 +563,15 @@ int @@ -56 +57 @@ -index 978104d232..40d97b17d4 100644 +index e73244822a..896be82ee0 100644 @@ -59,5 +60,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. +@@ -3885,7 +3885,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 +70,2 @@ - */ - RTE_ETH_EVENT_NEW, ++ */ ++ RTE_ETH_EVENT_NEW, @@ -68,0 +73,2 @@ + RTE_ETH_EVENT_IPSEC, /**< IPsec offload related event */ + RTE_ETH_EVENT_FLOW_AGED,/**< New aged-out flows is detected */