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

luca.boccassi at gmail.com luca.boccassi at gmail.com
Fri Feb 18 13:39:01 CET 2022


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 <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/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 at 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 {


More information about the stable mailing list