Skip to contentSkip to conversation

ethdev: promote port ownership API as stable

PATCH Applied Thomas Monjalon 5 participants 6 messages Oct 28, 2021 – Jun 2, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ethdev: promote port ownership API as stable

The port ownership concept was introduced in ethdev in DPDK 18.02. Not sure it is used by applications except those using failsafe or netvsc. It can also be used by libraries or applications to sort out how ports are controlled.

Hiding sub-ports controlled by failsafe or netvsc look to be enough justification to promote this API as stable.

---
 doc/guides/prog_guide/poll_mode_drv.rst |  6 +++++-
 lib/ethdev/rte_ethdev.h                 | 20 --------------------
 lib/ethdev/version.map                  | 12 +++++-------
 3 files changed, 10 insertions(+), 28 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +5 -1
index 6831289844..9d081b1cba 100644
@@ -146,14 +146,18 @@ Based on their PCI identifier, NIC ports are assigned two other identifiers:
 
 Port Ownership
 ~~~~~~~~~~~~~~
+
 The Ethernet devices ports can be owned by a single DPDK entity (application, library, PMD, process, etc).
 The ownership mechanism is controlled by ethdev APIs and allows to set/remove/get a port owner by DPDK entities.
-Allowing this should prevent any multiple management of Ethernet port by different entities.
+It prevents Ethernet ports to be managed by different entities.
 
 .. note::
 
     It is the DPDK entity responsibility to set the port owner before using it and to manage the port usage synchronization between different threads or processes.
 
+It is recommended to set port ownership early,
+like during the probing notification ``RTE_ETH_EVENT_NEW``.
+
 Device Configuration
 ~~~~~~~~~~~~~~~~~~~~
 
lib/ethdev/rte_ethdev.h +0 -20
index 09d60351a3..154465c3ab 100644
@@ -2193,9 +2193,6 @@ rte_eth_find_next_sibling(uint16_t port_id_start, uint16_t ref_port_id);
 		port_id = rte_eth_find_next_sibling(port_id + 1, ref_port_id))
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Get a new unique owner identifier.
  * An owner identifier is used to owns Ethernet devices by only one DPDK entity
  * to avoid multiple management of device by different entities.
@@ -2205,13 +2202,9 @@ rte_eth_find_next_sibling(uint16_t port_id_start, uint16_t ref_port_id);
  * @return
  *   Negative errno value on error, 0 on success.
  */
-__rte_experimental
 int rte_eth_dev_owner_new(uint64_t *owner_id);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Set an Ethernet device owner.
  *
  * @param	port_id
@@ -2221,14 +2214,10 @@ int rte_eth_dev_owner_new(uint64_t *owner_id);
  * @return
  *  Negative errno value on error, 0 on success.
  */
-__rte_experimental
 int rte_eth_dev_owner_set(const uint16_t port_id,
 		const struct rte_eth_dev_owner *owner);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Unset Ethernet device owner to make the device ownerless.
  *
  * @param	port_id
@@ -2238,14 +2227,10 @@ int rte_eth_dev_owner_set(const uint16_t port_id,
  * @return
  *  0 on success, negative errno value on error.
  */
-__rte_experimental
 int rte_eth_dev_owner_unset(const uint16_t port_id,
 		const uint64_t owner_id);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Remove owner from all Ethernet devices owned by a specific owner.
  *
  * @param	owner_id
@@ -2253,13 +2238,9 @@ int rte_eth_dev_owner_unset(const uint16_t port_id,
  * @return
  *  0 on success, negative errno value on error.
  */
-__rte_experimental
 int rte_eth_dev_owner_delete(const uint64_t owner_id);
 
 /**
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Get the owner of an Ethernet device.
  *
  * @param	port_id
@@ -2269,7 +2250,6 @@ int rte_eth_dev_owner_delete(const uint64_t owner_id);
  * @return
  *  0 on success, negative errno value on error..
  */
-__rte_experimental
 int rte_eth_dev_owner_get(const uint16_t port_id,
 		struct rte_eth_dev_owner *owner);
 
lib/ethdev/version.map +5 -7
index c2fb0669a4..15a69e67eb 100644
@@ -36,6 +36,11 @@ DPDK_22 {
 	rte_eth_dev_logtype;
 	rte_eth_dev_mac_addr_add;
 	rte_eth_dev_mac_addr_remove;
+	rte_eth_dev_owner_delete;
+	rte_eth_dev_owner_get;
+	rte_eth_dev_owner_new;
+	rte_eth_dev_owner_set;
+	rte_eth_dev_owner_unset;
 	rte_eth_dev_pool_ops_supported;
 	rte_eth_dev_priority_flow_ctrl_set;
 	rte_eth_dev_reset;
@@ -148,13 +153,6 @@ EXPERIMENTAL {
 	rte_mtr_stats_read;
 	rte_mtr_stats_update;
 
-	# added in 18.02
-	rte_eth_dev_owner_delete;
-	rte_eth_dev_owner_get;
-	rte_eth_dev_owner_new;
-	rte_eth_dev_owner_set;
-	rte_eth_dev_owner_unset;
-
 	# added in 18.05
 	rte_eth_dev_get_module_eeprom;
 	rte_eth_dev_get_module_info;
Signature · 1 line
2.33.0
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Thomas Monjalon

The port ownership concept was introduced in ethdev in DPDK 18.02. Not sure it is used by applications except those using failsafe or netvsc. It can also be used by libraries or applications to sort out how ports are controlled.

Hiding sub-ports controlled by failsafe or netvsc look to be enough justification to promote this API as stable.

Quoted 6 lines
---
  doc/guides/prog_guide/poll_mode_drv.rst |  6 +++++-
  lib/ethdev/rte_ethdev.h                 | 20 --------------------
  lib/ethdev/version.map                  | 12 +++++-------
  3 files changed, 10 insertions(+), 28 deletions(-)
#2 lore raw
Quoted 11 lines · Ray
Quoted 8 lines · Thomas Monjalon

The port ownership concept was introduced in ethdev in DPDK 18.02. Not sure it is used by applications except those using failsafe or netvsc. It can also be used by libraries or applications to sort out how ports are controlled.

Hiding sub-ports controlled by failsafe or netvsc look to be enough justification to promote this API as stable.

Quoted 8 lines
Quoted 6 lines

---
  doc/guides/prog_guide/poll_mode_drv.rst |  6 +++++- lib/ethdev/rte_ethdev.h                 | 20 -------------------- lib/ethdev/version.map                  | 12 +++++-------

  3 files changed, 10 insertions(+), 28 deletions(-)
Applied
#3 lore raw
Quoted 19 lines · Andrew Rybchenko
Quoted 18 lines · Ray
Quoted 14 lines · Thomas Monjalon

The port ownership concept was introduced in ethdev in DPDK 18.02. Not sure it is used by applications except those using failsafe or netvsc. It can also be used by libraries or applications to sort out how ports are controlled.

Hiding sub-ports controlled by failsafe or netvsc look to be enough justification to promote this API as stable.

---
  doc/guides/prog_guide/poll_mode_drv.rst |  6 +++++- lib/ethdev/rte_ethdev.h                 | 20 -------------------- lib/ethdev/version.map                  | 12 +++++-------

  3 files changed, 10 insertions(+), 28 deletions(-)
Quoted 3 lines
Quoted 1 line

Applied to dpdk-next-net/main, thanks.

#4 lore raw
In reply to Thomas Monjalon
Quoted 9 lines · Thomas Monjalon

The port ownership concept was introduced in ethdev in DPDK 18.02. Not sure it is used by applications except those using failsafe or netvsc. It can also be used by libraries or applications to sort out how ports are controlled.

Hiding sub-ports controlled by failsafe or netvsc look to be enough justification to promote this API as stable.

There is a defect in the 'rte_eth_dev_owner_delete()', which cause a crash, it is fixed in my ethdev unit test patch:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

I think we should get the fix first.

And the crash not detected/reported until now makes me think API is still not used much, I wonder if we should wait a little more to mature them.

Also only internal user of the API is 'drivers/net/netvsc', I wonder if PMD detect the crash?

#5 lore raw

28/10/2021 12:22, Ferruh Yigit:

Quoted 9 lines · Thomas Monjalon
Quoted 8 lines

The port ownership concept was introduced in ethdev in DPDK 18.02. Not sure it is used by applications except those using failsafe or netvsc. It can also be used by libraries or applications to sort out how ports are controlled.

Hiding sub-ports controlled by failsafe or netvsc look to be enough justification to promote this API as stable.

Quoted 7 lines
Quoted 1 line

There is a defect in the 'rte_eth_dev_owner_delete()', which cause a crash, it is fixed in my ethdev unit test patch:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/

I think we should get the fix first.

I think such fix should be sent separately.
OK to get the fix first.

Quoted 2 lines

And the crash not detected/reported until now makes me think API is still not used much, I wonder if we should wait a little more to mature them.

It is not a surprise that the delete operation is not used much. But the set operation is used.
I am not sure about waiting more. I have no strong opinion.

Quoted 2 lines

Also only internal user of the API is 'drivers/net/netvsc', I wonder if PMD detect the crash?

Question for Long Li?