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 1EEC7A0032 for ; Fri, 18 Feb 2022 13:44:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 19D2840141; Fri, 18 Feb 2022 13:44:22 +0100 (CET) Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by mails.dpdk.org (Postfix) with ESMTP id 8DA7941142 for ; Fri, 18 Feb 2022 13:44:20 +0100 (CET) Received: by mail-wm1-f48.google.com with SMTP id bg21-20020a05600c3c9500b0035283e7a012so6357848wmb.0 for ; Fri, 18 Feb 2022 04:44:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+d4s5KclOWJx0wCqOtO7pmRCA7QMl5p/dyyB2LUh16E=; b=BTP6/xy6FvXLf8OPf/kd0dfklVGDHN4BQPxP1dD2GWikOOK3tL/XlwOlz1mnSzC1r7 DtrDGdy4cD8RdpDl4OcxX/w9BZabYGK23BsPSjrm2QlHAjCXsYh3oImiFAvscrYrRm8Y A79piWGahiMFX+G2r1LhXgJphM8zj5cVMBzrZuq3hou8qDfO/JSvVt9O+eZnQTT9Id3x nH9Yvxg2A9nHyybW3gkOccGmTiMKc2BV+rPpABgHv7QicHTc9oAW0da+dEGkMN5SRxGX T1FqBA1H1ihwjQZerYYEYFUGQDVURoCiRUT8ZHK4+VhmAgF0dAP5L7x47s40Kf+LffJ8 /dMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+d4s5KclOWJx0wCqOtO7pmRCA7QMl5p/dyyB2LUh16E=; b=C3qz+BZ9rl9ONzUwJepl0yV03zDUWAoPenm1d7jVuJihS2yAjeV3NPOna8Miyibehc kAl6hL/w53iQJpfI3oiv+ZYNRQHHRh2c3nHBGxkOagW/AGVO46UFMXrQx66btdPKKtWy GvGSUx6YPB8jft9FSSEPDU0Mu29EYt6llrk0tog/WHDfzaHKbqtdlvtAplxTXwsnoP41 ILB8uEuxrbHsa8Gy7nmsMhjI+y0WdcUe1PYBKpa3KkBgur5x9sKv0/LmB66I2N2WJQ1A ve+0BpO1Zw2QYYJ0tloMM4G7a5TWvvCel/wCKeqxIOOzt5KpJntAOXAOZ6LTDCNHQ2es uI9A== X-Gm-Message-State: AOAM530syoq7sfPO87iaorUJRS/xrDL5JsgWZx+Z/BIFlEEnbbwvV6mE 0Oyfygjs3zUYgD2+EYdL1pw= X-Google-Smtp-Source: ABdhPJxo/ebsbStL1/+grvFCheRP8KpVBWQlcnREDONvWo0K24t5DZRR2B3yaJZa7k0bAvIz+D6+KA== X-Received: by 2002:a1c:7419:0:b0:37b:b96e:81a6 with SMTP id p25-20020a1c7419000000b0037bb96e81a6mr10641441wmc.8.1645188260260; Fri, 18 Feb 2022 04:44:20 -0800 (PST) Received: from localhost ([2a01:4b00:f41a:3600:360b:9754:2e3a:c344]) by smtp.gmail.com with ESMTPSA id t16sm4609415wmq.43.2022.02.18.04.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Feb 2022 04:44:19 -0800 (PST) From: luca.boccassi@gmail.com To: Kumara Parameshwaran Cc: Ferruh Yigit , dpdk stable Subject: patch 'ethdev: add internal function to device struct from name' has been queued to stable release 20.11.5 Date: Fri, 18 Feb 2022 12:39:01 +0000 Message-Id: <20220218123931.1749595-92-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220218123931.1749595-1-luca.boccassi@gmail.com> References: <20220218123931.1749595-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 20.11.5 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/20/22. 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/eea12b2874ac505618169234d4c23bbb16353341 Thanks. Luca Boccassi --- >From eea12b2874ac505618169234d4c23bbb16353341 Mon Sep 17 00:00:00 2001 From: Kumara Parameshwaran Date: Mon, 31 Jan 2022 20:02:33 +0530 Subject: [PATCH] ethdev: add internal function to device struct from name [ upstream commit 961fb4029b8c52c0e8230d34993c354d70e10e14 ] The PMDs would need a function to access the rte_eth_devices without accessing the global rte_eth_device array. Signed-off-by: Kumara Parameshwaran Reviewed-by: Ferruh Yigit --- lib/librte_ethdev/rte_ethdev.c | 11 +++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 18 ++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 3 files changed, 30 insertions(+) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index dd5ce4eb1a..24eb0d1197 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -839,6 +839,17 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) return -ENODEV; } +struct rte_eth_dev * +rte_eth_dev_get_by_name(const char *name) +{ + uint16_t pid; + + if (rte_eth_dev_get_port_by_name(name, &pid)) + return NULL; + + return &rte_eth_devices[pid]; +} + static int eth_err(uint16_t port_id, int ret) { diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index 7ee0f797d3..b6abef7782 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -1326,6 +1326,24 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue, struct rte_hairpin_peer_info *peer_info, uint32_t direction); +/** + * @internal + * Get rte_eth_dev from device name. The device name should be specified + * as below: + * - PCIe address (Domain:Bus:Device.Function), for example 0000:2:00.0 + * - SoC device name, for example fsl-gmac0 + * - vdev dpdk name, for example net_[pcap0|null0|tap0] + * + * @param name + * PCI address or name of the device + * @return + * - rte_eth_dev if successful + * - NULL on failure + */ +__rte_internal +struct rte_eth_dev* +rte_eth_dev_get_by_name(const char *name); + /** * @internal * Reset the current queue state and configuration to disconnect (unbind) it diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map index d3f5410806..d3f9baf23c 100644 --- a/lib/librte_ethdev/version.map +++ b/lib/librte_ethdev/version.map @@ -251,6 +251,7 @@ INTERNAL { rte_eth_dev_callback_process; rte_eth_dev_create; rte_eth_dev_destroy; + rte_eth_dev_get_by_name; rte_eth_dev_is_rx_hairpin_queue; rte_eth_dev_is_tx_hairpin_queue; rte_eth_dev_probing_finish; -- 2.30.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2022-02-18 12:37:41.410099774 +0000 +++ 0092-ethdev-add-internal-function-to-device-struct-from-n.patch 2022-02-18 12:37:37.818794779 +0000 @@ -1 +1 @@ -From 961fb4029b8c52c0e8230d34993c354d70e10e14 Mon Sep 17 00:00:00 2001 +From eea12b2874ac505618169234d4c23bbb16353341 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 961fb4029b8c52c0e8230d34993c354d70e10e14 ] + @@ -9,2 +10,0 @@ -Cc: stable@dpdk.org - @@ -14,3 +14,3 @@ - lib/ethdev/ethdev_driver.h | 18 ++++++++++++++++++ - lib/ethdev/rte_ethdev.c | 11 +++++++++++ - lib/ethdev/version.map | 1 + + lib/librte_ethdev/rte_ethdev.c | 11 +++++++++++ + lib/librte_ethdev/rte_ethdev_driver.h | 18 ++++++++++++++++++ + lib/librte_ethdev/version.map | 1 + @@ -19,5 +19,27 @@ -diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h -index d95605a355..0dac55f9c8 100644 ---- a/lib/ethdev/ethdev_driver.h -+++ b/lib/ethdev/ethdev_driver.h -@@ -1629,6 +1629,24 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue, +diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c +index dd5ce4eb1a..24eb0d1197 100644 +--- a/lib/librte_ethdev/rte_ethdev.c ++++ b/lib/librte_ethdev/rte_ethdev.c +@@ -839,6 +839,17 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) + return -ENODEV; + } + ++struct rte_eth_dev * ++rte_eth_dev_get_by_name(const char *name) ++{ ++ uint16_t pid; ++ ++ if (rte_eth_dev_get_port_by_name(name, &pid)) ++ return NULL; ++ ++ return &rte_eth_devices[pid]; ++} ++ + static int + eth_err(uint16_t port_id, int ret) + { +diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h +index 7ee0f797d3..b6abef7782 100644 +--- a/lib/librte_ethdev/rte_ethdev_driver.h ++++ b/lib/librte_ethdev/rte_ethdev_driver.h +@@ -1326,6 +1326,24 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue, @@ -48,27 +70,5 @@ -diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c -index 29e21ad580..917a320afa 100644 ---- a/lib/ethdev/rte_ethdev.c -+++ b/lib/ethdev/rte_ethdev.c -@@ -894,6 +894,17 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id) - return -ENODEV; - } - -+struct rte_eth_dev * -+rte_eth_dev_get_by_name(const char *name) -+{ -+ uint16_t pid; -+ -+ if (rte_eth_dev_get_port_by_name(name, &pid)) -+ return NULL; -+ -+ return &rte_eth_devices[pid]; -+} -+ - static int - eth_err(uint16_t port_id, int ret) - { -diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map -index c2fb0669a4..1f7359c846 100644 ---- a/lib/ethdev/version.map -+++ b/lib/ethdev/version.map -@@ -267,6 +267,7 @@ INTERNAL { +diff --git a/lib/librte_ethdev/version.map b/lib/librte_ethdev/version.map +index d3f5410806..d3f9baf23c 100644 +--- a/lib/librte_ethdev/version.map ++++ b/lib/librte_ethdev/version.map +@@ -251,6 +251,7 @@ INTERNAL {