patch 'ethdev: add internal function to device struct from name' has been queued to stable release 21.11.1

Kevin Traynor ktraynor at redhat.com
Mon Feb 21 16:35:28 CET 2022


Hi,

FYI, your patch has been queued to stable release 21.11.1

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/26/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/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/721d0bbd1668d2a4b617a4a4de0b93dd60283d58

Thanks.

Kevin

---
>From 721d0bbd1668d2a4b617a4a4de0b93dd60283d58 Mon Sep 17 00:00:00 2001
From: Kumara Parameshwaran <kparameshwar at vmware.com>
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 <kparameshwar at vmware.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 lib/ethdev/ethdev_driver.h | 18 ++++++++++++++++++
 lib/ethdev/rte_ethdev.c    | 11 +++++++++++
 lib/ethdev/version.map     |  1 +
 3 files changed, 30 insertions(+)

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
@@ -1630,4 +1630,22 @@ rte_eth_hairpin_queue_peer_bind(uint16_t cur_port, uint16_t cur_queue,
 				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
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
@@ -895,4 +895,15 @@ rte_eth_dev_get_port_by_name(const char *name, uint16_t *port_id)
 }
 
+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
@@ -268,4 +268,5 @@ INTERNAL {
 	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;
-- 
2.34.1

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2022-02-21 15:22:47.611834978 +0000
+++ 0139-ethdev-add-internal-function-to-device-struct-from-n.patch	2022-02-21 15:22:44.293704581 +0000
@@ -1 +1 @@
-From 961fb4029b8c52c0e8230d34993c354d70e10e14 Mon Sep 17 00:00:00 2001
+From 721d0bbd1668d2a4b617a4a4de0b93dd60283d58 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 961fb4029b8c52c0e8230d34993c354d70e10e14 ]
+
@@ -8,2 +9,0 @@
-
-Cc: stable at dpdk.org



More information about the stable mailing list