[v5,6/9] ethdev: support multi-host in representor

Message ID 1611040501-11666-6-git-send-email-xuemingl@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series [v5,1/9] ethdev: introduce representor type |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Xueming Li Jan. 19, 2021, 7:14 a.m. UTC
  The NIC can have multiple PCIe links and can be attached to the multiple
hosts, for example the same single NIC can be shared for multiple server
units in the rack. On each PCIe link NIC can provide multiple PFs and
VFs/SFs based on these ones. To provide the unambiguous identification
of the PCIe function the controller index is added. The full representor
identifier consists of three indices - controller index, PF index, and
VF or SF index (if any).

This patch introduces controller index to ethdev representor syntax,
examples:

[[c#]pf#]vf#: VF port representor/s, example: pf0vf1
[[c#]pf#]sf#: SF port representor/s, example: c1pf1sf[0-3]

c# is controller(host) ID/range in case of multi-host, optional.

For user application (e.g. OVS), PMD is responsible to interpret and
locate representor device based on controller ID, PF ID and VF/SF ID in
representor syntax.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
---
 config/rte_config.h                   |  1 +
 lib/librte_ethdev/ethdev_private.c    | 12 ++++++++++--
 lib/librte_ethdev/rte_ethdev_driver.h |  4 ++++
 3 files changed, 15 insertions(+), 2 deletions(-)
  

Comments

Andrew Rybchenko Jan. 19, 2021, 8:03 a.m. UTC | #1
On 1/19/21 10:14 AM, Xueming Li wrote:
> The NIC can have multiple PCIe links and can be attached to the multiple
> hosts, for example the same single NIC can be shared for multiple server
> units in the rack. On each PCIe link NIC can provide multiple PFs and
> VFs/SFs based on these ones. To provide the unambiguous identification
> of the PCIe function the controller index is added. The full representor
> identifier consists of three indices - controller index, PF index, and
> VF or SF index (if any).
> 
> This patch introduces controller index to ethdev representor syntax,
> examples:
> 
> [[c#]pf#]vf#: VF port representor/s, example: pf0vf1
> [[c#]pf#]sf#: SF port representor/s, example: c1pf1sf[0-3]
> 
> c# is controller(host) ID/range in case of multi-host, optional.
> 
> For user application (e.g. OVS), PMD is responsible to interpret and
> locate representor device based on controller ID, PF ID and VF/SF ID in
> representor syntax.
> 
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
> Acked-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  config/rte_config.h                   |  1 +
>  lib/librte_ethdev/ethdev_private.c    | 12 ++++++++++--
>  lib/librte_ethdev/rte_ethdev_driver.h |  4 ++++
>  3 files changed, 15 insertions(+), 2 deletions(-)
> 
> diff --git a/config/rte_config.h b/config/rte_config.h
> index a0b5160ff2..23d02d51ef 100644
> --- a/config/rte_config.h
> +++ b/config/rte_config.h
> @@ -58,6 +58,7 @@
>  #define RTE_MAX_QUEUES_PER_PORT 1024
>  #define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */
>  #define RTE_ETHDEV_RXTX_CALLBACKS 1
> +#define RTE_MAX_MULTI_HOST_CTRLS 4
>  
>  /* cryptodev defines */
>  #define RTE_CRYPTO_MAX_DEVS 64
> diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c
> index b9fdbd0f72..9a0945c22e 100644
> --- a/lib/librte_ethdev/ethdev_private.c
> +++ b/lib/librte_ethdev/ethdev_private.c
> @@ -120,8 +120,8 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,
>   *
>   * Representor format:
>   *   #: range or single number of VF representor - legacy
> - *   [pf#]vf#: VF port representor/s
> - *   [pf#]sf#: SF port representor/s
> + *   [[c#]pf#]vf#: VF port representor/s
> + *   [[c#]pf#]sf#: SF port representor/s
>   *
>   * Examples of #:
>   *  2               - single
> @@ -133,6 +133,14 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
>  {
>  	struct rte_eth_devargs *eth_da = data;
>  
> +	if (str[0] == 'c') {
> +		str += 1;
> +		str = rte_eth_devargs_process_list(str, eth_da->mh_controllers,
> +				&eth_da->nb_mh_controllers,
> +				RTE_DIM(eth_da->mh_controllers));
> +		if (str == NULL)
> +			goto err;

The parser must enforce pf to follow. I.e. should not allow
c1vf3. At least above syntax description in comments says so.

> +	}
>  	if (str[0] == 'p' && str[1] == 'f') {
>  		eth_da->type = RTE_ETH_REPRESENTOR_PF;
>  		str += 2;
> diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
> index cd33184f17..b01f118965 100644
> --- a/lib/librte_ethdev/rte_ethdev_driver.h
> +++ b/lib/librte_ethdev/rte_ethdev_driver.h
> @@ -1203,6 +1203,10 @@ enum rte_eth_representor_type {
>  
>  /** Generic Ethernet device arguments  */
>  struct rte_eth_devargs {
> +	uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
> +	/** controller/s number in case of multi-host */
> +	uint16_t nb_mh_controllers;
> +	/** number of controllers in multi-host controllers field */
>  	uint16_t ports[RTE_MAX_ETHPORTS];
>  	/** port/s number to enable on a multi-port single function */
>  	uint16_t nb_ports;
>
  
Xueming Li Jan. 19, 2021, 9:32 a.m. UTC | #2
>-----Original Message-----
>From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>Sent: Tuesday, January 19, 2021 4:03 PM
>To: Xueming(Steven) Li <xuemingl@nvidia.com>
>Cc: dev@dpdk.org; Slava Ovsiienko <viacheslavo@nvidia.com>; Asaf Penso
><asafp@nvidia.com>; Bruce Richardson <bruce.richardson@intel.com>; NBU-
>Contact-Thomas Monjalon <thomas@monjalon.net>; Ferruh Yigit
><ferruh.yigit@intel.com>
>Subject: Re: [PATCH v5 6/9] ethdev: support multi-host in representor
>
>On 1/19/21 10:14 AM, Xueming Li wrote:
>> The NIC can have multiple PCIe links and can be attached to the
>> multiple hosts, for example the same single NIC can be shared for
>> multiple server units in the rack. On each PCIe link NIC can provide
>> multiple PFs and VFs/SFs based on these ones. To provide the
>> unambiguous identification of the PCIe function the controller index
>> is added. The full representor identifier consists of three indices -
>> controller index, PF index, and VF or SF index (if any).
>>
>> This patch introduces controller index to ethdev representor syntax,
>> examples:
>>
>> [[c#]pf#]vf#: VF port representor/s, example: pf0vf1
>> [[c#]pf#]sf#: SF port representor/s, example: c1pf1sf[0-3]
>>
>> c# is controller(host) ID/range in case of multi-host, optional.
>>
>> For user application (e.g. OVS), PMD is responsible to interpret and
>> locate representor device based on controller ID, PF ID and VF/SF ID
>> in representor syntax.
>>
>> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
>> Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
>> Acked-by: Thomas Monjalon <thomas@monjalon.net>
>> ---
>>  config/rte_config.h                   |  1 +
>>  lib/librte_ethdev/ethdev_private.c    | 12 ++++++++++--
>>  lib/librte_ethdev/rte_ethdev_driver.h |  4 ++++
>>  3 files changed, 15 insertions(+), 2 deletions(-)
>>
>> diff --git a/config/rte_config.h b/config/rte_config.h index
>> a0b5160ff2..23d02d51ef 100644
>> --- a/config/rte_config.h
>> +++ b/config/rte_config.h
>> @@ -58,6 +58,7 @@
>>  #define RTE_MAX_QUEUES_PER_PORT 1024
>>  #define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */  #define
>> RTE_ETHDEV_RXTX_CALLBACKS 1
>> +#define RTE_MAX_MULTI_HOST_CTRLS 4
>>
>>  /* cryptodev defines */
>>  #define RTE_CRYPTO_MAX_DEVS 64
>> diff --git a/lib/librte_ethdev/ethdev_private.c
>> b/lib/librte_ethdev/ethdev_private.c
>> index b9fdbd0f72..9a0945c22e 100644
>> --- a/lib/librte_ethdev/ethdev_private.c
>> +++ b/lib/librte_ethdev/ethdev_private.c
>> @@ -120,8 +120,8 @@ rte_eth_devargs_process_list(char *str, uint16_t
>*list, uint16_t *len_list,
>>   *
>>   * Representor format:
>>   *   #: range or single number of VF representor - legacy
>> - *   [pf#]vf#: VF port representor/s
>> - *   [pf#]sf#: SF port representor/s
>> + *   [[c#]pf#]vf#: VF port representor/s
>> + *   [[c#]pf#]sf#: SF port representor/s
>>   *
>>   * Examples of #:
>>   *  2               - single
>> @@ -133,6 +133,14 @@ rte_eth_devargs_parse_representor_ports(char
>> *str, void *data)  {
>>  	struct rte_eth_devargs *eth_da = data;
>>
>> +	if (str[0] == 'c') {
>> +		str += 1;
>> +		str = rte_eth_devargs_process_list(str, eth_da-
>>mh_controllers,
>> +				&eth_da->nb_mh_controllers,
>> +				RTE_DIM(eth_da->mh_controllers));
>> +		if (str == NULL)
>> +			goto err;
>
>The parser must enforce pf to follow. I.e. should not allow c1vf3. At least
>above syntax description in comments says so.

Good catch, will add, thanks.
>
>> +	}
>>  	if (str[0] == 'p' && str[1] == 'f') {
>>  		eth_da->type = RTE_ETH_REPRESENTOR_PF;
>>  		str += 2;
>> diff --git a/lib/librte_ethdev/rte_ethdev_driver.h
>> b/lib/librte_ethdev/rte_ethdev_driver.h
>> index cd33184f17..b01f118965 100644
>> --- a/lib/librte_ethdev/rte_ethdev_driver.h
>> +++ b/lib/librte_ethdev/rte_ethdev_driver.h
>> @@ -1203,6 +1203,10 @@ enum rte_eth_representor_type {
>>
>>  /** Generic Ethernet device arguments  */  struct rte_eth_devargs {
>> +	uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
>> +	/** controller/s number in case of multi-host */
>> +	uint16_t nb_mh_controllers;
>> +	/** number of controllers in multi-host controllers field */
>>  	uint16_t ports[RTE_MAX_ETHPORTS];
>>  	/** port/s number to enable on a multi-port single function */
>>  	uint16_t nb_ports;
>>
  

Patch

diff --git a/config/rte_config.h b/config/rte_config.h
index a0b5160ff2..23d02d51ef 100644
--- a/config/rte_config.h
+++ b/config/rte_config.h
@@ -58,6 +58,7 @@ 
 #define RTE_MAX_QUEUES_PER_PORT 1024
 #define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */
 #define RTE_ETHDEV_RXTX_CALLBACKS 1
+#define RTE_MAX_MULTI_HOST_CTRLS 4
 
 /* cryptodev defines */
 #define RTE_CRYPTO_MAX_DEVS 64
diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c
index b9fdbd0f72..9a0945c22e 100644
--- a/lib/librte_ethdev/ethdev_private.c
+++ b/lib/librte_ethdev/ethdev_private.c
@@ -120,8 +120,8 @@  rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,
  *
  * Representor format:
  *   #: range or single number of VF representor - legacy
- *   [pf#]vf#: VF port representor/s
- *   [pf#]sf#: SF port representor/s
+ *   [[c#]pf#]vf#: VF port representor/s
+ *   [[c#]pf#]sf#: SF port representor/s
  *
  * Examples of #:
  *  2               - single
@@ -133,6 +133,14 @@  rte_eth_devargs_parse_representor_ports(char *str, void *data)
 {
 	struct rte_eth_devargs *eth_da = data;
 
+	if (str[0] == 'c') {
+		str += 1;
+		str = rte_eth_devargs_process_list(str, eth_da->mh_controllers,
+				&eth_da->nb_mh_controllers,
+				RTE_DIM(eth_da->mh_controllers));
+		if (str == NULL)
+			goto err;
+	}
 	if (str[0] == 'p' && str[1] == 'f') {
 		eth_da->type = RTE_ETH_REPRESENTOR_PF;
 		str += 2;
diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
index cd33184f17..b01f118965 100644
--- a/lib/librte_ethdev/rte_ethdev_driver.h
+++ b/lib/librte_ethdev/rte_ethdev_driver.h
@@ -1203,6 +1203,10 @@  enum rte_eth_representor_type {
 
 /** Generic Ethernet device arguments  */
 struct rte_eth_devargs {
+	uint16_t mh_controllers[RTE_MAX_MULTI_HOST_CTRLS];
+	/** controller/s number in case of multi-host */
+	uint16_t nb_mh_controllers;
+	/** number of controllers in multi-host controllers field */
 	uint16_t ports[RTE_MAX_ETHPORTS];
 	/** port/s number to enable on a multi-port single function */
 	uint16_t nb_ports;