[dpdk-dev,v8,2/9] ethdev: add switch identifier parameter to port

Message ID 20180426104105.18342-3-declan.doherty@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Doherty, Declan April 26, 2018, 10:40 a.m. UTC
Introduces a new port attribute to ethdev port's which denotes the
switch domain a port belongs to. By default all port's switch
identifiers are set to RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID. Ports
which supported the concept of switch domains can be configured with
the same switch domain id.

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
---
 app/test-pmd/config.c         | 12 ++++++++++++
 lib/librte_ether/rte_ethdev.h | 27 +++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)
  

Comments

Thomas Monjalon April 26, 2018, 12:02 p.m. UTC | #1
26/04/2018 12:40, Declan Doherty:
> Introduces a new port attribute to ethdev port's which denotes the
> switch domain a port belongs to. By default all port's switch
> identifiers are set to RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID. Ports
> which supported the concept of switch domains can be configured with
> the same switch domain id.
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>

It's very well detailed now :)

Acked-by: Thomas Monjalon <thomas@monjalon.net>
  
Thomas Monjalon April 26, 2018, 2:26 p.m. UTC | #2
26/04/2018 14:02, Thomas Monjalon:
> 26/04/2018 12:40, Declan Doherty:
> > Introduces a new port attribute to ethdev port's which denotes the
> > switch domain a port belongs to. By default all port's switch
> > identifiers are set to RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID. Ports
> > which supported the concept of switch domains can be configured with
> > the same switch domain id.
> > 
> > Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> 
> It's very well detailed now :)
> 
> Acked-by: Thomas Monjalon <thomas@monjalon.net>

One miss: you forgot to remove the deprecation notice in this patch.
  
Ferruh Yigit April 27, 2018, 4:29 p.m. UTC | #3
On 4/26/2018 11:40 AM, Declan Doherty wrote:
> Introduces a new port attribute to ethdev port's which denotes the
> switch domain a port belongs to. By default all port's switch
> identifiers are set to RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID. Ports
> which supported the concept of switch domains can be configured with
> the same switch domain id.
> 
> Signed-off-by: Declan Doherty <declan.doherty@intel.com>
> ---
>  app/test-pmd/config.c         | 12 ++++++++++++
>  lib/librte_ether/rte_ethdev.h | 27 +++++++++++++++++++++++++++

Patch updated in next-net to remove deprecation notice:

  diff --git a/doc/guides/rel_notes/deprecation.rst
b/doc/guides/rel_notes/deprecation.rst
 index fd85a141b..c3b79a22f 100644
  --- a/doc/guides/rel_notes/deprecation.rst
  +++ b/doc/guides/rel_notes/deprecation.rst
 @@ -59,12 +59,6 @@ Deprecation Notices
    Target release for removal of the legacy API will be defined once most
     PMDs have switched to rte_flow.

  -* ethdev: A work is being planned for 18.05 to expose VF port representors
  -  as a mean to perform control and data path operation on the different VFs.
  -  As VF representor is an ethdev port, new fields are needed in order to map
  -  between the VF representor and the VF or the parent PF. Those new fields
  -  are to be included in ``rte_eth_dev_info`` struct.
  -
   * i40e: The default flexible payload configuration which extracts the first 16
     bytes of the payload for RSS will be deprecated starting from 18.02. If
     required the previous behavior can be configured using existing flow
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 216a7eb4e..26f416100 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -517,6 +517,18 @@  port_infos_display(portid_t port_id)
 	printf("Min possible number of TXDs per queue: %hu\n",
 		dev_info.tx_desc_lim.nb_min);
 	printf("TXDs number alignment: %hu\n", dev_info.tx_desc_lim.nb_align);
+
+	/* Show switch info only if valid switch domain and port id is set */
+	if (dev_info.switch_info.domain_id !=
+		RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID) {
+		if (dev_info.switch_info.name)
+			printf("Switch name: %s\n", dev_info.switch_info.name);
+
+		printf("Switch domain Id: %u\n",
+			dev_info.switch_info.domain_id);
+		printf("Switch Port Id: %u\n",
+			dev_info.switch_info.port_id);
+	}
 }
 
 void
diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.h
index efd84bb7b..06d9b288b 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1026,6 +1026,28 @@  struct rte_eth_dev_portconf {
 	uint16_t nb_queues; /**< Device-preferred number of queues */
 };
 
+/**
+ * Default values for switch domain id when ethdev does not support switch
+ * domain definitions.
+ */
+#define RTE_ETH_DEV_SWITCH_DOMAIN_ID_INVALID	(0)
+
+/**
+ * Ethernet device associated switch information
+ */
+struct rte_eth_switch_info {
+	const char *name;	/**< switch name */
+	uint16_t domain_id;	/**< switch domain id */
+	uint16_t port_id;
+	/**<
+	 * mapping to the devices physical switch port as enumerated from the
+	 * perspective of the embedded interconnect/switch. For SR-IOV enabled
+	 * device this may correspond to the VF_ID of each virtual function,
+	 * but each driver should explicitly define the mapping of switch
+	 * port identifier to that physical interconnect/switch
+	 */
+};
+
 /**
  * Ethernet device information
  */
@@ -1073,6 +1095,11 @@  struct rte_eth_dev_info {
 	struct rte_eth_dev_portconf default_txportconf;
 	/** Generic device capabilities (RTE_ETH_DEV_CAPA_). */
 	uint64_t dev_capa;
+	/**
+	 * Switching information for ports on a device with a
+	 * embedded managed interconnect/switch.
+	 */
+	struct rte_eth_switch_info switch_info;
 };
 
 /**