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

Message ID 20180416130605.6509-3-declan.doherty@intel.com (mailing list archive)
State Superseded, 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 16, 2018, 1:05 p.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 | 17 +++++++++++++++++
 2 files changed, 29 insertions(+)
  

Comments

Thomas Monjalon April 24, 2018, 4:38 p.m. UTC | #1
16/04/2018 15:05, Declan Doherty:
> --- a/lib/librte_ether/rte_ethdev.h
> +++ b/lib/librte_ether/rte_ethdev.h
> +/**
> + * Default values for switch domain id when ethdev does not support switch
> + * domain definitions.

values -> value

> + */
> +#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;	/**< switch port id */

I feel we need more details about what is the "switch port id".

[...]
> @@ -1054,6 +1069,8 @@ struct rte_eth_dev_info {
>  	struct rte_eth_dev_portconf default_rxportconf;
>  	/** Tx parameter recommendations */
>  	struct rte_eth_dev_portconf default_txportconf;
> +	/** ethdev switch information */

Can we reword it to express that it is about the hardware
built-in switch hard wired to this port?

> +	struct rte_eth_switch_info switch_info;
>  };
  

Patch

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index dd051f5ca..884bcb3b6 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 4f417f573..b5e5fc52a 100644
--- a/lib/librte_ether/rte_ethdev.h
+++ b/lib/librte_ether/rte_ethdev.h
@@ -1009,6 +1009,21 @@  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;	/**< switch port id */
+};
+
 /**
  * Ethernet device information
  */
@@ -1054,6 +1069,8 @@  struct rte_eth_dev_info {
 	struct rte_eth_dev_portconf default_rxportconf;
 	/** Tx parameter recommendations */
 	struct rte_eth_dev_portconf default_txportconf;
+	/** ethdev switch information */
+	struct rte_eth_switch_info switch_info;
 };
 
 /**