support SubFunction representor
cover support SubFunction representor
SubFunction [1] is a portion of the PCI device, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.
From SmartNIC perspective, when PCI device is shared for multi-host, representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
For flexibility, this patch also introduces new netdev capability to indicate the capability to support new representor types.
[1]:
https://lore.kernel.org/netdev/[email protected]/
Xueming Li (7):
ethdev: support sub function representor
ethdev: support multi-host representor
devarg: change reprsentor ID to bitmap
ethdev: capability for new representor syntax
kvargs: update parser for new representor syntax common/mlx5: update representor name parsing net/mlx5: support representor of sub function
0000-cover-letter.patch | 44 ++++++ config/rte_config.h | 1 + drivers/common/mlx5/linux/mlx5_common_os.c | 32 ++-- drivers/common/mlx5/linux/mlx5_nl.c | 2 + drivers/common/mlx5/mlx5_common.h | 2 + drivers/net/mlx5/linux/mlx5_ethdev_os.c | 5 + drivers/net/mlx5/linux/mlx5_os.c | 69 ++++++++- drivers/net/mlx5/mlx5_ethdev.c | 2 + lib/librte_ethdev/ethdev_private.c | 164 ++++++++++++++------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 7 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev.h | 2 + lib/librte_ethdev/rte_ethdev_driver.h | 35 +++++ lib/librte_kvargs/rte_kvargs.c | 82 +++++++---- 15 files changed, 351 insertions(+), 104 deletions(-) create mode 100644 0000-cover-letter.patch
Signature · 1 line
2.25.1
RFC 1/7 ethdev: support sub function representor
To support SF representor, this patch enhances devargs syntax:
[pf#]vf#: new VF port representor/s, example: vf[0-3], pf0vf3 [pf#]sf#: new SF port representor/s, example: sf[0-3], pf1sf2
pf# is optional for SF and VF representor. If not present, representor is detected from PCI BDF of device argument. In case of bonding, pf# indicates owner PF device of SF or VF.
For backwards compatible, # default to vf#.
Enhances rte_eth_devargs_parse_representor_port() function to parse new representor syntax, replace rte_eth_devargs_parse_list() function which only parse simple list.
--- lib/librte_ethdev/ethdev_private.c | 115 ++++++++++++++------------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 7 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev_driver.h | 9 ++ 5 files changed, 77 insertions(+), 62 deletions(-)
lib/librte_ethdev/ethdev_private.c +64 -51
@@ -38,60 +38,13 @@ eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) -{ -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; - -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; - } -return 0 ; -} -static int rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str; result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) {
@@ -99,7 +52,7 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,return -ENOMEM ; list[(*len_list)++] = lo; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) +if (lo >= hi)return -EINVAL ;for (val = lo; val <= hi; val++) {if (*len_list >= max_list)
@@ -108,14 +61,74 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list, } }else return -EINVAL ; -return 0 ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' )) + pos++; +return pos - str; } +static int +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; +int ret; + +if (*pos =='[' ) + pos++; +while (1 ) { + ret =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (ret <0 ) +return ret; + pos += ret; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return -EINVAL ; +if (*pos ==']' ) + pos++; +return pos - str; +} + +/* +* representor format: +* #: range or single number of VF representor - legacy +* [pf#]vf#: VF port representor/s +* [pf#]sf#: SF port representor/s +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; +int ret; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, + eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* parse pf# */ +if (str[0 ] =='p' && str[1 ] =='f' ) { + str +=2 ; + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + ret =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS ); +if (ret <0 ) + goto err; + str += ret; + } +/* parse vf# and sf#, number # alone implies VF */ +if (str[0 ] =='v' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + str +=2 ; + }else if (str[0 ] =='s' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_SF ; + str +=2 ; + }else { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + } + ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err: +if (ret <0 ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s" , str); +return ret <0 ? ret :0 ; }
lib/librte_ethdev/ethdev_private.h +0 -3
@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus
lib/librte_ethdev/rte_class_eth.c +2 -5
@@ -66,7 +66,7 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; +struct rte_eth_devargs representors = {0 };uint16_t index;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )
@@ -76,10 +76,7 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */
lib/librte_ethdev/rte_ethdev.c +2 -3
@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }
lib/librte_ethdev/rte_ethdev_driver.h +9 -0
@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ +RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +RTE_ETH_REPRESENTOR_SF ,/* representor of SF */ +RTE_ETH_REPRESENTOR_PF ,/* representor of host PF */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];
@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [RFC 1/7] ethdev: support sub function representor
Quoted 9 lines · Xueming Li
To support SF representor, this patch enhances devargs syntax:
[pf#]vf#: new VF port representor/s, example: vf[0-3], pf0vf3 [pf#]sf#: new SF port representor/s, example: sf[0-3], pf1sf2
pf# is optional for SF and VF representor. If not present, representor is detected from PCI BDF of device argument. In case of bonding, pf# indicates owner PF device of SF or VF.
Quoted 5 lines
For backwards compatible, # default to vf#.
Enhances
rte_eth_devargs_parse_representor_port()function to parse new representor syntax, replacerte_eth_devargs_parse_list()function which only parse simple list.
Consider to split it into few patches:
1. rework infrastructure/functions, introduce enum, support old syntax only
2. add new syntax for VFs
3. add SubFunctions support, add enum member (don't forget to update existing drivers to reject if SF is requested)
4. add PFs support, add enum member (also don't forget to update existing drivers as well)
Quoted 129 lines
Signed-off-by Xueming Li <[email protected]>--- lib/librte_ethdev/ethdev_private.c | 115 ++++++++++++++------------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 7 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev_driver.h | 9 ++ 5 files changed, 77 insertions(+), 62 deletions(-)lib/librte_ethdev/ethdev_private.c +37
-50@@ -38,60 +38,13 @@ eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) -{ -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; - -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; - } -return 0 ; -} -static int rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str; result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) {@@ -99,7 +52,7 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,return -ENOMEM ; list[(*len_list)++] = lo; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) +if (lo >= hi)return -EINVAL ;for (val = lo; val <= hi; val++) {if (*len_list >= max_list)@@ -108,14 +61,74 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list, } }else return -EINVAL ; -return 0 ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' )) + pos++; +return pos - str; } +static int +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; +int ret; + +if (*pos =='[' ) + pos++; +while (1 ) { + ret =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (ret <0 ) +return ret; + pos += ret; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return -EINVAL ; +if (*pos ==']' ) + pos++; +return pos - str; +} + +/* +* representor format: +* #: range or single number of VF representor - legacy +* [pf#]vf#: VF port representor/s +* [pf#]sf#: SF port representor/s +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list, · line 111
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +6
-1{struct rte_eth_devargs *eth_da = data; +int ret; - return rte_eth_devargs_process_range(str, eth_da->representor_ports, + eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* parse pf# */ +if (str[0 ] =='p' && str[1 ] =='f' ) { + str +=2 ; + eth_da->type =RTE_ETH_REPRESENTOR_PF ;
Just to be consistent with similar lines below, please, swap these two lines.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list, · line 113
Quoted 2 lines
lib/librte_ethdev/ethdev_private.c +2
-0+ ret =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS );
I'm not sure that it matches ports and nb_ports fields purpose.
In any case it should update existing drivers which support representors to reject devargs with PFs specified.
Quoted 9 lines
lib/librte_ethdev/ethdev_private.c +9
-0+if (ret <0 ) + goto err; + str += ret; + } +/* parse vf# and sf#, number # alone implies VF */ +if (str[0 ] =='v' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + str +=2 ; + }else if (str[0 ] =='s' && str[1 ] =='f' ) {
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list, · line 132
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +9
-0+ eth_da->type =RTE_ETH_REPRESENTOR_SF ; + str +=2 ; + }else { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + } + ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err: +if (ret <0 ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s" , str);
Missing \n
Quoted 85 lines
lib/librte_ethdev/ethdev_private.c +1
-0+return ret <0 ? ret :0 ; }lib/librte_ethdev/ethdev_private.h +0
-3@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cpluspluslib/librte_ethdev/rte_class_eth.c +2
-5@@ -66,7 +66,7 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; +struct rte_eth_devargs representors = {0 };uint16_t index;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )@@ -76,10 +76,7 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ lib/librte_ethdev/rte_ethdev.c +2
-3@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }lib/librte_ethdev/rte_ethdev_driver.h +9
-0@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ +RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +RTE_ETH_REPRESENTOR_SF ,/* representor of SF */ +RTE_ETH_REPRESENTOR_PF ,/* representor of host PF */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/**
v2 cover support SubFunction representor
In reply to Xueming LiSubFunction [1] is a portion of the PCI device, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.
From SmartNIC perspective, when PCI device is shared for multi-host, representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
For backward compatibility, this patch also introduces new netdev capability
to indicate the capability to support SF representor.
Version history:
RFC:
initial version [2]
V2:
- separate patch for represnetor infrastructure, controller, pf and sf.
- replace representor ID macro with functions:
rte_eth_representor_id_encode() rte_eth_representor_id_parse()
- new patch to allow devargs with same PCI BDF but different representors.
- other minor code updates according to comments, thanks Andrew!
- update document
[1] SubFunction in kernel:
https://lore.kernel.org/netdev/[email protected]/
[2] RFC:
http://patchwork.dpdk.org/project/dpdk/list/?series=14376
Xueming Li (9):
ethdev: refactor representor infrastructure
ethdev: support new VF representor syntax
ethdev: support sub function representor
ethdev: support PF index in representor
ethdev: support multi-host representor
devarg: change reprsentor ID to bitmap
ethdev: capability of new representor syntax
kvargs: update parser for new representor syntax
eal: allow PCI device with different representors
config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 8 +- drivers/net/bnxt/bnxt_ethdev.c | 12 +++ drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_ethdev.c | 8 ++ drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++ drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 15 ++- lib/librte_eal/common/eal_common_bus.c | 25 +++++ lib/librte_ethdev/ethdev_private.c | 128 ++++++++++++++--------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++++-- lib/librte_ethdev/rte_ethdev.c | 31 +++++- lib/librte_ethdev/rte_ethdev.h | 2 + lib/librte_ethdev/rte_ethdev_driver.h | 64 ++++++++++++ lib/librte_ethdev/version.map | 2 + lib/librte_kvargs/rte_kvargs.c | 83 ++++++++++----- 20 files changed, 348 insertions(+), 101 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/9 ethdev: refactor representor infrastructure
To support extended representor syntax, this patch refactor represntor infrastructure:
1. introduces representor type enum
2. devargs representor port range extraction from partial value
--- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++ drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/i40e/i40e_ethdev.c | 8 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++ drivers/net/mlx5/linux/mlx5_os.c | 11 ++++ lib/librte_ethdev/ethdev_private.c | 93 ++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev_driver.h | 7 ++ 10 files changed, 98 insertions(+), 60 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +12 -0
@@ -5520,6 +5520,18 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -EINVAL ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
drivers/net/enic/enic_ethdev.c +7 -0
@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,
drivers/net/i40e/i40e_ethdev.c +8 -0
@@ -640,6 +640,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/ixgbe/ixgbe_ethdev.c +8 -0
@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/mlx5/linux/mlx5_os.c +11 -0
@@ -706,6 +706,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)
lib/librte_ethdev/ethdev_private.c +42 -51
123 lines not on this page · raw message
lib/librte_ethdev/ethdev_private.h +0 -3
@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus
lib/librte_ethdev/rte_class_eth.c +1 -3
@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */
lib/librte_ethdev/rte_ethdev.c +2 -3
@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }
lib/librte_ethdev/rte_ethdev_driver.h +7 -0
@@ -1193,6 +1193,12 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ +RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];
@@ -1203,6 +1209,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v2 1/9] ethdev: refactor representor infrastructure
Quoted 2 lines · Xueming Li
To support extended representor syntax, this patch refactor represntor
Typo in 'representor'
Quoted 24 lines
infrastructure:
1. introduces representor type enum
2. devargs representor port range extraction from partial valueSigned-off-by Xueming Li <[email protected]>--- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++ drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/i40e/i40e_ethdev.c | 8 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++ drivers/net/mlx5/linux/mlx5_os.c | 11 ++++ lib/librte_ethdev/ethdev_private.c | 93 ++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev_driver.h | 7 ++ 10 files changed, 98 insertions(+), 60 deletions(-)drivers/net/bnxt/bnxt_ethdev.c +0
-0@@ -5520,6 +5520,18 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;
drivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev, · line 5530
Quoted 10 lines
drivers/net/bnxt/bnxt_ethdev.c +8
-0struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) {
Seems like an extra 'if ' condition by mistake? Otherwise there is no diff b/n this 'if' condition and the one few lines above?
Quoted 288 lines
drivers/net/bnxt/bnxt_ethdev.c +4
-0+PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -EINVAL ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",drivers/net/enic/enic_ethdev.c +7
-0@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,drivers/net/i40e/i40e_ethdev.c +8
-0@@ -640,6 +640,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,drivers/net/ixgbe/ixgbe_ethdev.c +8
-0@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,drivers/net/mlx5/linux/mlx5_os.c +11
-0@@ -706,6 +706,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)lib/librte_ethdev/ethdev_private.c +42
-51@@ -38,60 +38,13 @@ eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) -{ -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; - -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; - } -return 0 ; -} -static int rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str; result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) {@@ -99,7 +52,7 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,return -ENOMEM ; list[(*len_list)++] = lo; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) +if (lo >= hi)return -EINVAL ;for (val = lo; val <= hi; val++) {if (*len_list >= max_list)@@ -108,14 +61,52 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list, } }else return -EINVAL ; -return 0 ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' )) + pos++; +return pos - str; } +static int +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; +int ret; + +if (*pos =='[' ) + pos++; +while (1 ) { + ret =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (ret <0 ) +return ret; + pos += ret; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return -EINVAL ; +if (*pos ==']' ) + pos++; +return pos - str; +} + +/* +* representor format: +* #: range or single number of VF representor - legacy +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; +int ret; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, +/* Number # alone implies VF */ + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +if (ret <0 ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return ret <0 ? ret :0 ; }lib/librte_ethdev/ethdev_private.h +0
-3@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cpluspluslib/librte_ethdev/rte_class_eth.c +1
-3@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ lib/librte_ethdev/rte_ethdev.c +2
-3@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }lib/librte_ethdev/rte_ethdev_driver.h +7
-1@@ -1193,6 +1193,12 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ +RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1209,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/** -- 2.25.1
Signature · 11 lines
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.
Re: [dpdk-dev] [PATCH v2 1/9] ethdev: refactor representor infrastructure
Quoted 54 lines
-----Original Message-----
From: Somnath Kotur <[email protected]>
Sent: Thursday, January 7, 2021 2:32 PM
To: Xueming(Steven) Li <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Olivier Matz <[email protected]>; Slava Ovsiienko <[email protected]>; dev <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/9] ethdev: refactor representor infrastructureQuoted 2 lines · Xueming Li
To support extended representor syntax, this patch refactor represntor
Typo in 'representor'
Quoted 18 lines
infrastructure:
1. introduces representor type enum
2. devargs representor port range extraction from partial valueSigned-off-by Xueming Li <[email protected]>--- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++ drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/i40e/i40e_ethdev.c | 8 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++ drivers/net/mlx5/linux/mlx5_os.c | 11 ++++ lib/librte_ethdev/ethdev_private.c | 93 ++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev_driver.h | 7 ++ 10 files changed, 98 insertions(+), 60 deletions(-)Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/net/bnxt/bnxt_ethdev.cdrivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct
Quoted 4 lines
index
81c8f8d79d..844a6c3c66100644drivers/net/bnxt/bnxt_ethdev.c +0
-0@@ -5520,6 +5520,18 @@ static int bnxt_rep_port_probe(struct
rte_pci_device*pci_dev,drivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev, · line 5530
Quoted 11 lines
drivers/net/bnxt/bnxt_ethdev.c +8
-0int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) {
Quoted 2 lines
Seems like an extra 'if ' condition by mistake? Otherwise there is no diff b/n this 'if' condition and the one few lines above?
Thanks, good catch!
Quoted 317 lines
drivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,
Quoted 7 lines
drivers/net/bnxt/bnxt_ethdev.c +4
-0+PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -EINVAL ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VFREPS\n",
drivers/net/enic/enic_ethdev.c static int eth_enic_pci_probe(struct
Quoted 5 lines
drivers/net/enic/enic_ethdev.c +0
-0@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct
rte_pci_driver*pci_drv__rte_unused,drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv
Quoted 18 lines
drivers/net/enic/enic_ethdev.c +7
-0if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,drivers/net/i40e/i40e_ethdev.c +0
-0@@ -640,6 +640,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv
__rte_unused,Review
Quoted 15 lines
drivers/net/i40e/i40e_ethdev.c +8
-0return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_ethdev.cdrivers/net/ixgbe/ixgbe_ethdev.c eth_ixgbe_pci_probe(struct rte_pci_driver
Quoted 4 lines
index
9a47a8b262..9ea0139197100644drivers/net/ixgbe/ixgbe_ethdev.c +0
-0@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver
*pci_drv__rte_unused,Review
Quoted 15 lines
drivers/net/ixgbe/ixgbe_ethdev.c +8
-0}else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,(quoted diff) +0
-0
b/drivers/net/mlx5/linux/mlx5_os.cReview
Quoted 22 lines
index
6812a1f215..6981ba1f41100644drivers/net/mlx5/linux/mlx5_os.c +11
-0@@ -706,6 +706,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)(quoted diff) +0
-0
b/lib/librte_ethdev/ethdev_private.clib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start,
Quoted 4 lines
index
162a502fe7..c219164a4a100644lib/librte_ethdev/ethdev_private.c +0
-0@@ -38,60 +38,13 @@ eth_find_device(const struct rte_eth_dev *start,
rte_eth_cmp_tcmp,lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_range(char *str, uint16_t
Quoted 62 lines
lib/librte_ethdev/ethdev_private.c +1
-48return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) -{ -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; - -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; - } -return 0 ; -} -static int rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str; result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) {@@ -99,7 +52,7 @@ rte_eth_devargs_process_range(char *str, uint16_t*list,
uint16_t*len_list,lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_range(char *str, uint16_t
Quoted 9 lines
lib/librte_ethdev/ethdev_private.c +1
-1return -ENOMEM ; list[(*len_list)++] = lo; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) +if (lo >= hi)return -EINVAL ;for (val = lo; val <= hi; val++) {if (*len_list >= max_list)@@ -108,14 +61,52 @@ rte_eth_devargs_process_range(char *str, uint16_t*list,
uint16_t*len_list,Review
Quoted 55 lines
lib/librte_ethdev/ethdev_private.c +40
-2} }else return -EINVAL ; -return 0 ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' )) + pos++; +return pos - str; } +static int +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; +int ret; + +if (*pos =='[' ) + pos++; +while (1 ) { + ret =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (ret <0 ) +return ret; + pos += ret; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return -EINVAL ; +if (*pos ==']' ) + pos++; +return pos - str; +} + +/* +* representor format: +* #: range or single number of VF representor - legacy +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; +int ret; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, +/* Number # alone implies VF */ + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +if (ret <0 ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return ret <0 ? ret :0 ; }(quoted diff) +0
-0
b/lib/librte_ethdev/ethdev_private.hlib/librte_ethdev/ethdev_private.h eth_find_device(const struct rte_eth_dev *_start,
Quoted 4 lines
index
905a45c337..220ddd4408100644lib/librte_ethdev/ethdev_private.h +0
-0@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start,
rte_eth_cmp_tcmp,lib/librte_ethdev/ethdev_private.h eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp,
Quoted 5 lines
lib/librte_ethdev/ethdev_private.h +0
-2const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list(char *str, rte_eth_devargs_callback_tcallback,
Review
Quoted 5 lines
lib/librte_ethdev/ethdev_private.h +0
-1- void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus(quoted diff) +0
-0
b/lib/librte_ethdev/rte_class_eth.clib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct
Quoted 19 lines
index
6338355e25..efe6149df5100644lib/librte_ethdev/rte_class_eth.c +1
-3@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ lib/librte_ethdev/rte_ethdev.c +0
-0@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct
rte_eth_devargs*eth_da)Review
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +2
-3for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev_driver.hQuoted 25 lines
index
0eacfd8425..b66a955b18100644lib/librte_ethdev/rte_ethdev_driver.h +7
-1@@ -1193,6 +1193,12 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ +RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1209,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/** -- Quoted 2 lines
2.25.1
--
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.
Re: [dpdk-dev] [PATCH v2 1/9] ethdev: refactor representor infrastructure
Quoted 15 lines · Xueming(Steven) Li
Quoted 15 lines
-----Original Message-----
From: Somnath Kotur <[email protected]>
Sent: Thursday, January 7, 2021 2:32 PM
To: Xueming(Steven) Li <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Olivier Matz <[email protected]>; Slava Ovsiienko <[email protected]>; dev <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v2 1/9] ethdev: refactor representor infrastructure
Quoted 3 lines
Quoted 3 lines · Xueming Li
Quoted 2 lines
To support extended representor syntax, this patch refactor represntor
Please fix this Typo in 'representor' as well ...Thanks
Quoted 358 lines
Quoted 36 lines
Quoted 18 lines
infrastructure:
1. introduces representor type enum
2. devargs representor port range extraction from partial valueSigned-off-by Xueming Li <[email protected]>--- drivers/net/bnxt/bnxt_ethdev.c | 12 ++++ drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/i40e/i40e_ethdev.c | 8 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++ drivers/net/mlx5/linux/mlx5_os.c | 11 ++++ lib/librte_ethdev/ethdev_private.c | 93 ++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev_driver.h | 7 ++ 10 files changed, 98 insertions(+), 60 deletions(-)Review
Quoted 1 line
(quoted diff) +0
-0
b/drivers/net/bnxt/bnxt_ethdev.cdrivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct
Quoted 4 lines
index
81c8f8d79d..844a6c3c66100644drivers/net/bnxt/bnxt_ethdev.c +0
-0@@ -5520,6 +5520,18 @@ static int bnxt_rep_port_probe(struct
rte_pci_device*pci_dev,drivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev, · line 5530
Quoted 11 lines
drivers/net/bnxt/bnxt_ethdev.c +8
-0int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) {Quoted 2 lines
Seems like an extra 'if ' condition by mistake? Otherwise there is no diff b/n this 'if' condition and the one few lines above?
Thanks, good catch!
Quoted 317 lines
drivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,
Quoted 7 lines
drivers/net/bnxt/bnxt_ethdev.c +4
-0+PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -EINVAL ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VFREPS\n",
drivers/net/enic/enic_ethdev.c static int eth_enic_pci_probe(struct
Quoted 5 lines
drivers/net/enic/enic_ethdev.c +0
-0@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct
rte_pci_driver*pci_drv__rte_unused,drivers/net/i40e/i40e_ethdev.c eth_i40e_pci_probe(struct rte_pci_driver *pci_drv
Quoted 18 lines
drivers/net/enic/enic_ethdev.c +7
-0if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,drivers/net/i40e/i40e_ethdev.c +0
-0@@ -640,6 +640,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv
__rte_unused,Review
Quoted 15 lines
drivers/net/i40e/i40e_ethdev.c +8
-0return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_ethdev.cdrivers/net/ixgbe/ixgbe_ethdev.c eth_ixgbe_pci_probe(struct rte_pci_driver
Quoted 4 lines
index
9a47a8b262..9ea0139197100644drivers/net/ixgbe/ixgbe_ethdev.c +0
-0@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver
*pci_drv__rte_unused,Review
Quoted 15 lines
drivers/net/ixgbe/ixgbe_ethdev.c +8
-0}else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,(quoted diff) +0
-0
b/drivers/net/mlx5/linux/mlx5_os.cReview
Quoted 22 lines
index
6812a1f215..6981ba1f41100644drivers/net/mlx5/linux/mlx5_os.c +11
-0@@ -706,6 +706,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)(quoted diff) +0
-0
b/lib/librte_ethdev/ethdev_private.clib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start,
Quoted 4 lines
index
162a502fe7..c219164a4a100644lib/librte_ethdev/ethdev_private.c +0
-0@@ -38,60 +38,13 @@ eth_find_device(const struct rte_eth_dev *start,
rte_eth_cmp_tcmp,lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_range(char *str, uint16_t
Quoted 62 lines
lib/librte_ethdev/ethdev_private.c +1
-48return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) -{ -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; - -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; - } -return 0 ; -} -static int rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str; result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) {@@ -99,7 +52,7 @@ rte_eth_devargs_process_range(char *str, uint16_t*list,
uint16_t*len_list,lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_range(char *str, uint16_t
Quoted 9 lines
lib/librte_ethdev/ethdev_private.c +1
-1return -ENOMEM ; list[(*len_list)++] = lo; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) +if (lo >= hi)return -EINVAL ;for (val = lo; val <= hi; val++) {if (*len_list >= max_list)@@ -108,14 +61,52 @@ rte_eth_devargs_process_range(char *str, uint16_t*list,
uint16_t*len_list,Review
Quoted 55 lines
lib/librte_ethdev/ethdev_private.c +40
-2} }else return -EINVAL ; -return 0 ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' )) + pos++; +return pos - str; } +static int +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; +int ret; + +if (*pos =='[' ) + pos++; +while (1 ) { + ret =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (ret <0 ) +return ret; + pos += ret; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return -EINVAL ; +if (*pos ==']' ) + pos++; +return pos - str; +} + +/* +* representor format: +* #: range or single number of VF representor - legacy +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; +int ret; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, +/* Number # alone implies VF */ + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +if (ret <0 ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return ret <0 ? ret :0 ; }(quoted diff) +0
-0
b/lib/librte_ethdev/ethdev_private.hlib/librte_ethdev/ethdev_private.h eth_find_device(const struct rte_eth_dev *_start,
Quoted 4 lines
index
905a45c337..220ddd4408100644lib/librte_ethdev/ethdev_private.h +0
-0@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start,
rte_eth_cmp_tcmp,lib/librte_ethdev/ethdev_private.h eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp,
Quoted 5 lines
lib/librte_ethdev/ethdev_private.h +0
-2const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list(char *str, rte_eth_devargs_callback_tcallback,
Review
Quoted 5 lines
lib/librte_ethdev/ethdev_private.h +0
-1- void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus(quoted diff) +0
-0
b/lib/librte_ethdev/rte_class_eth.clib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct
Quoted 19 lines
index
6338355e25..efe6149df5100644lib/librte_ethdev/rte_class_eth.c +1
-3@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ lib/librte_ethdev/rte_ethdev.c +0
-0@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct
rte_eth_devargs*eth_da)Review
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +2
-3for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev_driver.hQuoted 25 lines
index
0eacfd8425..b66a955b18100644lib/librte_ethdev/rte_ethdev_driver.h +7
-1@@ -1193,6 +1193,12 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ +RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1209,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/** -- Quoted 2 lines
2.25.1
--
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.
Signature · 11 lines
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it.
PATCH v2 2/9 ethdev: support new VF representor syntax
In reply to Xueming LiTo prepare for more representor types, this patch adds compatible VF representor devargs syntax:
vf#: new VF port representor/s, example: vf[0-3], vf2
For backwards compatibility, representor "#" is deemed as "vf#".
--- doc/guides/prog_guide/poll_mode_drv.rst | 6 +++--- lib/librte_ethdev/ethdev_private.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +3 -3
@@ -374,9 +374,9 @@ parameters to those ports. this argument allows user to specify which switch ports to enable port representors for.:: - -a DBDF,representor=0 - -a DBDF,representor=[0,4,6,9] - -a DBDF,representor=[0-31] + -a DBDF,representor=vf0 + -a DBDF,representor=vf[0,4,6,9] + -a DBDF,representor=vf[0-31] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -95,6 +95,7 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,/* * representor format: * #: range or single number of VF representor - legacy +* vf#: VF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -102,8 +103,10 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data;int ret; -/* Number # alone implies VF */ +/* Parse vf# or number # alone implies VF */ eth_da->type =RTE_ETH_REPRESENTOR_VF ; +if (str[0 ] =='v' && str[1 ] =='f' ) + str +=2 ; ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (ret <0 )
Signature · 1 line
2.25.1
PATCH v2 3/9 ethdev: support sub function representor
In reply to Xueming LiSubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.
To support SF representor, this patch introduces new devargs syntax:
sf#: new SF port representor/s, example: sf[0-3], sf2
--- doc/guides/prog_guide/poll_mode_drv.rst | 1 + lib/librte_ethdev/ethdev_private.c | 14 +++++++++++--- lib/librte_ethdev/rte_ethdev_driver.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +1 -0
@@ -377,6 +377,7 @@ parameters to those ports. -a DBDF,representor=vf0 -a DBDF,representor=vf[0,4,6,9] -a DBDF,representor=vf[0-31] + -a DBDF,representor=sf[0-1023] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +11 -3
@@ -96,6 +96,7 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,* representor format: * #: range or single number of VF representor - legacy * vf#: VF port representor/s +* sf#: SF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -103,10 +104,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data;int ret; -/* Parse vf# or number # alone implies VF */ - eth_da->type =RTE_ETH_REPRESENTOR_VF ; -if (str[0 ] =='v' && str[1 ] =='f' ) + eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* Parse vf# and sf#, number # alone implies VF */ +if (str[0 ] =='v' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ; + }else if (str[0 ] =='s' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_SF ; + str +=2 ; + }else { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + } ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (ret <0 )
lib/librte_ethdev/rte_ethdev_driver.h +1 -0
@@ -1197,6 +1197,7 @@ rte_eth_switch_domain_free(uint16_t domain_id);enum rte_eth_representor_type {RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +RTE_ETH_REPRESENTOR_SF ,/* representor of SF */ };/** Generic Ethernet device arguments */
Signature · 1 line
2.25.1
PATCH v2 4/9 ethdev: support PF index in representor
In reply to Xueming LiTo support representor in bonding, this patch introduces 'pf' section to representor devargs syntax:
[pf#]vf#: VF port representor/s, example: vf3, pf0vf3 [pf#]sf#: SF port representor/s, example: sf2, pf1sf2
pf# is optional for SF and VF representor, indicates owner PF device of SF or VF.
--- doc/guides/prog_guide/poll_mode_drv.rst | 1 + lib/librte_ethdev/ethdev_private.c | 15 +++++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +1 -0
@@ -378,6 +378,7 @@ parameters to those ports. -a DBDF,representor=vf[0,4,6,9] -a DBDF,representor=vf[0-31] -a DBDF,representor=sf[0-1023] + -a DBDF,representor=pf[0-1]sf[0-1023] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +13 -2
@@ -95,8 +95,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 -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [pf#]sf#: SF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -105,6 +105,16 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)int ret; eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* Parse pf# */ +if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + ret =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS ); +if (ret <0 ) + goto err; + str += ret; + }/* Parse vf# and sf#, number # alone implies VF */ if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ;
@@ -117,6 +127,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) } ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (ret <0 )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return ret <0 ? ret :0 ;
lib/librte_ethdev/rte_ethdev_driver.h +1 -0
@@ -1198,6 +1198,7 @@ enum rte_eth_representor_type {RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ RTE_ETH_REPRESENTOR_SF ,/* representor of SF */ + RTE_ETH_REPRESENTOR_PF, /* representor of host PF */ };/** Generic Ethernet device arguments */
Signature · 1 line
2.25.1
PATCH v2 5/9 ethdev: support multi-host representor
In reply to Xueming LiThis patch introduces multi-host controller for 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. It is mostly for SmartNIC attached to multiple hosts in the same rack to allow routing the packets between PF/SF/VF running on these hosts.
Controller ID is physical host ID in multi-host, for end-user (e.g. OVS) it is transparent as part of representor syntax, sam as representor ID, interpreted by PMD.
--- config/rte_config.h | 1 + lib/librte_ethdev/ethdev_private.c | 14 ++++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 4 ++++ 3 files changed, 17 insertions(+), 2 deletions(-)
config/rte_config.h +1 -0
@@ -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
lib/librte_ethdev/ethdev_private.c +12 -2
@@ -95,8 +95,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 */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -105,6 +105,16 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)int ret; eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* Parse c# */ +if (str[0 ] =='c' ) { + str +=1 ; + ret =rte_eth_devargs_process_list (str, eth_da->mh_controllers, + ð_da->nb_mh_controllers, +RTE_DIM (eth_da->mh_controllers)); +if (ret <0 ) + goto err; + str += ret; + }/* Parse pf# */ if (str[0 ] =='p' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_PF ;
lib/librte_ethdev/rte_ethdev_driver.h +4 -0
@@ -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;
Signature · 1 line
2.25.1
PATCH v2 6/9 devarg: change reprsentor ID to bitmap
In reply to Xueming LiIn eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller(host) and owner port information, callback only compared representor port and returned representor port on other PF port.
This patch changes representor port to bitmap encoding, expands and updates representor port ID after parsing, when device representor ID uses the same bitmap encoding, the eth representor comparer callback returns correct ethdev.
Representor port ID bitmap definition:
Representor ID bitmap:
xxxx xxxx xxxx xxxx
|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf id
LL controller(host) id
--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/ethdev_private.c | 5 ++- lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 51 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 10 files changed, 124 insertions(+), 14 deletions(-)
drivers/net/bnxt/bnxt_reps.c +2 -1
@@ -186,7 +186,8 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params) eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = rep_params->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , rep_params->vf_id);rte_eth_random_addr (vf_rep_bp->dflt_mac_addr); memcpy(vf_rep_bp->mac_addr, vf_rep_bp->dflt_mac_addr,
drivers/net/enic/enic_vf_representor.c +2 -1
@@ -674,7 +674,8 @@ int enic_vf_representor_init(struct rte_eth_dev *eth_dev, void *init_params) eth_dev->dev_ops = &enic_vf_representor_dev_ops; eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = vf->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , vf->vf_id); eth_dev->data->mac_addrs =rte_zmalloc ("enic_mac_addr_vf" ,sizeof (struct rte_ether_addr ) *ENIC_UNICAST_PERFECT_FILTERS ,0 );
drivers/net/i40e/i40e_vf_representor.c +2 -1
@@ -510,7 +510,8 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Setting the number queues allocated to the VF */ ethdev->data->nb_rx_queues = vf->vsi->nb_qps;
drivers/net/ixgbe/ixgbe_vf_representor.c +2 -1
@@ -196,7 +196,8 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)return -ENODEV ; ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Set representor device ops */ ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;
drivers/net/mlx5/linux/mlx5_os.c +3 -1
@@ -1031,7 +1031,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,#endif /* representor_id field keeps the unmodified VF index. */ priv->representor_id = switch_info->representor ? - switch_info->port_name :-1 ; +rte_eth_representor_id_encode (0 ,0 ,RTE_ETH_REPRESENTOR_VF , + switch_info->port_name) : +-1 ;/* * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -93,10 +93,13 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list, }/* -* representor format: +* Parse representor ports, expand and update representor port ID. +* Representor format: * #: range or single number of VF representor - legacy * [[c#]pf#]vf#: VF port representor/s * [[c#]pf#]sf#: SF port representor/s +* +* See RTE_ETH_REPR() for representor ID format. */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
lib/librte_ethdev/rte_class_eth.c +30 -8
@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +76,39 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_representor_ports (values, &representors); +memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }
lib/librte_ethdev/rte_ethdev.c +26 -0
@@ -5556,6 +5556,32 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{ +if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,
lib/librte_ethdev/rte_ethdev_driver.h +51 -0
57 lines not on this page · raw message
lib/librte_ethdev/version.map +2 -0
@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse; rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind;
Signature · 1 line
2.25.1
PATCH v2 7/9 ethdev: capability of new representor syntax
In reply to Xueming LiNew representor devargs syntax can't be recognized correctly by previous DPDK version. For application to adapt different DPDK version automatically, this patch introduces new eth device capability of supportting SubFunction representor device.
--- lib/librte_ethdev/rte_ethdev.h | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1432,6 +1432,8 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001/** Device supports Tx queue setup after device started. */ #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 +/**< Device supports SubFunction representor. */ +#define RTE_ETH_DEV_CAPA_REPRESENTOR_SF 0x00000004/**@}*/ /*
Signature · 1 line
2.25.1
PATCH v2 8/9 kvargs: update parser for new representor syntax
In reply to Xueming LiThis patch updates kvargs parser to allow comma in list value:
k1=a[1,2]b[3-5]
--- lib/librte_kvargs/rte_kvargs.c | 83 +++++++++++++++++++++++----------- 1 file changed, 57 insertions(+), 26 deletions(-)
lib/librte_kvargs/rte_kvargs.c +57 -26
@@ -5,6 +5,7 @@#include <string.h> #include <stdlib.h> +#include <stdbool.h> #include <rte_string_fns.h>
@@ -13,15 +14,19 @@/* * Receive a string with a list of arguments following the pattern * key=value,key=value,... and insert them into the list. -* strtok() is used so the params string will be copied to be modified. +* Params string will be copied to be modified. +* list "[]" and list element splitter ",", "-" is treated as value. +* Supported examples: +* k1=v1,k2=v2 +* v1 +* k1=x[0-1]y[1,3-5,9]z */ static int rte_kvargs_tokenize (struct rte_kvargs *kvlist,const char *params) {unsigned i; -char *str; -char *ctx1 =NULL ; -char *ctx2 =NULL ; +char *str, *start; +bool in_list = false, end_k = false, end_v = false;/* Copy the const char *params to a modifiable string * to pass to rte_strsplit
@@ -32,36 +37,62 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params)/* browse each key/value pair and add it in kvlist */ str = kvlist->str; -while ((str =strtok_r (str,RTE_KVARGS_PAIRS_DELIM , &ctx1)) !=NULL ) { + start = str;/* start of current key or value */ +while (1 ) { +switch (*str) { +case '=' :/* End of key. */ + end_k = true; +break ; +case ',' : +/* End of value, skip comma in middle of range */ +if (!in_list) + end_v = true; +break ; +case '[' :/* Start of list. */ + in_list = true; +break ; +case ']' :/* End of list. */ +if (in_list) + in_list = false; +break ; +case 0 :/* End of string */ + end_v = true; +break ; +default : +break ; + } + +if (!end_k && !end_v) { +/* Continue if not end of key or value. */ + str++; +continue ; + } i = kvlist->count;if (i >=RTE_KVARGS_MAX )return -1 ; - kvlist->pairs[i].key =strtok_r (str,RTE_KVARGS_KV_DELIM , &ctx2); - kvlist->pairs[i].value =strtok_r (NULL ,RTE_KVARGS_KV_DELIM , &ctx2); -if (kvlist->pairs[i].key ==NULL || - kvlist->pairs[i].value ==NULL ) -return -1 ; - -/* Detect list [a,b] to skip comma delimiter in list. */ - str = kvlist->pairs[i].value; -if (str[0 ] =='[' ) { -/* Find the end of the list. */ -while (str[strlen (str) -1 ] !=']' ) { -/* Restore the comma erased by strtok_r(). */ -if (ctx1 ==NULL || ctx1[0 ] =='\0' ) -return -1 ;/* no closing bracket */ - str[strlen (str)] =',' ; -/* Parse until next comma. */ - str =strtok_r (NULL ,RTE_KVARGS_PAIRS_DELIM , &ctx1); -if (str ==NULL ) -return -1 ;/* no closing bracket */ +if (start == str)/* Empty key or value. */ + start =NULL ; + +if (end_k) { +/* Key parsed. */ + kvlist->pairs[i].key = start; + end_k = false; + }else if (end_v) { +/* Allow single key or single value. */ +if (kvlist->pairs[i].key || start) { + kvlist->pairs[i].value = start; + kvlist->count++; } + end_v = false; } - kvlist->count++; - str =NULL ; +if (*str =='\0' )/* End of string. */ +break ; + *str ='\0' ; + str++; + start = str; }return 0 ;
Signature · 1 line
2.25.1
PATCH v2 9/9 eal: allow PCI device with different representors
In reply to Xueming LiWhen probing same PCI device with different representor arguments, PCI bus on probed first devargs, ignored other allowed devices with different representor arguments.
This patch iterates all devargs and try them all after PCI bus scan.
--- lib/librte_eal/common/eal_common_bus.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
lib/librte_eal/common/eal_common_bus.c +25 -0
@@ -10,6 +10,7 @@#include <rte_debug.h> #include <rte_string_fns.h> #include <rte_errno.h> +#include <rte_devargs.h> #include "eal_private.h"
@@ -56,12 +57,22 @@ rte_bus_scan(void)return 0 ; } +static int +cmp_dev_name (const struct rte_device *dev,const void *_name) +{ +const char *name = _name; + +return strcmp (dev->name, name); +} +/* Probe all devices of all buses */ int rte_bus_probe (void ) {int ret;struct rte_bus *bus, *vbus =NULL ; +struct rte_devargs *da; +struct rte_device *dev; TAILQ_FOREACH(bus, &rte_bus_list, next) {if (!strcmp (bus->name,"vdev" )) {
@@ -82,6 +93,20 @@ rte_bus_probe(void) vbus->name); } +/* For devargs with same name but different arguments, try them all. */ + RTE_EAL_DEVARGS_FOREACH("pci", da) { + dev = da->bus->find_device (NULL , cmp_dev_name, da->name); +if (!dev || !rte_dev_is_probed (dev) || dev->devargs == da) +continue ; + dev->devargs = da; + ret = dev->bus->plug (dev); +if (ret >0 ) + ret = -ENOTSUP ; +if (!ret &&rte_dev_is_probed (dev)) +RTE_LOG (ERR ,EAL ,"device probed %s %s" , da->name, + da->args); + } +return 0 ; }
Signature · 1 line
2.25.1
v2 cover net/mlx5: support SubFunction representor
In reply to Xueming LiSubFunction [1] is a portion of the PCI device, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.
This patch set introduces SubFunction representor support for mlx5 PMD driver.
Depends-on: series-14559 ("support SubFunction representor")
Version history:
RFC:
initial version [2]
V2:
- support bonding representor probe with new pf#vf# devargs
- adapt EAL api V2 [3] changes
- update document
[1] SubFunction in kernel:
https://lore.kernel.org/netdev/[email protected]/
[2] RFC:
http://patchwork.dpdk.org/project/dpdk/list/?series=14376
[3] EAL part to support SF representor:
http://patchwork.dpdk.org/project/dpdk/list/?series=14559
Xueming Li (4):
common/mlx5: update representor name parsing net/mlx5: support representor of sub function net/mlx5: revert setting representor to first PF net/mlx5: improve bonding representor probe
doc/guides/nics/mlx5.rst | 62 +++++- drivers/common/mlx5/linux/mlx5_common_os.c | 32 ++- drivers/common/mlx5/linux/mlx5_nl.c | 2 + drivers/common/mlx5/mlx5_common.h | 2 + drivers/net/mlx5/linux/mlx5_ethdev_os.c | 5 + drivers/net/mlx5/linux/mlx5_os.c | 215 ++++++++++++++------- drivers/net/mlx5/mlx5.c | 23 ++- drivers/net/mlx5/mlx5.h | 4 +- drivers/net/mlx5/mlx5_defs.h | 4 - drivers/net/mlx5/mlx5_ethdev.c | 29 +-- drivers/net/mlx5/mlx5_mac.c | 8 +- 11 files changed, 261 insertions(+), 125 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/4 common/mlx5: update representor name parsing
This patch updates representor name parsing for SF.
In sysfs, representor name stored in from 'phys_port_name file', similar to VF representor, switch port name of SF representor is "pf<x>sf<y>".
For netlink message, net SF type is supported.
Examples:
pf0sf1
pf0sf[0-3]
--- drivers/common/mlx5/linux/mlx5_common_os.c | 32 +++++++++++++++------- drivers/common/mlx5/linux/mlx5_nl.c | 2 ++ drivers/common/mlx5/mlx5_common.h | 2 ++ drivers/net/mlx5/linux/mlx5_ethdev_os.c | 3 ++ 4 files changed, 29 insertions(+), 10 deletions(-)
drivers/common/mlx5/linux/mlx5_common_os.c +22 -10
@@ -97,22 +97,34 @@ void mlx5_translate_port_name(const char *port_name_in, struct mlx5_switch_info *port_info_out) { - char pf_c1, pf_c2, vf_c1, vf_c2, eol; + char ctrl = 0, pf_c1, pf_c2, vf_c1, vf_c2, eol;char *end;int sc_items; -/* -* Check for port-name as a string of the form pf0vf0 -* (support kernel ver >= 5.0 or OFED ver >= 4.6). -*/ + sc_items =sscanf (port_name_in,"%c%d" , + &ctrl, &port_info_out->ctrl_num); +if (sc_items ==2 && ctrl =='c' ) { + port_name_in++;/* 'c' */ + port_name_in +=snprintf (NULL ,0 ,"%d" , + port_info_out->ctrl_num); + } +/* Check for port-name as a string of the form pf0vf0 or pf0sf0 */ sc_items =sscanf (port_name_in,"%c%c%d%c%c%d%c" , &pf_c1, &pf_c2, &port_info_out->pf_num, &vf_c1, &vf_c2, &port_info_out->port_name, &eol); -if (sc_items ==6 && - pf_c1 =='p' && pf_c2 =='f' && - vf_c1 =='v' && vf_c2 =='f' ) { - port_info_out->name_type =MLX5_PHYS_PORT_NAME_TYPE_PFVF ; -return ; +if (sc_items ==6 && pf_c1 =='p' && pf_c2 =='f' ) { +if (vf_c1 =='v' && vf_c2 =='f' ) { +/* Kernel ver >= 5.0 or OFED ver >= 4.6 */ + port_info_out->name_type = +MLX5_PHYS_PORT_NAME_TYPE_PFVF ; +return ; + } +if (vf_c1 =='s' && vf_c2 =='f' ) { +/* Kernel ver >= 5.11 or OFED ver >= 5.1 */ + port_info_out->name_type = +MLX5_PHYS_PORT_NAME_TYPE_PFSF ; +return ; + } }/* * Check for port-name as a string of the form p0
drivers/common/mlx5/linux/mlx5_nl.c +2 -0
@@ -1148,6 +1148,8 @@ mlx5_nl_check_switch_info(bool num_vf_set,case MLX5_PHYS_PORT_NAME_TYPE_PFHPF :/* Fallthrough */ case MLX5_PHYS_PORT_NAME_TYPE_PFVF : +/* Fallthrough */ +case MLX5_PHYS_PORT_NAME_TYPE_PFSF :/* New representors naming schema. */ switch_info->representor =1 ;break ;
drivers/common/mlx5/mlx5_common.h +2 -0
@@ -153,6 +153,7 @@ enum mlx5_nl_phys_port_name_type {MLX5_PHYS_PORT_NAME_TYPE_UPLINK ,/* p0, kernel ver >= 5.0 */ MLX5_PHYS_PORT_NAME_TYPE_PFVF ,/* pf0vf0, kernel ver >= 5.0 */ MLX5_PHYS_PORT_NAME_TYPE_PFHPF ,/* pf0, kernel ver >= 5.7, HPF rep */ +MLX5_PHYS_PORT_NAME_TYPE_PFSF ,/* pf0sf0, kernel ver >= 5.0 */ MLX5_PHYS_PORT_NAME_TYPE_UNKNOWN, /* Unrecognized. */ };
@@ -161,6 +162,7 @@ struct mlx5_switch_info { uint32_t master:1; /**< Master device. */ uint32_t representor:1; /**< Representor device. */enum mlx5_nl_phys_port_name_type name_type;/** < Port name type. */ +int32_t ctrl_num;/**< Controller number (valid for c#pf#vf# format). */ int32_t pf_num;/**< PF number (valid for pfxvfx format only). */ int32_t port_name;/**< Representor port name. */ uint64_t switch_id;/**< Switch identifier. */
drivers/net/mlx5/linux/mlx5_ethdev_os.c +3 -0
@@ -1013,6 +1013,9 @@ mlx5_sysfs_check_switch_info(bool device_dir,/* New representors naming schema. */ switch_info->representor =1 ;break ; +default : + switch_info->master = device_dir; +break ; } }
Signature · 1 line
2.25.1
PATCH v2 2/4 net/mlx5: support representor of sub function
In reply to Xueming LiThis patch supports of SF representor. Similar to VF representor, switch port name of SF representor in sysfs phys_port_name is "pf<x>sf<y>".
Device representor argumnt is "representors=sf[list]", list member could be mix of instance and range. Example:
representors=sf[0,2,4,8-12,-1]
To probe VF representor and SF representor, need to separate into 2 devices:
-a <BDF>,representor=vf[list] -a <BDF>,representor=sf[list]
--- doc/guides/nics/mlx5.rst | 58 +++++++++-- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 2 + drivers/net/mlx5/linux/mlx5_os.c | 123 ++++++++++++++++++++---- drivers/net/mlx5/mlx5_ethdev.c | 2 + 4 files changed, 154 insertions(+), 31 deletions(-)
doc/guides/nics/mlx5.rst +48 -10
@@ -874,14 +874,18 @@ Driver options - ``representor`` parameter [list] This parameter can be used to instantiate DPDK Ethernet devices from - existing port (or VF) representors configured on the device. + existing port (PF, VF or SF) representors configured on the device. It is a standard parameter whose format is described in :ref:`ethernet_device_standard_device_arguments`. - For instance, to probe port representors 0 through 2:: + For instance, to probe VF port representors 0 through 2:: - representor=[0-2] + representor=vf[0-2] + + To probe SF port representors 0 through 2:: + + representor=sf[0-2] - ``max_dump_files_num`` parameter [int]
@@ -1253,15 +1257,15 @@ Quick Start Guide on OFED/EN Enable switchdev mode --------------------- -Switchdev mode is a mode in E-Switch, that binds between representor and VF. -Representor is a port in DPDK that is connected to a VF in such a way -that assuming there are no offload flows, each packet that is sent from the VF -will be received by the corresponding representor. While each packet that is -sent to a representor will be received by the VF. +Switchdev mode is a mode in E-Switch, that binds between representor and VF or SF. +Representor is a port in DPDK that is connected to a VF or SF in such a way +that assuming there are no offload flows, each packet that is sent from the VF or SF +will be received by the corresponding representor. While each packet that is or SF +sent to a representor will be received by the VF or SF. This is very useful in case of SRIOV mode, where the first packet that is sent -by the VF will be received by the DPDK application which will decide if this +by the VF or SF will be received by the DPDK application which will decide if this flow should be offloaded to the E-Switch. After offloading the flow packet -that the VF that are matching the flow will not be received any more by +that the VF or SF that are matching the flow will not be received any more by the DPDK application. 1. Enable SRIOV mode::
@@ -1288,6 +1292,40 @@ the DPDK application. echo switchdev > /sys/class/net/<net device>/compat/devlink/mode +SubFunction representor support +------------------------------- +SubFunction is a portion of the PCI device, a SF netdev has its own +dedicated queues(txq, rxq). A SF netdev supports eswitch representation +offload similar to existing PF and VF representors. A SF shares PCI +level resources with other SFs and/or with its parent PCI function. + +1. Configure SF feature:: + + mlxconfig -d <mst device> set PF_BAR2_SIZE=<0/1/2/3> PF_BAR2_ENABLE=1 + + Value of PF_BAR2_SIZE: + + 0: 8 SFs + 1: 16 SFs + 2: 32 SFs + 3: 64 SFs + +2. Reset the FW:: + + mlxfwreset -d <mst device> reset + +3. Enable switchdev mode:: + + echo switchdev > /sys/class/net/<net device>/compat/devlink/mode + +4. Create SF:: + + mlnx-sf -d <PCI_BDF> -a create + +5. Probe SF representor:: + + testpmd> port attach <PCI_BDF>,representor=sf0,dv_flow_en=1 + Performance tuning ------------------
drivers/net/mlx5/linux/mlx5_ethdev_os.c +2 -0
@@ -1010,6 +1010,8 @@ mlx5_sysfs_check_switch_info(bool device_dir,case MLX5_PHYS_PORT_NAME_TYPE_PFHPF :/* Fallthrough */ case MLX5_PHYS_PORT_NAME_TYPE_PFVF : +/* Fallthrough */ +case MLX5_PHYS_PORT_NAME_TYPE_PFSF :/* New representors naming schema. */ switch_info->representor =1 ;break ;
drivers/net/mlx5/linux/mlx5_os.c +102 -21
191 lines not on this page · raw message
drivers/net/mlx5/mlx5_ethdev.c +2 -0
@@ -374,6 +374,8 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)break ; } } +if (priv->master) + info->dev_capa =RTE_ETH_DEV_CAPA_REPRESENTOR_SF ;return 0 ; }
Signature · 1 line
2.25.1
PATCH v2 3/4 net/mlx5: revert setting representor to first PF
In reply to Xueming LiRepresentors on second PF are being probed by devargs:
<primary_bdf>,representor=pf1vf<N>
No need to save primary PF port ID and lookup when probing sibling ports, revert patch [1]
[1]:
commit e6818853c022 ("net/mlx5: set representor to first PF in bonding mode")
--- drivers/net/mlx5/linux/mlx5_os.c | 20 ++------------------ drivers/net/mlx5/mlx5.c | 1 - drivers/net/mlx5/mlx5.h | 1 - 3 files changed, 2 insertions(+), 20 deletions(-)
drivers/net/mlx5/linux/mlx5_os.c +2 -18
@@ -817,13 +817,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, rte_errno =ENOMEM ;return NULL ; } - priv = eth_dev->data->dev_private; -if (priv->sh->bond_dev !=UINT16_MAX ) -/* For bonding port, use primary PCI device. */ - eth_dev->device = - rte_eth_devices[priv->sh->bond_dev].device; -else - eth_dev->device = dpdk_dev; + eth_dev->device = dpdk_dev; eth_dev->dev_ops = &mlx5_dev_sec_ops; eth_dev->rx_descriptor_status = mlx5_rx_descriptor_status; eth_dev->tx_descriptor_status = mlx5_tx_descriptor_status;
@@ -1451,17 +1445,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, eth_dev->data->dev_private = priv; priv->dev_data = eth_dev->data; eth_dev->data->mac_addrs = priv->mac; -if (spawn->pf_bond <0 ) { - eth_dev->device = dpdk_dev; - }else { -/* Use primary bond PCI as device. */ -if (sh->bond_dev ==UINT16_MAX ) { - sh->bond_dev = eth_dev->data->port_id; - eth_dev->device = dpdk_dev; - }else { - eth_dev->device = rte_eth_devices[sh->bond_dev].device; - } - } + eth_dev->device = dpdk_dev; eth_dev->data->dev_flags |=RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ;/* Configure the first MAC address by default. */ if (mlx5_get_mac (eth_dev, &mac.addr_bytes)) {
drivers/net/mlx5/mlx5.c +0 -1
@@ -917,7 +917,6 @@ mlx5_alloc_shared_dev_ctx(const struct mlx5_dev_spawn_data *spawn, goto error; } sh->refcnt =1 ; - sh->bond_dev =UINT16_MAX ; sh->max_port = spawn->max_port;strncpy (sh->ibdev_name,mlx5_os_get_ctx_device_name (sh->ctx),sizeof (sh->ibdev_name) -1 );
drivers/net/mlx5/mlx5.h +0 -1
@@ -692,7 +692,6 @@ struct mlx5_flex_parser_profiles {struct mlx5_dev_ctx_shared {LIST_ENTRY (mlx5_dev_ctx_shared) next;uint32_t refcnt; -uint16_t bond_dev;/* Bond primary device id. */ uint32_t devx:1 ;/* Opened with DV. */ uint32_t flow_hit_aso_en:1 ;/* Flow Hit ASO is supported. */ uint32_t eqn;/* Event Queue number. */
Signature · 1 line
2.25.1
PATCH v2 4/4 net/mlx5: improve bonding representor probe
In reply to Xueming LiTo probe representor on 2nd PF of bonding device, had to specify PF1 BDF in devarg:
<PF1_BDF>,representor=0
When closing bonding device, all representors had to be closed together and this implies all representors have to use master PF of bonding device. So after probing representor port on 2nd PF, when locating new probed device using device argument, the filter used 2nd PF as PCI address and failed to locate new device.
Conflict happened by using current representor devargs:
- Use PCI BDF to specify representor owner PF
- Use PCI BDF to locate probed representor device.
- PMD use master PCI BDF as PCI device.
To resolve such conflicts, new representor syntax is introduced here:
<master BDF>,representor=pfXvfY
All representors must use master PF as owner PCI device, PMD internally locate owner PCI address by checking representor "pfX" part. To EAL, all representor are registered to master PCI device, 2nd PF is hidden to EAL, thus all search should be consistent.
This patch also add pf index into bonding mode representor port name:
<BDF>_<ib_name>_representor_pf<X>vf<Y>
--- doc/guides/nics/mlx5.rst | 8 +- drivers/net/mlx5/linux/mlx5_os.c | 160 +++++++++++++++++-------------- drivers/net/mlx5/mlx5.c | 22 +++++ drivers/net/mlx5/mlx5.h | 3 +- drivers/net/mlx5/mlx5_defs.h | 4 - drivers/net/mlx5/mlx5_ethdev.c | 27 ------ drivers/net/mlx5/mlx5_mac.c | 8 +- 7 files changed, 122 insertions(+), 110 deletions(-)
doc/guides/nics/mlx5.rst +6 -2
@@ -881,11 +881,15 @@ Driver options For instance, to probe VF port representors 0 through 2:: - representor=vf[0-2] + <PCI_BDF>,representor=vf[0-2] To probe SF port representors 0 through 2:: - representor=sf[0-2] + <PCI_BDF>,representor=sf[0-2] + + To probe VF port representors 0 through 2 on both PFs of bonding device:: + + <Primary_PCI_BDF>,representor=pf[0,1]vf[0-2] - ``max_dump_files_num`` parameter [int]
drivers/net/mlx5/linux/mlx5_os.c +86 -74
261 lines not on this page · raw message
drivers/net/mlx5/mlx5.c +22 -0
@@ -358,6 +358,28 @@ static const struct mlx5_indexed_pool_config mlx5_ipool_cfg[] = {#define MLX5_FLOW_TABLE_HLIST_ARRAY_SIZE 4096 +/** +* Decide whether representor ID is a HPF(host PF) port on BF2. +* +* @param dev +* Pointer to Ethernet device structure. +* +* @return +* Non-zero if HPF, otherwise 0. +*/ +int +mlx5_is_hpf (struct rte_eth_dev *dev) +{ +struct mlx5_priv *priv = dev->data->dev_private; +enum rte_eth_representor_type type; +uint16_t port; + + port =rte_eth_representor_id_parse (priv->representor_id, +NULL ,NULL , &type); +return priv->representor && type ==RTE_ETH_REPRESENTOR_VF && + port ==rte_eth_representor_id_parse (-1 ,NULL ,NULL ,NULL ); +} +/** * Initialize the ASO aging management structure. *
drivers/net/mlx5/mlx5.h +2 -1
@@ -945,7 +945,7 @@ struct mlx5_priv {uint16_t vport_id;/* Associated VF vport index (if any). */ uint32_t vport_meta_tag;/* Used for vport index match ove VF LAG. */ uint32_t vport_meta_mask;/* Used for vport index field match mask. */ -int32_t representor_id;/* Port representor identifier. */ +int32_t representor_id;/* RTE_ETH_REPR(), -1 if not a representor. */ int32_t pf_bond;/* >=0 means PF index in bonding configuration. */ unsigned int if_index;/* Associated kernel network device index. */ uint32_t bond_ifindex;/**< Bond interface index. */
@@ -1019,6 +1019,7 @@ int mlx5_udp_tunnel_port_add(struct rte_eth_dev *dev, struct rte_eth_udp_tunnel *udp_tunnel);uint16_t mlx5_eth_find_next (uint16_t port_id,struct rte_pci_device *pci_dev);int mlx5_dev_close (struct rte_eth_dev *dev); +int mlx5_is_hpf (struct rte_eth_dev *dev);void mlx5_age_event_prepare (struct mlx5_dev_ctx_shared *sh);/* Macro to iterate over all valid ports for mlx5 driver. */
drivers/net/mlx5/mlx5_defs.h +0 -4
@@ -48,10 +48,6 @@#define MLX5_PMD_SOFT_COUNTERS 1#endif -/* Switch port ID parameters for bonding configurations. */ -#define MLX5_PORT_ID_BONDING_PF_MASK 0xf -#define MLX5_PORT_ID_BONDING_PF_SHIFT 12 -/* Alarm timeout. */ #define MLX5_ALARM_TIMEOUT_US 100000
drivers/net/mlx5/mlx5_ethdev.c +0 -27
@@ -330,33 +330,6 @@ mlx5_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *info)if (priv->representor) {uint16_t port_id; -if (priv->pf_bond >=0 ) { -/* -* Switch port ID is opaque value with driver defined -* format. Push the PF index in bonding configurations -* in upper four bits of port ID. If we get too many -* representors (more than 4K) or PFs (more than 15) -* this approach must be reconsidered. -*/ -/* Switch port ID for VF representors: 0 - 0xFFE */ -if ((info->switch_info.port_id !=0xffff && - info->switch_info.port_id >= - ((1 <<MLX5_PORT_ID_BONDING_PF_SHIFT ) -1 )) || - priv->pf_bond >MLX5_PORT_ID_BONDING_PF_MASK ) { -DRV_LOG (ERR ,"can't update switch port ID" -" for bonding device" ); -MLX5_ASSERT (false); -return -ENODEV ; - } -/* -* Switch port ID for Host PF representor -* (representor_id is -1) , set to 0xFFF -*/ -if (info->switch_info.port_id ==0xffff ) - info->switch_info.port_id =0xfff ; - info->switch_info.port_id |= - priv->pf_bond <<MLX5_PORT_ID_BONDING_PF_SHIFT ; - } MLX5_ETH_FOREACH_DEV(port_id, priv->pci_dev) {struct mlx5_priv *opriv = rte_eth_devices[port_id].data->dev_private;
drivers/net/mlx5/mlx5_mac.c +6 -2
@@ -159,7 +159,7 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)* Configuring the VF instead of its representor, * need to skip the special case of HPF on Bluefield. */ -if (priv->representor && priv->representor_id >=0 ) { +if (priv->representor && !mlx5_is_hpf (dev)) {DRV_LOG (DEBUG ,"VF represented by port %u setting primary MAC address" , dev->data->port_id); RTE_ETH_FOREACH_DEV_SIBLING(port_id, dev->data->port_id) {
@@ -169,7 +169,11 @@ mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr)return mlx5_os_vf_mac_addr_modify (priv,mlx5_ifindex (&rte_eth_devices[port_id]), - mac_addr, priv->representor_id); + mac_addr, +rte_eth_representor_id_parse ( + priv->representor_id, +NULL ,NULL ,NULL ) + ); } } rte_errno = -ENOTSUP ;
Signature · 1 line
2.25.1
v3 cover ethdev: support SubFunction representor
In reply to Xueming LiSubFunction [1] is a portion of the PCI device, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.
From SmartNIC perspective, when PCI device is shared for multi-host, representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Version history:
RFC:
initial version [2]
V2:
- separate patch for represnetor infrastructure, controller, pf and sf.
- replace representor ID macro with functions:
rte_eth_representor_id_encode() rte_eth_representor_id_parse()
- new patch to allow devargs with same PCI BDF but different representors.
- other minor code updates according to comments, thanks Andrew!
- update document
V3:
- improve probing of allowed devargs with same name.
- parse single word of kvargs as key.
- update kvargs test cases.
[1] SubFunction in kernel:
https://lore.kernel.org/netdev/[email protected]/
[2] RFC:
http://patchwork.dpdk.org/project/dpdk/list/?series=14376
[3] V2:
http://patchwork.dpdk.org/project/dpdk/list/?series=14559
Xueming Li (9):
ethdev: refactor representor infrastructure
ethdev: support new VF representor syntax
ethdev: support sub function representor
ethdev: support PF index in representor
ethdev: support multi-host representor
devarg: change reprsentor ID to bitmap
ethdev: capability of new representor syntax
kvargs: update parser for new representor syntax
eal: probe devices of same PCI but different devargs
app/test/test_kvargs.c | 51 +++++++-- config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 8 +- drivers/net/bnxt/bnxt_ethdev.c | 7 ++ drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_ethdev.c | 8 ++ drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++ drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 15 ++- lib/librte_eal/common/eal_common_bus.c | 23 ++++ lib/librte_ethdev/ethdev_private.c | 128 ++++++++++++++--------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++++-- lib/librte_ethdev/rte_ethdev.c | 31 +++++- lib/librte_ethdev/rte_ethdev.h | 2 + lib/librte_ethdev/rte_ethdev_driver.h | 64 ++++++++++++ lib/librte_ethdev/version.map | 2 + lib/librte_kvargs/rte_kvargs.c | 101 +++++++++++++----- 21 files changed, 401 insertions(+), 110 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/9 ethdev: refactor representor infrastructure
In reply to Xueming LiTo support extended representor syntax, this patch refactor representor infrastructure:
1. introduces representor type enum
2. devargs representor port range extraction from partial value
--- drivers/net/bnxt/bnxt_ethdev.c | 7 ++ drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/i40e/i40e_ethdev.c | 8 +++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 +++ drivers/net/mlx5/linux/mlx5_os.c | 11 ++++ lib/librte_ethdev/ethdev_private.c | 93 ++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- lib/librte_ethdev/rte_ethdev_driver.h | 7 ++ 10 files changed, 93 insertions(+), 60 deletions(-)
drivers/net/bnxt/bnxt_ethdev.c +7 -0
@@ -5513,6 +5513,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
drivers/net/enic/enic_ethdev.c +7 -0
@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,
drivers/net/i40e/i40e_ethdev.c +8 -0
@@ -640,6 +640,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/ixgbe/ixgbe_ethdev.c +8 -0
@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/mlx5/linux/mlx5_os.c +11 -0
@@ -706,6 +706,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)
lib/librte_ethdev/ethdev_private.c +42 -51
123 lines not on this page · raw message
lib/librte_ethdev/ethdev_private.h +0 -3
@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus
lib/librte_ethdev/rte_class_eth.c +1 -3
@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */
lib/librte_ethdev/rte_ethdev.c +2 -3
@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }
lib/librte_ethdev/rte_ethdev_driver.h +7 -0
@@ -1193,6 +1193,12 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ +RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];
@@ -1203,6 +1209,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/**
Signature · 1 line
2.25.1
PATCH v3 2/9 ethdev: support new VF representor syntax
In reply to Xueming LiTo prepare for more representor types, this patch adds compatible VF representor devargs syntax:
vf#: new VF port representor/s, example: vf[0-3], vf2
For backwards compatibility, representor "#" is deemed as "vf#".
--- doc/guides/prog_guide/poll_mode_drv.rst | 6 +++--- lib/librte_ethdev/ethdev_private.c | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +3 -3
@@ -374,9 +374,9 @@ parameters to those ports. this argument allows user to specify which switch ports to enable port representors for.:: - -a DBDF,representor=0 - -a DBDF,representor=[0,4,6,9] - -a DBDF,representor=[0-31] + -a DBDF,representor=vf0 + -a DBDF,representor=vf[0,4,6,9] + -a DBDF,representor=vf[0-31] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -95,6 +95,7 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,/* * representor format: * #: range or single number of VF representor - legacy +* vf#: VF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -102,8 +103,10 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data;int ret; -/* Number # alone implies VF */ +/* Parse vf# or number # alone implies VF */ eth_da->type =RTE_ETH_REPRESENTOR_VF ; +if (str[0 ] =='v' && str[1 ] =='f' ) + str +=2 ; ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (ret <0 )
Signature · 1 line
2.25.1
PATCH v3 3/9 ethdev: support sub function representor
In reply to Xueming LiSubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.
To support SF representor, this patch introduces new devargs syntax:
sf#: new SF port representor/s, example: sf[0-3], sf2
--- doc/guides/prog_guide/poll_mode_drv.rst | 1 + lib/librte_ethdev/ethdev_private.c | 14 +++++++++++--- lib/librte_ethdev/rte_ethdev_driver.h | 1 + 3 files changed, 13 insertions(+), 3 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +1 -0
@@ -377,6 +377,7 @@ parameters to those ports. -a DBDF,representor=vf0 -a DBDF,representor=vf[0,4,6,9] -a DBDF,representor=vf[0-31] + -a DBDF,representor=sf[0-1023] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +11 -3
@@ -96,6 +96,7 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,* representor format: * #: range or single number of VF representor - legacy * vf#: VF port representor/s +* sf#: SF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -103,10 +104,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data;int ret; -/* Parse vf# or number # alone implies VF */ - eth_da->type =RTE_ETH_REPRESENTOR_VF ; -if (str[0 ] =='v' && str[1 ] =='f' ) + eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* Parse vf# and sf#, number # alone implies VF */ +if (str[0 ] =='v' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ; + }else if (str[0 ] =='s' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_SF ; + str +=2 ; + }else { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + } ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (ret <0 )
lib/librte_ethdev/rte_ethdev_driver.h +1 -0
@@ -1197,6 +1197,7 @@ rte_eth_switch_domain_free(uint16_t domain_id);enum rte_eth_representor_type {RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ +RTE_ETH_REPRESENTOR_SF ,/* representor of SF */ };/** Generic Ethernet device arguments */
Signature · 1 line
2.25.1
PATCH v3 4/9 ethdev: support PF index in representor
In reply to Xueming LiTo support representor in bonding, this patch introduces 'pf' section to representor devargs syntax:
[pf#]vf#: VF port representor/s, example: vf3, pf0vf3 [pf#]sf#: SF port representor/s, example: sf2, pf1sf2
pf# is optional for SF and VF representor, indicates owner PF device of SF or VF.
--- doc/guides/prog_guide/poll_mode_drv.rst | 1 + lib/librte_ethdev/ethdev_private.c | 15 +++++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 1 + 3 files changed, 15 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +1 -0
@@ -378,6 +378,7 @@ parameters to those ports. -a DBDF,representor=vf[0,4,6,9] -a DBDF,representor=vf[0-31] -a DBDF,representor=sf[0-1023] + -a DBDF,representor=pf[0-1]sf[0-1023] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +13 -2
@@ -95,8 +95,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 -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [pf#]sf#: SF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -105,6 +105,16 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)int ret; eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* Parse pf# */ +if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + ret =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS ); +if (ret <0 ) + goto err; + str += ret; + }/* Parse vf# and sf#, number # alone implies VF */ if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ;
@@ -117,6 +127,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) } ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (ret <0 )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return ret <0 ? ret :0 ;
lib/librte_ethdev/rte_ethdev_driver.h +1 -0
@@ -1198,6 +1198,7 @@ enum rte_eth_representor_type {RTE_ETH_REPRESENTOR_NONE ,/* not a representor */ RTE_ETH_REPRESENTOR_VF ,/* representor of VF */ RTE_ETH_REPRESENTOR_SF ,/* representor of SF */ + RTE_ETH_REPRESENTOR_PF, /* representor of host PF */ };/** Generic Ethernet device arguments */
Signature · 1 line
2.25.1
PATCH v3 5/9 ethdev: support multi-host representor
In reply to Xueming LiThis patch introduces multi-host controller for 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. It is mostly for SmartNIC attached to multiple hosts in the same rack to allow routing the packets between PF/SF/VF running on these hosts.
Controller ID is physical host ID in multi-host, for end-user (e.g. OVS) it is transparent as part of representor syntax, sam as representor ID, interpreted by PMD.
--- config/rte_config.h | 1 + lib/librte_ethdev/ethdev_private.c | 14 ++++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 4 ++++ 3 files changed, 17 insertions(+), 2 deletions(-)
config/rte_config.h +1 -0
@@ -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
lib/librte_ethdev/ethdev_private.c +12 -2
@@ -95,8 +95,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 */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -105,6 +105,16 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)int ret; eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +/* Parse c# */ +if (str[0 ] =='c' ) { + str +=1 ; + ret =rte_eth_devargs_process_list (str, eth_da->mh_controllers, + ð_da->nb_mh_controllers, +RTE_DIM (eth_da->mh_controllers)); +if (ret <0 ) + goto err; + str += ret; + }/* Parse pf# */ if (str[0 ] =='p' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_PF ;
lib/librte_ethdev/rte_ethdev_driver.h +4 -0
@@ -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;
Signature · 1 line
2.25.1
PATCH v3 6/9 devarg: change reprsentor ID to bitmap
In reply to Xueming LiIn eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller(host) and owner port information, callback only compared representor port and returned representor port on other PF port.
This patch changes representor port to bitmap encoding, expands and updates representor port ID after parsing, when device representor ID uses the same bitmap encoding, the eth representor comparer callback returns correct ethdev.
Representor port ID bitmap definition:
Representor ID bitmap:
xxxx xxxx xxxx xxxx
|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf id
LL controller(host) id
--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/ethdev_private.c | 5 ++- lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 51 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 10 files changed, 124 insertions(+), 14 deletions(-)
drivers/net/bnxt/bnxt_reps.c +2 -1
@@ -186,7 +186,8 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params) eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = rep_params->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , rep_params->vf_id);rte_eth_random_addr (vf_rep_bp->dflt_mac_addr); memcpy(vf_rep_bp->mac_addr, vf_rep_bp->dflt_mac_addr,
drivers/net/enic/enic_vf_representor.c +2 -1
@@ -674,7 +674,8 @@ int enic_vf_representor_init(struct rte_eth_dev *eth_dev, void *init_params) eth_dev->dev_ops = &enic_vf_representor_dev_ops; eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = vf->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , vf->vf_id); eth_dev->data->mac_addrs =rte_zmalloc ("enic_mac_addr_vf" ,sizeof (struct rte_ether_addr ) *ENIC_UNICAST_PERFECT_FILTERS ,0 );
drivers/net/i40e/i40e_vf_representor.c +2 -1
@@ -510,7 +510,8 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Setting the number queues allocated to the VF */ ethdev->data->nb_rx_queues = vf->vsi->nb_qps;
drivers/net/ixgbe/ixgbe_vf_representor.c +2 -1
@@ -196,7 +196,8 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)return -ENODEV ; ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Set representor device ops */ ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;
drivers/net/mlx5/linux/mlx5_os.c +3 -1
@@ -1031,7 +1031,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,#endif /* representor_id field keeps the unmodified VF index. */ priv->representor_id = switch_info->representor ? - switch_info->port_name :-1 ; +rte_eth_representor_id_encode (0 ,0 ,RTE_ETH_REPRESENTOR_VF , + switch_info->port_name) : +-1 ;/* * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -93,10 +93,13 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list, }/* -* representor format: +* Parse representor ports, expand and update representor port ID. +* Representor format: * #: range or single number of VF representor - legacy * [[c#]pf#]vf#: VF port representor/s * [[c#]pf#]sf#: SF port representor/s +* +* See RTE_ETH_REPR() for representor ID format. */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
lib/librte_ethdev/rte_class_eth.c +30 -8
@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +76,39 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_representor_ports (values, &representors); +memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }
lib/librte_ethdev/rte_ethdev.c +26 -0
@@ -5556,6 +5556,32 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{ +if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,
lib/librte_ethdev/rte_ethdev_driver.h +51 -0
57 lines not on this page · raw message
lib/librte_ethdev/version.map +2 -0
@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse; rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind;
Signature · 1 line
2.25.1
PATCH v3 7/9 ethdev: capability of new representor syntax
In reply to Xueming LiNew representor devargs syntax can't be recognized correctly by previous DPDK version. For application to adapt different DPDK version automatically, this patch introduces new eth device capability of supportting SubFunction representor device.
--- lib/librte_ethdev/rte_ethdev.h | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1432,6 +1432,8 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001/** Device supports Tx queue setup after device started. */ #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 +/**< Device supports SubFunction representor. */ +#define RTE_ETH_DEV_CAPA_REPRESENTOR_SF 0x00000004/**@}*/ /*
Signature · 1 line
2.25.1
PATCH v3 8/9 kvargs: update parser for new representor syntax
In reply to Xueming LiThis patch updates kvargs parser to allow comma in list value:
k1=a[1,2]b[3-5]
--- app/test/test_kvargs.c | 51 +++++++++++++++-- lib/librte_kvargs/rte_kvargs.c | 101 +++++++++++++++++++++++---------- 2 files changed, 117 insertions(+), 35 deletions(-)
app/test/test_kvargs.c +45 -6
@@ -35,6 +35,25 @@ static int check_handler(const char *key, const char *value,return 0 ; } +/* test parsing. */ +static int test_kvargs_parsing (const char *args,unsigned int n) +{ +struct rte_kvargs *kvlist; + + kvlist =rte_kvargs_parse (args,NULL ); +if (kvlist ==NULL ) { +printf ("rte_kvargs_parse() error: %s\n" , args); +return -1 ; + } +if (kvlist->count != n) { +printf ("invalid count value %d: %s\n" , kvlist->count, args); +rte_kvargs_free (kvlist); +return -1 ; + } +rte_kvargs_free (kvlist); +return 0 ; +} +/* test a valid case */ static int test_valid_kvargs (void ) {
@@ -191,6 +210,32 @@ static int test_valid_kvargs(void) }rte_kvargs_free (kvlist); + valid_keys =NULL ; + + args ="foo=1,foo=" ; +if (test_kvargs_parsing (args,2 )) + goto fail; + + args ="foo=1,foo" ; +if (test_kvargs_parsing (args,2 )) + goto fail; + + args ="foo=1,=2" ; +if (test_kvargs_parsing (args,2 )) + goto fail; + + args ="foo=[1,2" ; +if (test_kvargs_parsing (args,1 )) + goto fail; + + args =",=" ; +if (test_kvargs_parsing (args,1 )) + goto fail; + + args ="foo=[" ; +if (test_kvargs_parsing (args,1 )) + goto fail; +return 0 ; fail:
@@ -212,12 +257,6 @@ static int test_invalid_kvargs(void)/* list of argument that should fail */ const char *args_list[] = {"wrong-key=x" ,/* key not in valid_keys_list */ -"foo=1,foo=" ,/* empty value */ -"foo=1,foo" ,/* no value */ -"foo=1,=2" ,/* no key */ -"foo=[1,2" ,/* no closing bracket in value */ -",=" ,/* also test with a smiley */ -"foo=[" ,/* no value in list and no closing bracket */ NULL };const char **args;const char *valid_keys_list[] = {"foo" ,"check" ,NULL };
lib/librte_kvargs/rte_kvargs.c +72 -29
129 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 9/9 eal: probe devices of same PCI but different devargs
In reply to Xueming LiWhen probing same PCI device with different representor arguments, PCI bus only probed first devargs, ignored other allowed devices with different representor arguments.
This patch iterates all devargs and try them all after bus scan.
--- lib/librte_eal/common/eal_common_bus.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
lib/librte_eal/common/eal_common_bus.c +23 -0
@@ -10,6 +10,7 @@#include <rte_debug.h> #include <rte_string_fns.h> #include <rte_errno.h> +#include <rte_devargs.h> #include "eal_private.h"
@@ -56,12 +57,22 @@ rte_bus_scan(void)return 0 ; } +static int +cmp_dev_name (const struct rte_device *dev,const void *_name) +{ +const char *name = _name; + +return strcmp (dev->name, name); +} +/* Probe all devices of all buses */ int rte_bus_probe (void ) {int ret;struct rte_bus *bus, *vbus =NULL ; +struct rte_devargs *da; +struct rte_device *dev; TAILQ_FOREACH(bus, &rte_bus_list, next) {if (!strcmp (bus->name,"vdev" )) {
@@ -82,6 +93,18 @@ rte_bus_probe(void) vbus->name); } +/* For devargs with same name but different arguments, try them all. */ + RTE_EAL_DEVARGS_FOREACH(NULL, da) { + dev = da->bus->find_device (NULL , cmp_dev_name, da->name); +if (!dev || !rte_dev_is_probed (dev) || dev->devargs == da) +continue ; + dev->devargs = da; + ret = dev->bus->plug (dev); +if (ret ==0 ) +RTE_LOG (DEBUG ,EAL ,"device probed %s %s" , da->name, + da->args); + } +return 0 ; }
Signature · 1 line
2.25.1
v4 cover ethdev: support SubFunction representor
In reply to Xueming LiSubFunction [1] is a portion of the PCI device, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.
From SmartNIC perspective, when PCI device is shared for multi-host, representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Version history:
RFC:
initial version [2]
V2:
- separate patch for represnetor infrastructure, controller, pf and sf.
- replace representor ID macro with functions:
rte_eth_representor_id_encode() rte_eth_representor_id_parse()
- new patch to allow devargs with same PCI BDF but different representors.
- other minor code updates according to comments, thanks Andrew!
- update document
V3:
- improve probing of allowed devargs with same name.
- parse single word of kvargs as key.
- update kvargs test cases.
V4:
- split first representor refactor patch into
1: add representor type
2: refector representor list parsing
- push the patch supporting multi-devargs for same device.
[1] SubFunction in kernel:
https://lore.kernel.org/netdev/[email protected]/
[2] RFC:
http://patchwork.dpdk.org/project/dpdk/list/?series=14376
[3] V2:
http://patchwork.dpdk.org/project/dpdk/list/?series=14559
[4] v3:
1 http://patchwork.dpdk.org/patch/86460/
2 http://patchwork.dpdk.org/patch/86461/
3 http://patchwork.dpdk.org/patch/86462/
4 http://patchwork.dpdk.org/patch/86463/
5 http://patchwork.dpdk.org/patch/86464/
6 http://patchwork.dpdk.org/patch/86465/
7 http://patchwork.dpdk.org/patch/86467/
8 http://patchwork.dpdk.org/patch/86466/
9 http://patchwork.dpdk.org/patch/86468/
Xueming Li (9):
ethdev: introduce representor type
ethdev: support representor port list
ethdev: support new VF representor syntax
ethdev: support sub function representor
ethdev: support PF index in representor
ethdev: support multi-host in representor
devarg: change representor ID to bitmap
ethdev: add capability of sub-function representor
kvargs: update parser to support lists
app/test/test_kvargs.c | 46 +++++++- config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 13 ++- drivers/net/bnxt/bnxt_ethdev.c | 7 ++ drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_ethdev.c | 7 ++ drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_ethdev.c | 8 ++ drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++ drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 15 ++- lib/librte_ethdev/ethdev_private.c | 140 ++++++++++++++--------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++++-- lib/librte_ethdev/rte_ethdev.c | 31 ++++- lib/librte_ethdev/rte_ethdev.h | 2 + lib/librte_ethdev/rte_ethdev_driver.h | 66 +++++++++++ lib/librte_ethdev/version.map | 2 + lib/librte_kvargs/rte_kvargs.c | 101 +++++++++++----- 20 files changed, 389 insertions(+), 113 deletions(-)
Signature · 1 line
2.25.1
PATCH v4 1/9 ethdev: introduce representor type
To support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
--- drivers/net/bnxt/bnxt_ethdev.c | 7 +++++++ drivers/net/enic/enic_ethdev.c | 7 +++++++ drivers/net/i40e/i40e_ethdev.c | 8 ++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++++ drivers/net/mlx5/linux/mlx5_os.c | 11 +++++++++++ lib/librte_ethdev/ethdev_private.c | 5 +++++ lib/librte_ethdev/rte_ethdev_driver.h | 9 +++++++++ 7 files changed, 55 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +7 -0
@@ -5586,6 +5586,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
drivers/net/enic/enic_ethdev.c +7 -0
@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,
drivers/net/i40e/i40e_ethdev.c +8 -0
@@ -638,6 +638,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/ixgbe/ixgbe_ethdev.c +8 -0
@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/mlx5/linux/mlx5_os.c +11 -0
@@ -705,6 +705,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)
lib/librte_ethdev/ethdev_private.c +5 -0
@@ -111,11 +111,16 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,return 0 ; } +/* +* representor format: +* #: range or single number of VF representor +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; + eth_da->type =RTE_ETH_REPRESENTOR_VF ;return rte_eth_devargs_process_range (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); }
lib/librte_ethdev/rte_ethdev_driver.h +9 -0
@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host PF. */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];
@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
+Cc more maintainers
18/01/2021 12:16, Xueming Li:
Quoted 157 lines
To support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
Signed-off-by Xueming Li <[email protected]>--- drivers/net/bnxt/bnxt_ethdev.c | 7 +++++++ drivers/net/enic/enic_ethdev.c | 7 +++++++ drivers/net/i40e/i40e_ethdev.c | 8 ++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++++ drivers/net/mlx5/linux/mlx5_os.c | 11 +++++++++++ lib/librte_ethdev/ethdev_private.c | 5 +++++ lib/librte_ethdev/rte_ethdev_driver.h | 9 +++++++++ 7 files changed, 55 insertions(+)drivers/net/bnxt/bnxt_ethdev.c +7
-0@@ -5586,6 +5586,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",drivers/net/enic/enic_ethdev.c +7
-0@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,drivers/net/i40e/i40e_ethdev.c +8
-0@@ -638,6 +638,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,drivers/net/ixgbe/ixgbe_ethdev.c +8
-0@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,drivers/net/mlx5/linux/mlx5_os.c +11
-0@@ -705,6 +705,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)lib/librte_ethdev/ethdev_private.c +5
-0@@ -111,11 +111,16 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,return 0 ; } +/* +* representor format: +* #: range or single number of VF representor +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; + eth_da->type =RTE_ETH_REPRESENTOR_VF ;return rte_eth_devargs_process_range (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); }lib/librte_ethdev/rte_ethdev_driver.h +9
-0@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host PF. */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
In reply to Xueming LiQuoted 6 lines · Xueming Li
To support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
Signed-off-by Xueming Li <[email protected]>
Quoted 18 lines
--- drivers/net/bnxt/bnxt_ethdev.c | 7 +++++++ drivers/net/enic/enic_ethdev.c | 7 +++++++ drivers/net/i40e/i40e_ethdev.c | 8 ++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++++ drivers/net/mlx5/linux/mlx5_os.c | 11 +++++++++++ lib/librte_ethdev/ethdev_private.c | 5 +++++ lib/librte_ethdev/rte_ethdev_driver.h | 9 +++++++++ 7 files changed, 55 insertions(+)drivers/net/bnxt/bnxt_ethdev.c +0
-0@@ -5586,6 +5586,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;struct rte_kvargs *kvlist =NULL ;
drivers/net/bnxt/bnxt_ethdev.c static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev, · line 5598
Quoted 10 lines
drivers/net/bnxt/bnxt_ethdev.c +7
-0+if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
Ack. Thanks
:::: snip ::::
drivers/net/bnxt/bnxt_ethdev.c
Quoted 5 lines
drivers/net/bnxt/bnxt_ethdev.c +5
-0+/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */
Till we get used to the terminology...
Can we also have SF = "Sub Function" mentioned in the docs or comments?
Quoted 17 lines
drivers/net/bnxt/bnxt_ethdev.c +4
-1+ RTE_ETH_REPRESENTOR_PF, /**< representor of host PF. */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/** -- 2.25.1
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
18/01/2021 18:42, Ajit Khaparde:
Quoted 7 lines · Xueming Li
lib/librte_ethdev/rte_ethdev_driver.h __rte_internal · line 1200
Quoted 4 lines
lib/librte_ethdev/rte_ethdev_driver.h +4
-0+enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ Till we get used to the terminology...
Can we also have SF = "Sub Function" mentioned in the docs or comments?
Are we sure about the definition?
I remember seeing SF = Scalable Function somewhere else (maybe from Intel)
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
Quoted 7 lines · Thomas Monjalon
18/01/2021 18:42, Ajit Khaparde:
Quoted 5 lines · Xueming Li
Quoted 4 lines
lib/librte_ethdev/rte_ethdev_driver.h +4
-0+enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */
Quoted 5 lines
Quoted 2 lines
Till we get used to the terminology...
Can we also have SF = "Sub Function" mentioned in the docs or comments?Are we sure about the definition?
I remember seeing SF = Scalable Function somewhere else (maybe from Intel)
That complicates it. But if they mean the same thing, let's pick one.
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
18/01/2021 19:00, Ajit Khaparde:
Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
18/01/2021 18:42, Ajit Khaparde:
Quoted 5 lines · Xueming Li
Quoted 4 lines
lib/librte_ethdev/rte_ethdev_driver.h +4
-0+enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Till we get used to the terminology...
Can we also have SF = "Sub Function" mentioned in the docs or comments?Are we sure about the definition?
I remember seeing SF = Scalable Function somewhere else (maybe from Intel)That complicates it. But if they mean the same thing, let's pick one.
I think "Sub Function" and "Virtual Function" are easy to understand for everybody.
I suggest picking these two for comments above.
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
Quoted 12 lines · Thomas Monjalon
18/01/2021 19:00, Ajit Khaparde:
Quoted 10 lines · Thomas Monjalon
Quoted 9 lines
18/01/2021 18:42, Ajit Khaparde:
Quoted 7 lines · Xueming Li
lib/librte_ethdev/rte_ethdev_driver.h __rte_internal · line 1200
Quoted 4 lines
lib/librte_ethdev/rte_ethdev_driver.h +4
-0+enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ Till we get used to the terminology...
Can we also have SF = "Sub Function" mentioned in the docs or comments?
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
Are we sure about the definition?
I remember seeing SF = Scalable Function somewhere else (maybe from Intel)That complicates it. But if they mean the same thing, let's pick one.
I think "Sub Function" and "Virtual Function" are easy to understand for everybody.
I suggest picking these two for comments above.
+1
Quoted 1 line
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
Quoted 30 lines
-----Original Message-----
From: Ajit Khaparde <[email protected]>
Sent: Tuesday, January 19, 2021 2:18 AM
To: NBU-Contact-Thomas Monjalon <[email protected]>
Cc: Xueming(Steven) Li <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Olivier Matz <[email protected]>; dpdk-dev <[email protected]>; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor typeQuoted 3 lines · Thomas Monjalon
18/01/2021 19:00, Ajit Khaparde:
Quoted 1 line
On Mon, Jan 18, 2021 at 9:57 AM Thomas Monjalon
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
18/01/2021 18:42, Ajit Khaparde:
Quoted 1 line
On Mon, Jan 18, 2021 at 3:17 AM Xueming Li <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
lib/librte_ethdev/rte_ethdev_driver.h __rte_internal · line 1200
Quoted 4 lines
lib/librte_ethdev/rte_ethdev_driver.h +4
-0+enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ Till we get used to the terminology...
Can we also have SF = "Sub Function" mentioned in the docs orcomments?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Are we sure about the definition?
I remember seeing SF = Scalable Function somewhere else (maybe from
Quoted 7 lines
Intel)
Quoted 5 lines
Quoted 1 line
That complicates it. But if they mean the same thing, let's pick one.
I think "Sub Function" and "Virtual Function" are easy to understand for everybody.
I suggest picking these two for comments above.+1
There was an internal discussion and the conclusion is to align with kernel driver name. Will update comment in next version, thanks!
Quoted 2 lines
Quoted 2 lines
Ajit Khaparde
Acked-byRe: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
Quoted 34 lines · Xueming(Steven) Li
Quoted 34 lines
-----Original Message-----
From: Ajit Khaparde <[email protected]>
Sent: Tuesday, January 19, 2021 2:18 AM
To: NBU-Contact-Thomas Monjalon <[email protected]>
Cc: Xueming(Steven) Li <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Olivier Matz <[email protected]>; dpdk-dev <[email protected]>; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor typeQuoted 3 lines · Thomas Monjalon
18/01/2021 19:00, Ajit Khaparde:
Quoted 1 line
On Mon, Jan 18, 2021 at 9:57 AM Thomas Monjalon
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines
Quoted 2 lines
18/01/2021 18:42, Ajit Khaparde:
Quoted 1 line
On Mon, Jan 18, 2021 at 3:17 AM Xueming Li <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+enum rte_eth_representor_type { + RTE_ETH_REPRESENTOR_NONE, /**< not a representor. */ + RTE_ETH_REPRESENTOR_VF, /**< representor of VF. */ + RTE_ETH_REPRESENTOR_SF, /**< representor of SF. */Till we get used to the terminology...
Can we also have SF = "Sub Function" mentioned in the docs orcomments?
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Are we sure about the definition?
I remember seeing SF = Scalable Function somewhere else (maybe fromIntel)
Quoted 2 lines
Quoted 1 line
That complicates it. But if they mean the same thing, let's pick one.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
I think "Sub Function" and "Virtual Function" are easy to understand for everybody.
I suggest picking these two for comments above.+1
There was an internal discussion and the conclusion is to align with kernel driver name. Will update comment in next version, thanks!
Ok. In that case for the series:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
In reply to Xueming LiQuoted 5 lines · Xueming Li
To support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
Signed-off-by Xueming Li <[email protected]>
One nit below and a question below.
In any case:
[snip]
Quoted 5 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0
lib/librte_ethdev/rte_ethdev_driver.h __rte_internal · line 1201
Quoted 9 lines
lib/librte_ethdev/rte_ethdev_driver.h +6
-0@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host PF. */
RTE_ETH_REPRESENTOR_SF and PF looks dead in the patch. IMHO, addition of these members here make future patches which add support inconsistent.
lib/librte_ethdev/rte_ethdev_driver.h struct rte_eth_devargs { · line 1214
Quoted 10 lines
lib/librte_ethdev/rte_ethdev_driver.h +3
-0+}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */
Is it intended and documented limitation that we can't add different type representors in one request? Or am I missing something and it is possible?
Quoted 4 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0};/**
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
Hi Andrew,
Quoted 34 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:25 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 1/9] ethdev: introduce representor typeQuoted 5 lines · Xueming Li
To support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
Signed-off-by Xueming Li <[email protected]>One nit below and a question below.
In any case:
Acked-by Andrew Rybchenko <[email protected]>[snip]
Quoted 9 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id);
Quoted 10 lines
lib/librte_ethdev/rte_ethdev_driver.h __rte_internal · line 1201
Quoted 6 lines
lib/librte_ethdev/rte_ethdev_driver.h +6
-0+/** Ethernet device representor type */ enum rte_eth_representor_type +{ +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host PF. */
RTE_ETH_REPRESENTOR_SFand PF looks dead in the patch. IMHO, addition of these members here make future patches which add support inconsistent.
Yes, later patch in this patchset will support it.
Quoted 13 lines
lib/librte_ethdev/rte_ethdev_driver.h struct rte_eth_devargs { · line 1214
Quoted 10 lines
lib/librte_ethdev/rte_ethdev_driver.h +3
-0+}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ Is it intended and documented limitation that we can't add different type representors in one request? Or am I missing something and it is possible?
Correct, current devargs structure can't support mix of different types. I'll update in next version if any.
Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0};/**
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
Quoted 47 lines · Xueming(Steven) Li
Hi Andrew,
Quoted 34 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:25 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 1/9] ethdev: introduce representor typeQuoted 5 lines · Xueming Li
To support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
Signed-off-by Xueming Li <[email protected]>One nit below and a question below.
In any case:
Acked-by Andrew Rybchenko <[email protected]>[snip]
Quoted 9 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id);Quoted 10 lines
lib/librte_ethdev/rte_ethdev_driver.h __rte_internal · line 1201
Quoted 6 lines
lib/librte_ethdev/rte_ethdev_driver.h +6
-0+/** Ethernet device representor type */ enum rte_eth_representor_type +{ +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host PF. */
RTE_ETH_REPRESENTOR_SFand PF looks dead in the patch. IMHO, addition of these members here make future patches which add support inconsistent.
Quoted 1 line
Yes, later patch in this patchset will support it.
I know. The question is why it is not added in the later patches when these types are actually supported.
Quoted 22 lines
Quoted 13 lines
lib/librte_ethdev/rte_ethdev_driver.h struct rte_eth_devargs { · line 1214
Quoted 10 lines
lib/librte_ethdev/rte_ethdev_driver.h +3
-0+}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ Is it intended and documented limitation that we can't add different type representors in one request? Or am I missing something and it is possible?
Correct, current devargs structure can't support mix of different types. I'll update in next version if any.
Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0};/**
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
Quoted 59 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:49 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 1/9] ethdev: introduce representor typeQuoted 46 lines · Xueming(Steven) Li
Hi Andrew,
Quoted 43 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:25 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 1/9] ethdev: introduce representor typeQuoted 5 lines · Xueming Li
To support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
Signed-off-by Xueming Li <[email protected]>One nit below and a question below.
In any case:
Acked-by Andrew Rybchenko <[email protected]>[snip]
Quoted 6 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0lib/librte_ethdev/rte_ethdev_driver.h __rte_internal int · line 1200
Quoted 8 lines
lib/librte_ethdev/rte_ethdev_driver.h +6
-0@@ -1193,6 +1193,14 @@ __rte_internal int rte_eth_switch_domain_free(uint16_t domain_id); +/** Ethernet device representor type */ enum +rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host PF. */
RTE_ETH_REPRESENTOR_SFand PF looks dead in the patch. IMHO, addition of these members here make future patches which add support inconsistent.
Quoted 5 lines
Quoted 1 line
Yes, later patch in this patchset will support it.
I know. The question is why it is not added in the later patches when these types are actually supported.
Good suggestion, will update
Quoted 24 lines
Quoted 14 lines
Quoted 14 lines
lib/librte_ethdev/rte_ethdev_driver.h struct rte_eth_devargs { · line 1214
Quoted 11 lines
lib/librte_ethdev/rte_ethdev_driver.h +3
-0+}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ Is it intended and documented limitation that we can't add different type representors in one request? Or am I missing something and it is
possible?
Quoted 9 lines
Correct, current devargs structure can't support mix of different types. I'll update in next version if any.
Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0};/**
Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type
19/01/2021 08:56, Xueming(Steven) Li:
Quoted 15 lines
From: Andrew Rybchenko <[email protected]>
Quoted 14 lines · Xueming(Steven) Li
Quoted 13 lines
From: Andrew Rybchenko <[email protected]>
Quoted 11 lines · Xueming Li
lib/librte_ethdev/rte_ethdev_driver.h __rte_internal · line 1201
Quoted 6 lines
lib/librte_ethdev/rte_ethdev_driver.h +6
-0+/** Ethernet device representor type */ enum +rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of VF. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of SF. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host PF. */
RTE_ETH_REPRESENTOR_SFand PF looks dead in the patch. IMHO, addition of these members here make future patches which add support inconsistent.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Yes, later patch in this patchset will support it.
I know. The question is why it is not added in the later patches when these types are actually supported.
Good suggestion, will update
+1 (I was sure it was already the case)
PATCH v4 2/9 ethdev: support representor port list
In reply to Xueming LiTo support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and ranges
--- lib/librte_ethdev/ethdev_private.c | 105 ++++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- 4 files changed, 54 insertions(+), 63 deletions(-)
lib/librte_ethdev/ethdev_private.c +51 -54
@@ -38,77 +38,71 @@ eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) +static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val) { -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; +uint16_t i; -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; +if (*len_list >= max_list) +return -1 ; +for (i =0 ; i < *len_list; i++) { +if (list[i] == val) +return 0 ; } + list[(*len_list)++] = val;return 0 ; } -static int +static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str; result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = lo; +if (rte_eth_devargs_enlist (list, len_list, max_list, lo) !=0 ) +return NULL ; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) -return -EINVAL ; +if (lo >= hi) +return NULL ;for (val = lo; val <= hi; val++) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = val; +if (rte_eth_devargs_enlist (list, len_list, max_list, + val) !=0 ) +return NULL ; } }else -return -EINVAL ; -return 0 ; +return NULL ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' )) + pos++; +return pos; +} + +static char * +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; + +if (*pos =='[' ) + pos++; +while (1 ) { + pos =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (pos ==NULL ) +return NULL ; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return NULL ; +if (*pos ==']' ) + pos++; +return pos; }/*
@@ -121,6 +115,9 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data; eth_da->type =RTE_ETH_REPRESENTOR_VF ; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, + str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +if (str ==NULL ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return str ==NULL ?-1 :0 ; }
lib/librte_ethdev/ethdev_private.h +0 -3
@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus
lib/librte_ethdev/rte_class_eth.c +1 -3
@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */
lib/librte_ethdev/rte_ethdev.c +2 -3
@@ -5542,9 +5542,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v4 2/9] ethdev: support representor port list
18/01/2021 12:16, Xueming Li:
Quoted 8 lines
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>
Parsing functions are usually difficult to read.
If you need to do another version, I would recommend adding an oneline comment on top of parsing functions to give a hint about what it is really doing.
Here,
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 43
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +3
-0+static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val)
here,
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 59
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +1
-0+static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list)
here,
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 86
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +3
-0+static char * +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list)
and also for this old one:
Quoted 1 line
(quoted diff) +0
-0@@ -121,6 +115,9 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
Re: [dpdk-dev] [PATCH v4 2/9] ethdev: support representor port list
Hi Thomas,
Quoted 39 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, January 19, 2021 12:18 AM
To: Xueming(Steven) Li <[email protected]>
Cc: Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Olivier Matz <[email protected]>; [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 2/9] ethdev: support representor port list18/01/2021 12:16, Xueming Li:
Quoted 8 lines
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>Parsing functions are usually difficult to read.
If you need to do another version, I would recommend adding an oneline comment on top of parsing functions to give a hint about what it is really doing.Here,
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 43
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +3
-0+static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val)here,
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 59
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +1
-0+static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list)here,
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 86
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +3
-0+static char * +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list)and also for this old one:
Review rte_eth_devargs_parse_representor_ports(char *str, · line 115
Quoted 2 lines
(quoted diff) +0
-0@@ -121,6 +115,9 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
Will add them in next version, thanks.
Re: [dpdk-dev] [PATCH v4 2/9] ethdev: support representor port list
In reply to Xueming LiQuoted 8 lines · Xueming Li
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>
See below
Quoted 55 lines
--- lib/librte_ethdev/ethdev_private.c | 105 ++++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- 4 files changed, 54 insertions(+), 63 deletions(-)lib/librte_ethdev/ethdev_private.c +4
-34@@ -38,77 +38,71 @@ eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) +static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val) { -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; +uint16_t i; -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ;
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 48
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-8- result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; +if (*len_list >= max_list) +return -1 ;
If current length is equal to max, but added value is already is in the list, it should not be an error. So, these two lines should be moved after below for loop.
Quoted 16 lines
lib/librte_ethdev/ethdev_private.c +6
-1+for (i =0 ; i < *len_list; i++) { +if (list[i] == val) +return 0 ; } + list[(*len_list)++] = val;return 0 ; } -static int +static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str;
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 102
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-4result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = lo; +if (rte_eth_devargs_enlist (list, len_list, max_list, lo) !=0 ) +return NULL ; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS )
Strictly speaking removal of comparision vs RTE_MAX_ETHPORTS is a separate logical change with a separate motivation.
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 70
Quoted 2 lines
lib/librte_ethdev/ethdev_private.c +1
-1-return -EINVAL ; +if (lo >= hi)
I'd remove '=' here. It should not be a problem and handed perfectly by below code. I see no point to deny 3-3 range which is an equivalent for just 3. It could be convenient in some cases.
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +1
-2+return NULL ;for (val = lo; val <= hi; val++) { -if (*len_list >= max_list) -return -ENOMEM ;
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 79
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +5
-3- list[(*len_list)++] = val; +if (rte_eth_devargs_enlist (list, len_list, max_list, + val) !=0 ) +return NULL ; } }else -return -EINVAL ; -return 0 ; +return NULL ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' ))
*post != '\0' is a bit better looking at subsequent comparisons. Yes, it is just style. Up to you.
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 80
Quoted 1 line
lib/librte_ethdev/ethdev_private.c +1
-0+ pos++;
It looks too fragile. May I suggest to use %n in above scanf to be able to skip only parsed characters.
Quoted 29 lines
lib/librte_ethdev/ethdev_private.c +25
-0+return pos; +} + +static char * +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; + +if (*pos =='[' ) + pos++; +while (1 ) { + pos =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (pos ==NULL ) +return NULL ; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return NULL ; +if (*pos ==']' ) + pos++; +return pos; }/*
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 119
Quoted 6 lines
lib/librte_ethdev/ethdev_private.c +1
-1@@ -121,6 +115,9 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data; eth_da->type =RTE_ETH_REPRESENTOR_VF ; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, + str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );
Not directly related to the patch, but I dislikeRTE_MAX_ETHPORTS above.RTE_DIM(eth_da->representor_ports) would be more
readable.
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +3
-0+if (str ==NULL ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return str ==NULL ?-1 :0 ; }
[snip]
Re: [dpdk-dev] [PATCH v4 2/9] ethdev: support representor port list
Hi Andrew,
Quoted 122 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:46 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 2/9] ethdev: support representor port listQuoted 8 lines · Xueming Li
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>See below
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start,
Quoted 13 lines
--- lib/librte_ethdev/ethdev_private.c | 105 ++++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- 4 files changed, 54 insertions(+), 63 deletions(-)lib/librte_ethdev/ethdev_private.c +0
-0@@ -38,77 +38,71 @@ eth_find_device(const struct rte_eth_dev *start,
rte_eth_cmp_tcmp,Quoted 43 lines
lib/librte_ethdev/ethdev_private.c +4
-34return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) +static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val) { -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; +uint16_t i; -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ;lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 48
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-8- result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; +if (*len_list >= max_list) +return -1 ;If current length is equal to max, but added value is already is in the list, it should not be an error. So, these two lines should be moved after below for loop.
Quoted 16 lines
lib/librte_ethdev/ethdev_private.c +6
-1+for (i =0 ; i < *len_list; i++) { +if (list[i] == val) +return 0 ; } + list[(*len_list)++] = val;return 0 ; } -static int +static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str;lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-4result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = lo; +if (rte_eth_devargs_enlist (list, len_list, max_list, lo) !=0 ) +return NULL ; }else if (result ==2 ) { - if (lo >= hi || lo > RTE_MAX_ETHPORTS || hi >
RTE_MAX_ETHPORTS)
Quoted 2 lines
Strictly speaking removal of comparision vs
RTE_MAX_ETHPORTSis a separate logical change with a separate motivation.
To make this function comment for controller/pf/vf/sf parsing, the max value is passed in as parameter and checked in rte_eth_devargs_enlist(). Caller code in rte_eth_devargs_process_list() decide the max value.
Quoted 63 lines
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, · line 70
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +1
-1-return -EINVAL ; +if (lo >= hi)I'd remove '=' here. It should not be a problem and handed perfectly by below code. I see no point to deny 3-3 range which is an equivalent for just 3. It could be convenient in some cases.
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +1
-2+return NULL ;for (val = lo; val <= hi; val++) { -if (*len_list >= max_list) -return -ENOMEM ;lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 79
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +5
-3- list[(*len_list)++] = val; +if (rte_eth_devargs_enlist (list, len_list, max_list, + val) !=0 ) +return NULL ; } }else -return -EINVAL ; -return 0 ; +return NULL ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' ))*post != '\0' is a bit better looking at subsequent comparisons. Yes, it is just style. Up to you.
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, · line 80
Quoted 1 line
lib/librte_ethdev/ethdev_private.c +1
-0+ pos++;It looks too fragile. May I suggest to use %n in above scanf to be able to skip only parsed characters.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str,
Quoted 29 lines
lib/librte_ethdev/ethdev_private.c +25
-0+return pos; +} + +static char * +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; + +if (*pos =='[' ) + pos++; +while (1 ) { + pos =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (pos ==NULL ) +return NULL ; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return NULL ; +if (*pos ==']' ) + pos++; +return pos; }/* @@ -121,6 +115,9 @@ rte_eth_devargs_parse_representor_ports(char *str,void *data)
Quoted 2 lines
lib/librte_ethdev/ethdev_private.c +0
-0struct rte_eth_devargs *eth_da = data;
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 119
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c +1
-1eth_da->type =RTE_ETH_REPRESENTOR_VF ; -return rte_eth_devargs_process_range (str, eth_da- representor_ports, + str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );Not directly related to the patch, but I dislike
RTE_MAX_ETHPORTSabove.RTE_DIM(eth_da->representor_ports)would be more readable.
The array dim could be different than RTE_MAX_ETHPORTS, although they are same today 😊
Quoted 8 lines
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c +3
-0+if (str ==NULL ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return str ==NULL ?-1 :0 ;}
[snip]
Other comments looks great, will update, thanks!
Re: [dpdk-dev] [PATCH v4 2/9] ethdev: support representor port list
Quoted 124 lines · Xueming(Steven) Li
Hi Andrew,
Quoted 122 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:46 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 2/9] ethdev: support representor port listQuoted 8 lines · Xueming Li
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>See below
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start,
Quoted 13 lines
--- lib/librte_ethdev/ethdev_private.c | 105 ++++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- 4 files changed, 54 insertions(+), 63 deletions(-)lib/librte_ethdev/ethdev_private.c +0
-0@@ -38,77 +38,71 @@ eth_find_device(const struct rte_eth_dev *start,
rte_eth_cmp_tcmp,Quoted 43 lines
lib/librte_ethdev/ethdev_private.c +4
-34return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) +static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val) { -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; +uint16_t i; -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ;lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 48
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-8- result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; +if (*len_list >= max_list) +return -1 ;If current length is equal to max, but added value is already is in the list, it should not be an error. So, these two lines should be moved after below for loop.
Quoted 16 lines
lib/librte_ethdev/ethdev_private.c +6
-1+for (i =0 ; i < *len_list; i++) { +if (list[i] == val) +return 0 ; } + list[(*len_list)++] = val;return 0 ; } -static int +static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str;lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-4result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = lo; +if (rte_eth_devargs_enlist (list, len_list, max_list, lo) !=0 ) +return NULL ; }else if (result ==2 ) { - if (lo >= hi || lo > RTE_MAX_ETHPORTS || hi >
RTE_MAX_ETHPORTS)
Quoted 6 lines
Quoted 2 lines
Strictly speaking removal of comparision vs
RTE_MAX_ETHPORTSis a separate logical change with a separate motivation.To make this function comment for controller/pf/vf/sf parsing, the max value is passed in as parameter and checked in
rte_eth_devargs_enlist(). Caller code inrte_eth_devargs_process_list()decide the max value.
Which maximum? Maximum number of elements in array and maximum element value are different things.
[snip]
Re: [dpdk-dev] [PATCH v4 2/9] ethdev: support representor port list
Quoted 141 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 5:04 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 2/9] ethdev: support representor port listQuoted 38 lines · Xueming(Steven) Li
Hi Andrew,
Quoted 36 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:46 PM
To: Xueming(Steven) Li <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v4 2/9] ethdev: support representor port listQuoted 8 lines · Xueming Li
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>See below
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start,
Quoted 13 lines
--- lib/librte_ethdev/ethdev_private.c | 105 ++++++++++++++--------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- 4 files changed, 54 insertions(+), 63 deletions(-)lib/librte_ethdev/ethdev_private.c +0
-0@@ -38,77 +38,71 @@ eth_find_device(const struct rte_eth_dev *start,
rte_eth_cmp_tcmp,Quoted 5 lines
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c +0
-2return NULL ; } -int -rte_eth_devargs_parse_list(char *str, rte_eth_devargs_callback_tcallback,
Quoted 61 lines
Quoted 61 lines
Quoted 38 lines
lib/librte_ethdev/ethdev_private.c +4
-32- void *data) +static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val) { -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; +uint16_t i; -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ;lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp, · line 48
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-8- result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; +if (*len_list >= max_list) +return -1 ;If current length is equal to max, but added value is already is in the list, it should not be an error. So, these two lines should be moved after below for loop.
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +4
-0+for (i =0 ; i < *len_list; i++) { +if (list[i] == val) +return 0 ; } + list[(*len_list)++] = val;return 0 ; }Quoted 3 lines
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +1
-1-static int +static char * rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t
*len_list,Quoted 20 lines
Quoted 19 lines
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c +1
-0const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str;lib/librte_ethdev/ethdev_private.c eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +2
-4result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = lo; +if (rte_eth_devargs_enlist (list, len_list, max_list, lo) !=0 ) +return NULL ; }else if (result ==2 ) { - if (lo >= hi || lo > RTE_MAX_ETHPORTS || hi >
RTE_MAX_ETHPORTS)Strictly speaking removal of comparision vs
RTE_MAX_ETHPORTSis a separate logical change with a separate motivation.
Quoted 6 lines
Quoted 3 lines
To make this function comment for controller/pf/vf/sf parsing, the max value is passed in as parameter and checked in
rte_eth_devargs_enlist(). Caller code inrte_eth_devargs_process_list()decide the max value.Which maximum? Maximum number of elements in array and maximum element value are different things.
My bad, after another check, it should be max number of elements in array, not max element value. Will update, thanks!
Quoted 2 lines
[snip]
PATCH v4 3/9 ethdev: support new VF representor syntax
In reply to Xueming LiTo prepare for more representor types, this patch adds compatible VF representor devargs syntax:
vf#: new VF port representor/s, examples:
representor=vf2 - single representor representor=vf[1,3,5] - single list representor=vf[0-3] - single range representor=vf[0,1,4-7] - list with singles and range
For backwards compatibility, representor "#" is deemed as "vf#".
--- doc/guides/prog_guide/poll_mode_drv.rst | 7 ++++--- lib/librte_ethdev/ethdev_private.c | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +4 -3
@@ -374,9 +374,10 @@ parameters to those ports. this argument allows user to specify which switch ports to enable port representors for.:: - -a DBDF,representor=0 - -a DBDF,representor=[0,4,6,9] - -a DBDF,representor=[0-31] + -a DBDF,representor=vf0 + -a DBDF,representor=vf[0,4,6,9] + -a DBDF,representor=vf[0-31] + -a DBDF,representor=vf[0,2-4,7,9-11] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -107,7 +107,8 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,/* * representor format: -* #: range or single number of VF representor +* #: range or single number of VF representor - legacy +* vf#: VF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -115,6 +116,8 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data; eth_da->type =RTE_ETH_REPRESENTOR_VF ; +if (str[0 ] =='v' && str[1 ] =='f' ) + str +=2 ; str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (str ==NULL )
Signature · 1 line
2.25.1
PATCH v4 4/9 ethdev: support sub function representor
In reply to Xueming LiSubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.
To support SF representor, this patch introduces new devargs syntax, examples:
representor=sf0 - single SubFunction representor representor=sf[1,3,5] - single list representor=sf[0-3], - single range
representor=sf[0,2-6,8,10-12] - list with singles and ranges
--- doc/guides/prog_guide/poll_mode_drv.rst | 4 ++++ lib/librte_ethdev/ethdev_private.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +4 -0
@@ -378,6 +378,10 @@ parameters to those ports. -a DBDF,representor=vf[0,4,6,9] -a DBDF,representor=vf[0-31] -a DBDF,representor=vf[0,2-4,7,9-11] + -a DBDF,representor=sf0 + -a DBDF,representor=sf[1,3,5] + -a DBDF,representor=sf[0-1023] + -a DBDF,representor=sf[0,2-4,7,9-11] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +9 -2
@@ -109,15 +109,22 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,* representor format: * #: range or single number of VF representor - legacy * vf#: VF port representor/s +* sf#: SF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; - eth_da->type =RTE_ETH_REPRESENTOR_VF ; -if (str[0 ] =='v' && str[1 ] =='f' ) +if (str[0 ] =='v' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ; + }else if (str[0 ] =='s' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_SF ; + str +=2 ; + }else { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + } str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (str ==NULL )
Signature · 1 line
2.25.1
PATCH v4 5/9 ethdev: support PF index in representor
In reply to Xueming LiWith Kernel bonding, multiple underlying PFs are bonded, VFs come from different PF, need to identify representor of VFs unambiguously by adding PF index.
This patch introduces optional 'pf' section to representor devargs syntax, examples:
representor=pf0vf0 - single VF representor
representor=pf[0-1]sf[0-1023] - SF representors from 2 PFs
--- doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +2 -0
@@ -382,6 +382,8 @@ parameters to those ports. -a DBDF,representor=sf[1,3,5] -a DBDF,representor=sf[0-1023] -a DBDF,representor=sf[0,2-4,7,9-11] + -a DBDF,representor=pf1vf0 + -a DBDF,representor=pf[0-1]sf[0-127] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +11 -2
@@ -108,14 +108,22 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,/* * representor format: * #: range or single number of VF representor - legacy -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [pf#]sf#: SF port representor/s */ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; +if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS ); +if (str ==NULL ) + goto err; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;
@@ -127,6 +135,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) } str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
Signature · 1 line
2.25.1
PATCH v4 6/9 ethdev: support multi-host in representor
In reply to Xueming LiThe 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.
--- 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(-)
config/rte_config.h +1 -0
@@ -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
lib/librte_ethdev/ethdev_private.c +10 -2
@@ -108,14 +108,22 @@ 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 */ int 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, + ð_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 ;
lib/librte_ethdev/rte_ethdev_driver.h +4 -0
@@ -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;
Signature · 1 line
2.25.1
PATCH v4 7/9 devarg: change representor ID to bitmap
In reply to Xueming LiThe NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if any).
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx
|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf id
LL controller(host) id
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
In the future, the representor ID field and each section should extend to bigger width to support more devices.
--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/ethdev_private.c | 5 ++- lib/librte_ethdev/rte_class_eth.c | 38 +++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 53 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 10 files changed, 126 insertions(+), 14 deletions(-)
drivers/net/bnxt/bnxt_reps.c +2 -1
@@ -186,7 +186,8 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params) eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = rep_params->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , rep_params->vf_id);rte_eth_random_addr (vf_rep_bp->dflt_mac_addr); memcpy(vf_rep_bp->mac_addr, vf_rep_bp->dflt_mac_addr,
drivers/net/enic/enic_vf_representor.c +2 -1
@@ -674,7 +674,8 @@ int enic_vf_representor_init(struct rte_eth_dev *eth_dev, void *init_params) eth_dev->dev_ops = &enic_vf_representor_dev_ops; eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = vf->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , vf->vf_id); eth_dev->data->mac_addrs =rte_zmalloc ("enic_mac_addr_vf" ,sizeof (struct rte_ether_addr ) *ENIC_UNICAST_PERFECT_FILTERS ,0 );
drivers/net/i40e/i40e_vf_representor.c +2 -1
@@ -510,7 +510,8 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Setting the number queues allocated to the VF */ ethdev->data->nb_rx_queues = vf->vsi->nb_qps;
drivers/net/ixgbe/ixgbe_vf_representor.c +2 -1
@@ -196,7 +196,8 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)return -ENODEV ; ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Set representor device ops */ ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;
drivers/net/mlx5/linux/mlx5_os.c +3 -1
@@ -1025,7 +1025,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,#endif /* representor_id field keeps the unmodified VF index. */ priv->representor_id = switch_info->representor ? - switch_info->port_name :-1 ; +rte_eth_representor_id_encode (0 ,0 ,RTE_ETH_REPRESENTOR_VF , + switch_info->port_name) : +-1 ;/* * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -106,10 +106,13 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list, }/* -* representor format: +* Parse representor ports, expand and update representor port ID. +* Representor format: * #: range or single number of VF representor - legacy * [[c#]pf#]vf#: VF port representor/s * [[c#]pf#]sf#: SF port representor/s +* +* See RTE_ETH_REPR() for representor ID format. */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
lib/librte_ethdev/rte_class_eth.c +30 -8
@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +76,39 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_representor_ports (values, &representors); +memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }
lib/librte_ethdev/rte_ethdev.c +26 -0
@@ -5556,6 +5556,32 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{ +if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,
lib/librte_ethdev/rte_ethdev_driver.h +53 -0
59 lines not on this page · raw message
lib/librte_ethdev/version.map +2 -0
@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse; rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind;
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v4 7/9] devarg: change representor ID to bitmap
Quoted 32 lines · Xueming Li
The NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if any).
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf idLL controller(host) id
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
Quoted 5 lines
In the future, the representor ID field and each section should extend to bigger width to support more devices.
Signed-off-by Xueming Li <[email protected]>
Not just in this patch, there is a lot of info in the commit logs. Unless I missed it, I don't see an update to doc/guides/prog_guide/switch_representation.rst
Can you please update that.
Quoted 281 lines
--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/ethdev_private.c | 5 ++- lib/librte_ethdev/rte_class_eth.c | 38 +++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 53 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 10 files changed, 126 insertions(+), 14 deletions(-)drivers/net/bnxt/bnxt_reps.c +2
-1@@ -186,7 +186,8 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params) eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = rep_params->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , rep_params->vf_id);rte_eth_random_addr (vf_rep_bp->dflt_mac_addr); memcpy(vf_rep_bp->mac_addr, vf_rep_bp->dflt_mac_addr,drivers/net/enic/enic_vf_representor.c +2
-1@@ -674,7 +674,8 @@ int enic_vf_representor_init(struct rte_eth_dev *eth_dev, void *init_params) eth_dev->dev_ops = &enic_vf_representor_dev_ops; eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = vf->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , vf->vf_id); eth_dev->data->mac_addrs =rte_zmalloc ("enic_mac_addr_vf" ,sizeof (struct rte_ether_addr ) *ENIC_UNICAST_PERFECT_FILTERS ,0 );drivers/net/i40e/i40e_vf_representor.c +2
-1@@ -510,7 +510,8 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Setting the number queues allocated to the VF */ ethdev->data->nb_rx_queues = vf->vsi->nb_qps;drivers/net/ixgbe/ixgbe_vf_representor.c +2
-1@@ -196,7 +196,8 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)return -ENODEV ; ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Set representor device ops */ ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;drivers/net/mlx5/linux/mlx5_os.c +3
-1@@ -1025,7 +1025,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,#endif /* representor_id field keeps the unmodified VF index. */ priv->representor_id = switch_info->representor ? - switch_info->port_name :-1 ; +rte_eth_representor_id_encode (0 ,0 ,RTE_ETH_REPRESENTOR_VF , + switch_info->port_name) : +-1 ;/* * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one. lib/librte_ethdev/ethdev_private.c +4
-1@@ -106,10 +106,13 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list, }/* -* representor format: +* Parse representor ports, expand and update representor port ID. +* Representor format: * #: range or single number of VF representor - legacy * [[c#]pf#]vf#: VF port representor/s * [[c#]pf#]sf#: SF port representor/s +* +* See RTE_ETH_REPR() for representor ID format. */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)lib/librte_ethdev/rte_class_eth.c +30
-8@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */ @@ -76,17 +76,39 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_representor_ports (values, &representors); +memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }lib/librte_ethdev/rte_ethdev.c +26
-0@@ -5556,6 +5556,32 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{ +if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,lib/librte_ethdev/rte_ethdev_driver.h +53
-0@@ -1218,6 +1218,59 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +#define RTE_NO_REPRESENTOR_ID UINT16_MAX/**< No representor ID. */ + +/** +* PMD helper function to encode representor ID +* +* The compact format is used for device iterator that comparing +* ethdev representor ID with target devargs. +* +* xxxx xxxx xxxx xxxx +* |||| |LLL LLLL LLLL vf/sf id +* |||| L 1:sf, 0:vf +* ||LL pf id +* LL controller(host) id +* +* @param controller +* Controller ID. +* @param pf +* PF port ID. +* @param type +* Representor type. +* @param representor_port +* Representor port ID. +* +* @return +* Encoded representor ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port); + +/** +* PMD helper function to parse representor ID +* +* @param representor_id +* Representor ID. +* @param controller +* Parsed controller ID. +* @param pf +* Parsed PF port ID. +* @param type +* Parsed representor type. +* +* @return +* Parsed representor port ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type); +/** * PMD helper function to parse ethdev arguments * lib/librte_ethdev/version.map +2
-1@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse; rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind; --2.25.1
Re: [dpdk-dev] [PATCH v4 7/9] devarg: change representor ID to bitmap
Quoted 50 lines
-----Original Message-----
From: Ajit Khaparde <[email protected]>
Sent: Tuesday, January 19, 2021 3:02 AM
To: Xueming(Steven) Li <[email protected]>
Cc: NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>; Olivier Matz <[email protected]>; dpdk-dev <[email protected]>; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v4 7/9] devarg: change representor ID to bitmapQuoted 35 lines · Xueming Li
The NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if any).
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf idLL controller(host) id
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
In the future, the representor ID field and each section should extend to bigger width to support more devices.
Quoted 6 lines
Quoted 2 lines
Signed-off-by Xueming Li <[email protected]>Not just in this patch, there is a lot of info in the commit logs. Unless I missed it, I don't see an update to
doc/guides/prog_guide/switch_representation.rst
Can you please update that.
Thanks, updated in next version.
Quoted 296 lines
drivers/net/bnxt/bnxt_reps.c int bnxt_representor_init(struct rte_eth_dev
Quoted 19 lines
--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/ethdev_private.c | 5 ++- lib/librte_ethdev/rte_class_eth.c | 38 +++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 53 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 10 files changed, 126 insertions(+), 14 deletions(-)drivers/net/bnxt/bnxt_reps.c +0
-0@@ -186,7 +186,8 @@ int bnxt_representor_init(struct rte_eth_dev
*eth_dev, void *params)Review
Quoted 10 lines
drivers/net/bnxt/bnxt_reps.c +2
-1eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = rep_params->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , rep_params->vf_id);rte_eth_random_addr (vf_rep_bp->dflt_mac_addr); memcpy(vf_rep_bp->mac_addr, vf_rep_bp->dflt_mac_addr,(quoted diff) +0
-0
b/drivers/net/enic/enic_vf_representor.cdrivers/net/enic/enic_vf_representor.c int enic_vf_representor_init(struct rte_eth_dev
Quoted 4 lines
index
c2c03c0281..632317af15100644drivers/net/enic/enic_vf_representor.c +0
-0@@ -674,7 +674,8 @@ int enic_vf_representor_init(struct rte_eth_dev
*eth_dev, void*init_params)Review
Quoted 10 lines
drivers/net/enic/enic_vf_representor.c +2
-1eth_dev->dev_ops = &enic_vf_representor_dev_ops; eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = vf->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , vf->vf_id); eth_dev->data->mac_addrs =rte_zmalloc ("enic_mac_addr_vf" ,sizeof (struct rte_ether_addr ) *ENIC_UNICAST_PERFECT_FILTERS ,0 );(quoted diff) +0
-0
b/drivers/net/i40e/i40e_vf_representor.cdrivers/net/i40e/i40e_vf_representor.c i40e_vf_representor_init(struct rte_eth_dev *ethdev,
Quoted 4 lines
index
9e40406a3d..d90d0fdb9d100644drivers/net/i40e/i40e_vf_representor.c +0
-0@@ -510,7 +510,8 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev,void
*init_params)Review
Quoted 10 lines
drivers/net/i40e/i40e_vf_representor.c +2
-1ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Setting the number queues allocated to the VF */ ethdev->data->nb_rx_queues = vf->vsi->nb_qps;(quoted diff) +0
-0
b/drivers/net/ixgbe/ixgbe_vf_representor.cdrivers/net/ixgbe/ixgbe_vf_representor.c ixgbe_vf_representor_init(struct rte_eth_dev
Quoted 4 lines
index
8185f0d3bb..e15b794761100644drivers/net/ixgbe/ixgbe_vf_representor.c +0
-0@@ -196,7 +196,8 @@ ixgbe_vf_representor_init(struct rte_eth_dev*ethdev, void
*init_params)Review
Quoted 10 lines
drivers/net/ixgbe/ixgbe_vf_representor.c +2
-1return -ENODEV ; ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Set representor device ops */ ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;(quoted diff) +0
-0
b/drivers/net/mlx5/linux/mlx5_os.cReview
Quoted 15 lines
index
caead107b0..4d7940bcca100644drivers/net/mlx5/linux/mlx5_os.c +3
-1@@ -1025,7 +1025,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,#endif /* representor_id field keeps the unmodified VF index. */ priv->representor_id = switch_info->representor ? - switch_info->port_name :-1 ; +rte_eth_representor_id_encode (0 ,0 ,RTE_ETH_REPRESENTOR_VF , + switch_info->port_name) : +-1 ;/* * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one. (quoted diff) +0
-0
b/lib/librte_ethdev/ethdev_private.clib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_list(char *str, uint16_t
Quoted 4 lines
index
57473b5a39..0b3b4aa871100644lib/librte_ethdev/ethdev_private.c +0
-0@@ -106,10 +106,13 @@ rte_eth_devargs_process_list(char *str, uint16_t*list,
uint16_t*len_list,Review
Quoted 15 lines
lib/librte_ethdev/ethdev_private.c +4
-1}/* -* representor format: +* Parse representor ports, expand and update representor port ID. +* Representor format: * #: range or single number of VF representor - legacy * [[c#]pf#]vf#: VF port representor/s * [[c#]pf#]sf#: SF port representor/s +* +* See RTE_ETH_REPR() for representor ID format. */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)(quoted diff) +0
-0
b/lib/librte_ethdev/rte_class_eth.clib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct
Quoted 65 lines
index
efe6149df5..994db96960100644lib/librte_ethdev/rte_class_eth.c +30
-8@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */ @@ -76,17 +76,39 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_representor_ports (values, &representors); +memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }lib/librte_ethdev/rte_ethdev.c +0
-0@@ -5556,6 +5556,32 @@ rte_eth_devargs_parse(const char *dargs, struct
rte_eth_devargs*eth_da)Review
Quoted 33 lines
lib/librte_ethdev/rte_ethdev.c +26
-0return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{ +if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev_driver.hlib/librte_ethdev/rte_ethdev_driver.h struct rte_eth_devargs { · line 1221
Quoted 8 lines
index
8e04634660..0d8893693e100644lib/librte_ethdev/rte_ethdev_driver.h +1
-0@@ -1218,6 +1218,59 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +#define RTE_NO_REPRESENTOR_ID UINT16_MAX/**< No representor ID. */
Quoted 71 lines
lib/librte_ethdev/rte_ethdev_driver.h +52
-0+ +/** +* PMD helper function to encode representor ID +* +* The compact format is used for device iterator that comparing +* ethdev representor ID with target devargs. +* +* xxxx xxxx xxxx xxxx +* |||| |LLL LLLL LLLL vf/sf id +* |||| L 1:sf, 0:vf +* ||LL pf id +* LL controller(host) id +* +* @param controller +* Controller ID. +* @param pf +* PF port ID. +* @param type +* Representor type. +* @param representor_port +* Representor port ID. +* +* @return +* Encoded representor ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port); + +/** +* PMD helper function to parse representor ID +* +* @param representor_id +* Representor ID. +* @param controller +* Parsed controller ID. +* @param pf +* Parsed PF port ID. +* @param type +* Parsed representor type. +* +* @return +* Parsed representor port ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type); +/** * PMD helper function to parse ethdev arguments * lib/librte_ethdev/version.map +2
-1@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse; rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind; --2.25.1
PATCH v4 8/9 ethdev: add capability of sub-function representor
In reply to Xueming LiOld DPDK version or some drivers that don't support SubFunction representor. For application to adapt different DPDK version automatically, or to be used for different NICs, this patch introduces new eth device capability of supporting SubFunction representor device.
--- lib/librte_ethdev/rte_ethdev.h | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1433,6 +1433,8 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001/** Device supports Tx queue setup after device started. */ #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 +/** Device supports SubFunction representor. */ +#define RTE_ETH_DEV_CAPA_REPRESENTOR_SF 0x00000004/**@}*/ /*
Signature · 1 line
2.25.1
PATCH v4 9/9 kvargs: update parser to support lists
In reply to Xueming LiThis patch updates kvargs parser to support lists on top of range, allow multiple lists or range:
k1=a[1,2]b[3-5]
--- app/test/test_kvargs.c | 46 +++++++++++++-- lib/librte_kvargs/rte_kvargs.c | 101 +++++++++++++++++++++++---------- 2 files changed, 112 insertions(+), 35 deletions(-)
app/test/test_kvargs.c +40 -6
@@ -35,6 +35,25 @@ static int check_handler(const char *key, const char *value,return 0 ; } +/* test parsing. */ +static int test_kvargs_parsing (const char *args,unsigned int n) +{ +struct rte_kvargs *kvlist; + + kvlist =rte_kvargs_parse (args,NULL ); +if (kvlist ==NULL ) { +printf ("rte_kvargs_parse() error: %s\n" , args); +return -1 ; + } +if (kvlist->count != n) { +printf ("invalid count value %d: %s\n" , kvlist->count, args); +rte_kvargs_free (kvlist); +return -1 ; + } +rte_kvargs_free (kvlist); +return 0 ; +} +/* test a valid case */ static int test_valid_kvargs (void ) {
@@ -42,6 +61,19 @@ static int test_valid_kvargs(void)const char *args;const char *valid_keys_list[] = {"foo" ,"check" ,NULL };const char **valid_keys; +static const struct { +unsigned int expected; +const char *input; + } valid_inputs[] = { + {2 ,"foo=1,foo=" }, + {2 ,"foo=1,foo=" }, + {2 ,"foo=1,foo" }, + {2 ,"foo=1,=2" }, + {1 ,"foo=[1,2" }, + {1 ,",=" }, + {1 ,"foo=[" }, + }; +unsigned int i;/* empty args is valid */ args ="" ;
@@ -191,6 +223,14 @@ static int test_valid_kvargs(void) }rte_kvargs_free (kvlist); + valid_keys =NULL ; + +for (i =0 ; i <RTE_DIM (valid_inputs); ++i) { + args = valid_inputs[i].input; +if (test_kvargs_parsing (args, valid_inputs[i].expected)) + goto fail; + } +return 0 ; fail:
@@ -212,12 +252,6 @@ static int test_invalid_kvargs(void)/* list of argument that should fail */ const char *args_list[] = {"wrong-key=x" ,/* key not in valid_keys_list */ -"foo=1,foo=" ,/* empty value */ -"foo=1,foo" ,/* no value */ -"foo=1,=2" ,/* no key */ -"foo=[1,2" ,/* no closing bracket in value */ -",=" ,/* also test with a smiley */ -"foo=[" ,/* no value in list and no closing bracket */ NULL };const char **args;const char *valid_keys_list[] = {"foo" ,"check" ,NULL };
lib/librte_kvargs/rte_kvargs.c +72 -29
129 lines not on this page · raw message
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v4 0/9] ethdev: support SubFunction representor
In reply to Xueming Li18/01/2021 12:16, Xueming Li:
Quoted 9 lines
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
[...]
Quoted 10 lines
Xueming Li (9):
ethdev: introduce representor type
ethdev: support representor port list
ethdev: support new VF representor syntax
ethdev: support sub function representor
ethdev: support PF index in representor
ethdev: support multi-host in representor
devarg: change representor ID to bitmap
ethdev: add capability of sub-function representor
kvargs: update parser to support lists
For the series,
Nice work, thank you.
v5 cover ethdev: support SubFunction representor
In reply to Xueming Lidedicated queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.
From SmartNIC perspective, when PCI device is shared for multi-host, representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Version history:
RFC:
initial version [2]
V2:
- separate patch for represnetor infrastructure, controller, pf and sf.
- replace representor ID macro with functions:
rte_eth_representor_id_encode() rte_eth_representor_id_parse()
- new patch to allow devargs with same PCI BDF but different representors.
- other minor code updates according to comments, thanks Andrew!
- update document
V3:
- improve probing of allowed devargs with same name.
- parse single word of kvargs as key.
- update kvargs test cases.
V4:
- split first representor refactor patch into
1: add representor type
2: refector representor list parsing
- push the patch supporting multi-devargs for same device.
V5:
- add comments for parsing functions
- update switch_representation.rst - Thanks Ajit
[1] SubFunction in kernel:
https://lore.kernel.org/netdev/[email protected]/
[2] RFC:
http://patchwork.dpdk.org/project/dpdk/list/?series=14376
[3] V2:
http://patchwork.dpdk.org/project/dpdk/list/?series=14559
[4] V3:
1 http://patchwork.dpdk.org/patch/86460/
2 http://patchwork.dpdk.org/patch/86461/
3 http://patchwork.dpdk.org/patch/86462/
4 http://patchwork.dpdk.org/patch/86463/
5 http://patchwork.dpdk.org/patch/86464/
6 http://patchwork.dpdk.org/patch/86465/
7 http://patchwork.dpdk.org/patch/86467/
8 http://patchwork.dpdk.org/patch/86466/
9 http://patchwork.dpdk.org/patch/86468/
[5] V4:
http://patchwork.dpdk.org/project/dpdk/list/?series=14809
Xueming Li (9):
ethdev: introduce representor type
ethdev: support representor port list
ethdev: support new VF representor syntax
ethdev: support sub function representor
ethdev: support PF index in representor
ethdev: support multi-host in representor
devarg: change representor ID to bitmap
ethdev: add capability of sub-function representor
kvargs: update parser to support lists
app/test/test_kvargs.c | 46 +++++- config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 13 +- .../prog_guide/switch_representation.rst | 35 ++-- drivers/net/bnxt/bnxt_ethdev.c | 7 + drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_ethdev.c | 7 + drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_ethdev.c | 8 + drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_ethdev.c | 8 + drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 15 +- lib/librte_ethdev/ethdev_private.c | 154 ++++++++++++------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++-- lib/librte_ethdev/rte_ethdev.c | 31 +++- lib/librte_ethdev/rte_ethdev.h | 2 + lib/librte_ethdev/rte_ethdev_driver.h | 66 ++++++++ lib/librte_ethdev/version.map | 2 + lib/librte_kvargs/rte_kvargs.c | 101 ++++++++---- 21 files changed, 428 insertions(+), 123 deletions(-)
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 14 lines · Xueming Li
dedicated
queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.Quoted 1 line
From SmartNIC perspective, when PCI device is shared for multi-host,
representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
Quoted 5 lines
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
The patch series looks really nice. Thanks.
As before, my biggest concern is making representor ID a bitmap. See my comments to a specific patch. Plus absence of defined semantics of caller function. Basically it is looks like it is assumed that controller #0 and PF #0 is the caller. However, it could be wrong.
The next biggest concert is the absence of capability reporting API. How many controller are available? How many PFs on each controller are available? How many VFs on each controller/PF are available? How many SFs?
From the first sight it sounds not that important right now and an extra feature which could be added in the follow up patches, but IMHO addition of the API would allow to avoid making representor ID a bitmap. Basically capabilities API can provide an array of available functions with representor ID assigned to each entry. Also it could make the entire patch series optional since it would allow to interpret numbers in representor=[....] as representor IDs which are mapped to controller/PF/VF/SF by the capabilities reporting API.
I realize that sometimes it could be more convenient to use syntax suggested here. Mainly for human.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 32 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:41 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 3 lines · Xueming Li
dedicated
queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCIfunction.
Quoted 11 lines
Quoted 2 lines
From SmartNIC perspective, when PCI device is shared for multi-host,
representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
Quoted 5 lines
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Quoted 7 lines
The patch series looks really nice. Thanks.
As before, my biggest concern is making representor ID a bitmap. See my comments to a specific patch.
Plus absence of defined semantics of caller function.
Basically it is looks like it is assumed that controller #0 and PF #0 is the caller. However, it could be wrong.
From devargs syntax perspective, a VF representor on PF1 could be referenced either way:
1: <PF0_BDF>,representor=pf1vfX 2: <PF1_BDF>,representor=vfX 3: <PF1_BDF>,representor=pf0vfX // works but not suggested, use PF0 BDF as caller
If probe a device with PF0 BDF and locate it with PF1 BDF, the device iterator will fail, devargs is parsed by api, EAL layer simply compare PCI BDF and then representor ID, i.e. "c#pf#vf#". The caller device should be consistent, better to use the first device.
Devrg "<PF1_BDF>,representor=vfX" will work, representor controller ID and pf ID default to #0, relative to caller context PF1 BDF.
Is it good to add such suggestion/behavior on rte_eth_devargs comments?
Quoted 16 lines
The next biggest concert is the absence of capability reporting API. How many controller are available?
How many PFs on each controller are available?
How many VFs on each controller/PF are available?
How many SFs?From the first sight it sounds not that important right now and an extra feature which could be added in the follow up patches, but IMHO addition of the API would allow to avoid making representor ID a bitmap. Basically capabilities API can provide an array of available functions with representor ID assigned to each entry. Also it could make the entire patch series optional since it would allow to interpret numbers in representor=[....] as representor IDs which are mapped to controller/PF/VF/SF by the capabilities reporting API.
Quoted 2 lines
I realize that sometimes it could be more convenient to use syntax suggested here. Mainly for human.
Agree, mostly for human. Regarding to capability reporting API, how about remove current one and enhance it later with a complete patch set?
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 44 lines · Xueming(Steven) Li
Quoted 32 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:41 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 3 lines · Xueming Li
dedicated
queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCIfunction.
Quoted 11 lines
Quoted 2 lines
From SmartNIC perspective, when PCI device is shared for multi-host,
representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
Quoted 5 lines
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Quoted 7 lines
The patch series looks really nice. Thanks.
As before, my biggest concern is making representor ID a bitmap. See my comments to a specific patch.
Plus absence of defined semantics of caller function.
Basically it is looks like it is assumed that controller #0 and PF #0 is the caller. However, it could be wrong.From devargs syntax perspective, a VF representor on PF1 could be referenced either way:
1: <PF0_BDF>,representor=pf1vfX 2: <PF1_BDF>,representor=vfX 3: <PF1_BDF>,representor=pf0vfX // works but not suggested, use PF0 BDF as caller
Quoted 8 lines
If probe a device with PF0 BDF and locate it with PF1 BDF, the device iterator will fail, devargs is parsed by api, EAL layer simply compare PCI BDF and then representor ID, i.e. "c#pf#vf#". The caller device should be consistent, better to use the first device.
Devrg "<PF1_BDF>,representor=vfX" will work, representor controller ID and pf ID default to #0, relative to caller context PF1 BDF.
Is it good to add such suggestion/behavior on
rte_eth_devargscomments?
Sorry, but I disagree. Solution with vf1 and pf0vf1 making the same representor ID sounds not acceptable to me. It is definitely different things if I pass it to PF1.
Quoted 16 lines
Quoted 16 lines
The next biggest concert is the absence of capability reporting API. How many controller are available?
How many PFs on each controller are available?
How many VFs on each controller/PF are available?
How many SFs?From the first sight it sounds not that important right now and an extra feature which could be added in the follow up patches, but IMHO addition of the API would allow to avoid making representor ID a bitmap. Basically capabilities API can provide an array of available functions with representor ID assigned to each entry. Also it could make the entire patch series optional since it would allow to interpret numbers in representor=[....] as representor IDs which are mapped to controller/PF/VF/SF by the capabilities reporting API.
Quoted 6 lines
Quoted 2 lines
I realize that sometimes it could be more convenient to use syntax suggested here. Mainly for human.
Agree, mostly for human. Regarding to capability reporting API, how about remove current one and enhance it later with a complete patch set?
Current one? Sorry I don't understand.
Andrew.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Hi Andrew,
Quoted 63 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, January 22, 2021 4:21 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 34 lines · Xueming(Steven) Li
Quoted 34 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:41 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 4 lines · Xueming Li
dedicated
queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCIfunction.
Quoted 17 lines
Quoted 3 lines
From SmartNIC perspective, when PCI device is shared for multi-host,
representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Quoted 6 lines
Quoted 6 lines
The patch series looks really nice. Thanks.
As before, my biggest concern is making representor ID a bitmap. See my comments to a specific patch.
Plus absence of defined semantics of caller function.
Basically it is looks like it is assumed that controller #0 and PF #0 is thecaller.
Quoted 3 lines
Quoted 1 line
However, it could be wrong.
From devargs syntax perspective, a VF representor on PF1 could be
referenced either way:
Quoted 6 lines
1: <PF0_BDF>,representor=pf1vfX 2: <PF1_BDF>,representor=vfX 3: <PF1_BDF>,representor=pf0vfX // works but not suggested, use PF0BDF as caller If probe a device with PF0 BDF and locate it with PF1 BDF, the device iterator will fail, devargs is parsed by api, EAL layer simply compare PCI BDF and then representor ID, i.e. "c#pf#vf#". The
caller device should be consistent, better to use the first device.
Quoted 1 line
Quoted 8 lines
Quoted 4 lines
Devrg "<PF1_BDF>,representor=vfX" will work, representor controller ID and pf ID default to #0, relative to caller context PF1 BDF.
Is it good to add such suggestion/behavior on
rte_eth_devargscomments?Sorry, but I disagree. Solution with vf1 and pf0vf1 making the same representor ID sounds not acceptable to me. It is definitely different things if I pass it to PF1.
My understanding is that representor is an "offset" to caller(context) PF, so the caller PF has to be the lowest, i.e. PF0. The usage for mlx5 PMD is to probe VF representor on a kernel bonding:
1. PF0 is the only device for PMD to probe the bonding device, PMD detects underlay PFs.
2. PF0_BDF,reprensetor=pf1vf0, to probe the representor for first VF on PF1. PF1_BDF,reprenstor=pf0vf0 works for the same representor, but not encouraged because it confuses EAL device iterator which can't tell the difference, as you said: "mainly for human"
Controller ID is not used by mlx5 PMD currently, just a place holder for now, but I think same policy applies: lowest as caller(context).
Your suggestion of reserving an c# and pf# ID for caller device which c# or pf# not specified looks good, it makes the usage of the representor ID bitmap flexible, but considering some NIC with 4 PFs, it's hard to choose, as you know, only 3 controller and 3 PFs left.
BTW, I guess your assumption is that representor as "absolute" to caller PF, can't default to 0. Is there a scenario for PF1 as caller?
Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
The next biggest concert is the absence of capability reporting API. How many controller are available?
How many PFs on each controller are available?
How many VFs on each controller/PF are available?
How many SFs?From the first sight it sounds not that important right now and an extra feature which could be added in the follow up patches, but IMHO addition of the API would allow to avoid making representor ID a bitmap. Basically capabilities API can provide an array of available functions with representor ID assigned to each entry. Also it could make the entire patch series optional since it would allow to interpret numbers in representor=[....] as representor IDs which are mapped to controller/PF/VF/SF by the capabilities reporting API.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
I realize that sometimes it could be more convenient to use syntax suggested here. Mainly for human.
Agree, mostly for human. Regarding to capability reporting API, how about remove current one and enhance it later with a complete patch set?
Current one? Sorry I don't understand.
The patch of device SF capability, but seems I misunderstood your suggestion.
Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way locate the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.
In the future, I think representor could be processed by PMD, so PMD could have enough flexibility to support more device expressions and types. But that will introduce a fundamental change of devargs and device management, need a full plan.
Quoted 2 lines
Andrew.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 68 lines · Xueming(Steven) Li
Hi Andrew,
Quoted 66 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, January 22, 2021 4:21 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 34 lines · Xueming(Steven) Li
Quoted 34 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:41 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 4 lines · Xueming Li
dedicated
queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCIfunction.
Quoted 17 lines
Quoted 3 lines
From SmartNIC perspective, when PCI device is shared for multi-host,
representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Quoted 6 lines
Quoted 6 lines
The patch series looks really nice. Thanks.
As before, my biggest concern is making representor ID a bitmap. See my comments to a specific patch.
Plus absence of defined semantics of caller function.
Basically it is looks like it is assumed that controller #0 and PF #0 is thecaller.
Quoted 3 lines
Quoted 1 line
However, it could be wrong.
From devargs syntax perspective, a VF representor on PF1 could be
referenced either way:
Quoted 6 lines
1: <PF0_BDF>,representor=pf1vfX 2: <PF1_BDF>,representor=vfX 3: <PF1_BDF>,representor=pf0vfX // works but not suggested, use PF0BDF as caller If probe a device with PF0 BDF and locate it with PF1 BDF, the device iterator will fail, devargs is parsed by api, EAL layer simply compare PCI BDF and then representor ID, i.e. "c#pf#vf#". The
caller device should be consistent, better to use the first device.
Quoted 4 lines
Devrg "<PF1_BDF>,representor=vfX" will work, representor controller ID and pf ID default to #0, relative to caller context PF1 BDF.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Is it good to add such suggestion/behavior on
rte_eth_devargscomments?Sorry, but I disagree. Solution with vf1 and pf0vf1 making the same representor ID sounds not acceptable to me. It is definitely different things if I pass it to PF1.
My understanding is that representor is an "offset" to caller(context) PF, so the caller PF has to be the lowest, i.e. PF0.
Sorry, how to address PF0 from PF1?
Quoted 7 lines
The usage for mlx5 PMD is to probe VF
representor on a kernel bonding:
1. PF0 is the only device for PMD to probe the bonding device, PMD detects underlay PFs.
2. PF0_BDF,reprensetor=pf1vf0, to probe the representor for first VF on PF1. PF1_BDF,reprenstor=pf0vf0 works for the same representor, but not encouraged because it confuses EAL device iterator which can't tell the difference, as you said: "mainly for human"
Quoted 6 lines
Controller ID is not used by mlx5 PMD currently, just a place holder for now, but I think same policy applies: lowest as caller(context).
Your suggestion of reserving an c# and pf# ID for caller device which c# or pf# not specified looks good, it makes the usage of the representor ID bitmap flexible, but considering some NIC with 4 PFs, it's hard to choose, as you know, only 3 controller and 3 PFs left.
I'd prefer the option if we make a choice between these two. At least it a bit more consistent.
But IMHO anyway bitmap is a road to wrong direction.
Quoted 2 lines
BTW, I guess your assumption is that representor as "absolute" to caller PF, can't default to 0. Is there a scenario for PF1 as caller?
Yes.
Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 16 lines
The next biggest concert is the absence of capability reporting API. How many controller are available?
How many PFs on each controller are available?
How many VFs on each controller/PF are available?
How many SFs?From the first sight it sounds not that important right now and an extra feature which could be added in the follow up patches, but IMHO addition of the API would allow to avoid making representor ID a bitmap. Basically capabilities API can provide an array of available functions with representor ID assigned to each entry. Also it could make the entire patch series optional since it would allow to interpret numbers in representor=[....] as representor IDs which are mapped to controller/PF/VF/SF by the capabilities reporting API.
Quoted 2 lines
I realize that sometimes it could be more convenient to use syntax suggested here. Mainly for human.
Agree, mostly for human. Regarding to capability reporting API, how about remove current one and enhance it later with a complete patch set?
Quoted 5 lines
Quoted 1 line
Current one? Sorry I don't understand.
The patch of device SF capability, but seems I misunderstood your suggestion. Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.
Is there a maximum index and maximum total number of SF's created? How to find it?
Quoted 5 lines
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way locate the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.
I think the API should simply reserve/report space for maximum number of SFs. So, IDs are stable across restart/reboot in assumption that NIC is not reconfigured (changed maximum number of VF or maximum number of SFs of any PF).
Quoted 8 lines
In the future, I think representor could be processed by PMD, so PMD could have enough flexibility to support more device expressions and types. But that will introduce a fundamental change of devargs and device management, need a full plan.
Quoted 2 lines
Andrew.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
<snip>
Quoted 5 lines
Quoted 3 lines
The patch of device SF capability, but seems I misunderstood your suggestion. Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.Is there a maximum index and maximum total number of SF's created? How to find it?
The maximum index is defined by firmware configuration, all SF's information could be found from sysfs. To create a SF, both PCI and sfnum have to be specified.
Quoted 9 lines
Quoted 6 lines
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way locate
the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.I think the API should simply reserve/report space for maximum number of SFs. So, IDs are stable across restart/reboot in assumption that NIC is not reconfigured (changed maximum number of VF or maximum number of SFs of any PF).
Yes, IDs should be stable as long as no NIC firmware configuration change.
Just clarify, this api should be common enough to report all devices that a bus device supports:
1. name, might contains controller and pf info, example: "eth:representor:c0pf1vf"
2. ID range, example: 0-127
The api describes ID ranges for each sub device type, users have to query the api and choose representor ID to probe.
Prototype:
struct rte_bus_device_range {
char name[64];
uint32_t base;
uint32_t number;
}/* return number of ranges filled, or number of ranges if list is NULL. */ int rte_bus_ dev_range_get(struct rte_bus_device_range *list, int n);
Quoted 1 line
<snip>
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 9 lines · Xueming(Steven) Li
<snip>
Quoted 5 lines
Quoted 3 lines
The patch of device SF capability, but seems I misunderstood your suggestion. Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.Is there a maximum index and maximum total number of SF's created? How to find it?
The maximum index is defined by firmware configuration, all SF's information could be found from sysfs. To create a SF, both PCI and sfnum have to be specified.
sysfs is obviously Linux specific. I think the information should be available via DPDK API.
Quoted 17 lines
Quoted 9 lines
Quoted 6 lines
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way locate
the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.I think the API should simply reserve/report space for maximum number of SFs. So, IDs are stable across restart/reboot in assumption that NIC is not reconfigured (changed maximum number of VF or maximum number of SFs of any PF).
Yes, IDs should be stable as long as no NIC firmware configuration change.
Just clarify, this api should be common enough to report all devices that a bus device supports:
1. name, might contains controller and pf info, example: "eth:representor:c0pf1vf"
2. ID range, example: 0-127
The api describes ID ranges for each sub device type, users have to query the api and choose representor ID to probe.
Quoted 8 lines
Prototype:
struct rte_bus_device_range { char name[64]; uint32_t base; uint32_t number; }/* return number of ranges filled, or number of ranges if list is NULL. */ int
rte_bus_dev_range_get(struct rte_bus_device_range *list, int n);
Hm, I thought about more port representor specific API. For me it is hard to tell if such generic naming is good or bad. I think it should be proven that such generic API makes sense. Any other potential users / use cases?
I've considered ethdev API which returns (in similar way as above) list of possible port representors which could be controlled by the device. Also I think it would be useful to include type information (enum with PF, VF, SF), controller ID.
There is one more bit which is not in the picture yet - switch_info.port_id. Should it be equal to representor ID? Or different and provided in the info structure?
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 14 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 1, 2021 4:39 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 5 lines · Xueming(Steven) Li
<snip>
Quoted 4 lines
Quoted 3 lines
The patch of device SF capability, but seems I misunderstood your suggestion. Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Is there a maximum index and maximum total number of SF's created? How to find it?
The maximum index is defined by firmware configuration, all SF's
information could be found from sysfs. To create a SF, both PCI and sfnum have to be specified.sysfs is obviously Linux specific. I think the information should be available via DPDK API.
Yes, the new api discussed below should resolve this issue.
Quoted 29 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way locate
the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.I think the API should simply reserve/report space for maximum number
of SFs. So, IDs are stable across restart/reboot in assumption that NIC is not reconfigured (changed maximum number of VF ormaximum number of SFs of any PF).
Quoted 9 lines
Yes, IDs should be stable as long as no NIC firmware configuration change.
Just clarify, this api should be common enough to report all devices that a bus device supports:
1. name, might contains controller and pf info, example: "eth:representor:c0pf1vf"
2. ID range, example: 0-127
The api describes ID ranges for each sub device type, users have to query the api and choose representor ID to probe.Prototype:
Quoted 8 lines
struct rte_bus_device_range { char name[64]; uint32_t base; uint32_t number; }/* return number of ranges filled, or number of ranges if list is NULL. */ int
rte_bus_dev_range_get(struct rte_bus_device_range *list, int n);
Quoted 3 lines
Hm, I thought about more port representor specific API.
For me it is hard to tell if such generic naming is good or bad. I think it should be proven that such generic API makes sense. Any other potential users / use cases?
I was thinking about SF, but SF is PCI specific, not suitable for this api. So I'm fine to make it as ethdev api. To append new api into eth_dev_ops, is there ABI concern?
Quoted 4 lines
I've considered ethdev API which returns (in similar way as
above) list of possible port representors which could be controlled by the device. Also I think it would be useful to include type information (enum with PF, VF, SF), controller ID.
Agree.
There is a new concern from orchestration side, currently, no interface in openstack and OVS to retrieve representor ID range info, It will take time to adapt this solution. To probe a representor, orchestration need to know how to calculate representor ID, and the ID might vary on different max SF number, i.e. VF4 on PP1 might got different ID. Representor ID change before that will break the product.
Considering both orchestration and testpmd users, how about keeping both solution together? This will bring max flexibility IMHO.
In struct rte_eth_dev_data, reserved bits could be used to define controller and port, this will avoid bitmap. How do you think?
Quoted 3 lines
There is one more bit which is not in the picture yet - switch_info.port_id. Should it be equal to representor ID? Or different and provided in the info structure?
Not exactly same AFAIK, the id used in e-switch.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 52 lines · Xueming(Steven) Li
Quoted 14 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 1, 2021 4:39 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 5 lines · Xueming(Steven) Li
<snip>
Quoted 4 lines
Quoted 3 lines
The patch of device SF capability, but seems I misunderstood your suggestion. Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Is there a maximum index and maximum total number of SF's created? How to find it?
The maximum index is defined by firmware configuration, all SF's
information could be found from sysfs. To create a SF, both PCI and sfnum have to be specified.sysfs is obviously Linux specific. I think the information should be available via DPDK API.
Yes, the new api discussed below should resolve this issue.
Quoted 29 lines
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way locate
the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.I think the API should simply reserve/report space for maximum number
of SFs. So, IDs are stable across restart/reboot in assumption that NIC is not reconfigured (changed maximum number of VF ormaximum number of SFs of any PF).
Quoted 17 lines
Yes, IDs should be stable as long as no NIC firmware configuration change.
Just clarify, this api should be common enough to report all devices that a bus device supports:
1. name, might contains controller and pf info, example: "eth:representor:c0pf1vf"
2. ID range, example: 0-127
The api describes ID ranges for each sub device type, users have to query the api and choose representor ID to probe.Prototype:
struct rte_bus_device_range { char name[64]; uint32_t base; uint32_t number; }/* return number of ranges filled, or number of ranges if list is NULL. */ int
rte_bus_dev_range_get(struct rte_bus_device_range *list, int n);
Quoted 6 lines
Quoted 3 lines
Hm, I thought about more port representor specific API.
For me it is hard to tell if such generic naming is good or bad. I think it should be proven that such generic API makes sense. Any other potential users / use cases?I was thinking about SF, but SF is PCI specific, not suitable for this api. So I'm fine to make it as ethdev api. To append new api into
eth_dev_ops, is there ABI concern?
No, eth_dev_ops are internal
Quoted 10 lines
Quoted 3 lines
I've considered ethdev API which returns (in similar way as
above) list of possible port representors which could be controlled by the device. Also I think it would be useful to include type information (enum with PF, VF, SF), controller ID.Agree.
There is a new concern from orchestration side, currently, no interface in openstack and OVS to retrieve representor ID range info, It will take time to adapt this solution. To probe a representor, orchestration need to know how to calculate representor ID, and the ID might vary on different max SF number, i.e. VF4 on PP1 might got different ID. Representor ID change before that will break the product.
I see.
Quoted 1 line
Considering both orchestration and testpmd users, how about keeping both solution together? This will bring max flexibility IMHO.
As I said before I don't mind and I really think it is a good idea to add suggested interface to specify representor (i.e. cXpfYvfZ), but the problem is making bitmap from representor ID.
ethdev API should use new representor info API to make a representor ID from controller/PF/{VF,SF}. Or do you see any problems with such approach?
Quoted 1 line
In struct
rte_eth_dev_data, reserved bits could be used to define controller and port, this will avoid bitmap. How do you think?
Could you add a bit more on it? Just a bit more details to the idea since I don't understand what exactly you mean and how it could help.
Quoted 7 lines
Quoted 3 lines
There is one more bit which is not in the picture yet - switch_info.port_id. Should it be equal to representor ID? Or different and provided in the info structure?
Not exactly same AFAIK, the id used in e-switch.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 89 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, February 5, 2021 3:35 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 56 lines · Xueming(Steven) Li
Quoted 16 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 1, 2021 4:39 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 5 lines · Xueming(Steven) Li
<snip>
Quoted 4 lines
Quoted 3 lines
The patch of device SF capability, but seems I misunderstood your suggestion. Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Is there a maximum index and maximum total number of SF's created? How to find it?
The maximum index is defined by firmware configuration, all SF's
information could be found from sysfs. To create a SF, both PCI and sfnum have to be specified.sysfs is obviously Linux specific. I think the information should be available via DPDK API.
Yes, the new api discussed below should resolve this issue.
Quoted 31 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way
locate the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.Quoted 4 lines
Quoted 4 lines
I think the API should simply reserve/report space for maximum number of SFs. So, IDs are stable across restart/reboot in assumption that NIC is not reconfigured (changed maximum number of VF or
maximum number of SFs of any PF).
Quoted 17 lines
Yes, IDs should be stable as long as no NIC firmware configuration change.
Just clarify, this api should be common enough to report all devices that a bus device supports:
1. name, might contains controller and pf info, example: "eth:representor:c0pf1vf"
2. ID range, example: 0-127
The api describes ID ranges for each sub device type, users have to query the api and choose representor ID to probe.Prototype:
struct rte_bus_device_range { char name[64]; uint32_t base; uint32_t number; }/* return number of ranges filled, or number of ranges if list is NULL. */ int
rte_bus_dev_range_get(struct rte_bus_device_range *list, int n);Quoted 6 lines
Quoted 3 lines
Hm, I thought about more port representor specific API.
For me it is hard to tell if such generic naming is good or bad. I
think it should be proven that such generic API makes sense. Any other potential users / use cases?I was thinking about SF, but SF is PCI specific, not suitable for this api. So I'm fine to make it as ethdev api. To append new api into
eth_dev_ops, is there ABI concern?No,
eth_dev_opsare internalQuoted 10 lines
Quoted 3 lines
I've considered ethdev API which returns (in similar way as
above) list of possible port representors which could be controlled
by the device. Also I think it would be useful to include type information (enum with PF, VF, SF), controller ID.Agree.
There is a new concern from orchestration side, currently, no
interface in openstack and OVS to retrieve representor ID range info,
It will take time to adapt this solution. To probe a representor,
orchestration need to know how to calculate representor ID, and the ID might vary on different max SF number, i.e. VF4 on PP1might got different ID. Representor ID change before that will break the product.
I see.
Quoted 7 lines
Quoted 1 line
Considering both orchestration and testpmd users, how about keeping both solution together? This will bring max flexibility IMHO.
As I said before I don't mind and I really think it is a good idea to add suggested interface to specify representor (i.e. cXpfYvfZ), but the problem is making bitmap from representor ID.
ethdev API should use new representor info API to make a representor ID from controller/PF/{VF,SF}. Or do you see any problems with such approach?
Sorry I thought the user to figure out representor ID from api. This combination look good, thanks for clarification :)
So the new api looks like this:
struct rte_eth_representor_info {
Enum representor_type;
Uint16_t controller; // -1 for any
Uint16_t port; // -1 for any
Uint16_t representor_id;
Uint16_t count;
char name[N];
int rte_eth_representor_info_get(struct rte_eth_representor_info *infos);
- Return number of entries.
- NULL infos just return number of entries supported.
Sample outputs:
VF, -1, 0, 0, 128, "pf0vf"
SF, -1, 0, 128, 2048, "pf0sf"
PF, -1, 0, 32767, 1, "pf"
VF, -1, 1, 32768, 128, "pf1vf"
SF, -1, 0, (32768+128), 2048, "pf1sf"
PF, -1, 0, 65535, 1, "pf"
Quoted 5 lines
Quoted 2 lines
In struct
rte_eth_dev_data, reserved bits could be used to define controller and port, this will avoid bitmap. How do you think?Could you add a bit more on it? Just a bit more details to the idea since I don't understand what exactly you mean and how it could help.
The idea is replacing reserved_64s and adding more device location info in rte_eth-dev_data like this:
Uint16_t representor_id;
Uint16_t port_id;
Uint16_t controller_id;
Enum representor_type;
Compare them all when matching a device, this will also avoid bitmap encoding. Reserved_64s[] was added to mitigate ABI conflicts, IIRC.
But seems no need if making representor info API to make ID.
Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
There is one more bit which is not in the picture yet -
switch_info.port_id. Should it be equal to representor ID? Or different and provided in the info structure?Not exactly same AFAIK, the id used in e-switch.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Quoted 94 lines · Xueming(Steven) Li
Quoted 94 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Friday, February 5, 2021 3:35 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Thomas Monjalon <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 56 lines · Xueming(Steven) Li
Quoted 16 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 1, 2021 4:39 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 5 lines · Xueming(Steven) Li
<snip>
Quoted 4 lines
Quoted 3 lines
The patch of device SF capability, but seems I misunderstood your suggestion. Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Is there a maximum index and maximum total number of SF's created? How to find it?
The maximum index is defined by firmware configuration, all SF's
information could be found from sysfs. To create a SF, both PCI and sfnum have to be specified.sysfs is obviously Linux specific. I think the information should be available via DPDK API.
Yes, the new api discussed below should resolve this issue.
Quoted 31 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way
locate the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.Quoted 4 lines
Quoted 4 lines
I think the API should simply reserve/report space for maximum number of SFs. So, IDs are stable across restart/reboot in assumption that NIC is not reconfigured (changed maximum number of VF or
maximum number of SFs of any PF).
Quoted 17 lines
Yes, IDs should be stable as long as no NIC firmware configuration change.
Just clarify, this api should be common enough to report all devices that a bus device supports:
1. name, might contains controller and pf info, example: "eth:representor:c0pf1vf"
2. ID range, example: 0-127
The api describes ID ranges for each sub device type, users have to query the api and choose representor ID to probe.Prototype:
struct rte_bus_device_range { char name[64]; uint32_t base; uint32_t number; }/* return number of ranges filled, or number of ranges if list is NULL. */ int
rte_bus_dev_range_get(struct rte_bus_device_range *list, int n);Quoted 6 lines
Quoted 3 lines
Hm, I thought about more port representor specific API.
For me it is hard to tell if such generic naming is good or bad. I
think it should be proven that such generic API makes sense. Any other potential users / use cases?I was thinking about SF, but SF is PCI specific, not suitable for this api. So I'm fine to make it as ethdev api. To append new api into
eth_dev_ops, is there ABI concern?No,
eth_dev_opsare internalQuoted 10 lines
Quoted 3 lines
I've considered ethdev API which returns (in similar way as
above) list of possible port representors which could be controlled
by the device. Also I think it would be useful to include type information (enum with PF, VF, SF), controller ID.Agree.
There is a new concern from orchestration side, currently, no
interface in openstack and OVS to retrieve representor ID range info,
It will take time to adapt this solution. To probe a representor,
orchestration need to know how to calculate representor ID, and the ID might vary on different max SF number, i.e. VF4 on PP1might got different ID. Representor ID change before that will break the product.
I see.
Quoted 1 line
Considering both orchestration and testpmd users, how about keeping both solution together? This will bring max flexibility IMHO.
As I said before I don't mind and I really think it is a good idea to add suggested interface to specify representor (i.e. cXpfYvfZ), but the problem is making bitmap from representor ID.
Quoted 7 lines
Quoted 2 lines
ethdev API should use new representor info API to make a representor ID from controller/PF/{VF,SF}. Or do you see any problems with such approach?
Sorry I thought the user to figure out representor ID from api. This combination look good, thanks for clarification :)
So the new api looks like this:
Roughly speaking - yes
Quoted 3 lines
struct
rte_eth_representor_info{
Enumrepresentor_type;
Uint16_tcontroller; // -1 for any
I'm not sure that I understand what does "any" mean in this case. I think it should be the zero in examples below. I think that API should return caller controller ID and PF ID. It would allow to interpret "vf5" correctly when caller is not controller #0 and/or PF #0.
Quoted 1 line
Uint16_tport; // -1 for any
port sounds like physical port, but it should be PF
(pf, phys_fn or something like this). It could be many
PFs per physical network port.
Quoted 1 line
Uint16_trepresentor_id;
May be base_id? Or rep_base_id?
The question is what to do if range for VF or SF is not contiguous. Should we have one more index after phys_fn to represent it? E.g.
union {
uint16_t vf;
uint16_t sf;
};Quoted 1 line
Uint16_tcount;
May be id_range which should be 1 to show one function. It could be convenient to treat 0 this way as well, but I doubt that it is a good idea.
Quoted 37 lines
char name[N];int
rte_eth_representor_info_get(struct rte_eth_representor_info *infos);
- Return number of entries.
- NULL infos just return number of entries supported.
Sample outputs:
VF, -1, 0, 0, 128, "pf0vf"
SF, -1, 0, 128, 2048, "pf0sf"
PF, -1, 0, 32767, 1, "pf"
VF, -1, 1, 32768, 128, "pf1vf"
SF, -1, 0, (32768+128), 2048, "pf1sf"
PF, -1, 0, 65535, 1, "pf"Quoted 5 lines
Quoted 2 lines
In struct
rte_eth_dev_data, reserved bits could be used to define controller and port, this will avoid bitmap. How do you think?Could you add a bit more on it? Just a bit more details to the idea since I don't understand what exactly you mean and how it could help.
The idea is replacing
reserved_64sand adding more device location info in rte_eth-dev_data like this:
Uint16_trepresentor_id;
Uint16_tport_id;
Uint16_tcontroller_id;
Enumrepresentor_type;
Compare them all when matching a device, this will also avoid bitmap encoding. Reserved_64s[] was added to mitigate ABI conflicts, IIRC.
But seems no need if making representor info API to make ID.Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
There is one more bit which is not in the picture yet -
switch_info.port_id. Should it be equal to representor ID? Or different and provided in the info structure?Not exactly same AFAIK, the id used in e-switch.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
In reply to Xueming(Steven) LiQuoted 1 line · Xueming(Steven) Li
::::[snip]::::
Quoted 9 lines
The patch of device SF capability, but seems I misunderstood your suggestion.
Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.
2. SF is created on a PF with a SF number. SF number is named per PF, different PF may have same SF number.
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no need to use pf#sf# here.
4. For bonding netdev, hot plug to DPDK using "PF0_BDF,representor=pf#sf#"
If using new api to return all representor IDs, need some way locate the new created SF by PF and SF number, that's why "pf#sf#" is used in this patch set.
Quoted 3 lines
In the future, I think representor could be processed by PMD, so PMD could have enough flexibility to support more device expressions and types. But that will introduce a fundamental change of devargs and device management, need a full plan.
Do you mean all changes will be contained within the PMD? The fundamental changes will be in the PMD?
More types of what?
Quoted 4 lines
Quoted 3 lines
Andrew.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
Hi Ajit,
Quoted 28 lines
-----Original Message-----
From: Ajit Khaparde <[email protected]>
Sent: Thursday, January 28, 2021 1:43 AM
To: Xueming(Steven) Li <[email protected]>
Cc: Andrew Rybchenko <[email protected]>; [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representorQuoted 1 line · Xueming(Steven) Li
::::[snip]::::
Quoted 1 line
The patch of device SF capability, but seems I misunderstood your
suggestion.
Quoted 2 lines
Let me explain process to create a SF:
1. SF can be created on the fly with scripts, unlike VF which is statically pre-created.
Quoted 1 line
2. SF is created on a PF with a SF number. SF number is named per PF,
different PF may have same SF number.
Quoted 1 line
3. For standalone PF, hot plug to DPDK using "PF#_BDF,representor=sf#", no
need to use pf#sf# here.
Quoted 1 line
4. For bonding netdev, hot plug to DPDK using
"PF0_BDF,representor=pf#sf#"
Quoted 1 line
If using new api to return all representor IDs, need some way locate the new
created SF by PF and SF number,
Quoted 2 lines
that's why "pf#sf#" is used in this patch set.
Quoted 7 lines
Quoted 1 line
In the future, I think representor could be processed by PMD, so PMD could
have enough flexibility
Quoted 1 line
to support more device expressions and types. But that will introduce a
fundamental change of devargs and
Quoted 1 line
device management, need a full plan.
Do you mean all changes will be contained within the PMD? The fundamental changes will be in the PMD?
Yes, PMD detect device type and IDs from devargs and figure out a unique name for device.
Quoted 1 line
More types of what?
SF, representor of SF, representor of VF...
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
Andrew.
Re: [dpdk-dev] [PATCH v5 0/9] ethdev: support SubFunction representor
In reply to Xueming LiQuoted 37 lines
dedicated
queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.From SmartNIC perspective, when PCI device is shared for multi-host, representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Version history:
RFC:
initial version [2]
V2:
- separate patch for represnetor infrastructure, controller, pf and sf.
- replace representor ID macro with functions:
rte_eth_representor_id_encode()rte_eth_representor_id_parse()
- new patch to allow devargs with same PCI BDF but different representors.
- other minor code updates according to comments, thanks Andrew!
- update document
V3:
- improve probing of allowed devargs with same name.
- parse single word of kvargs as key.
- update kvargs test cases.
Quoted 8 lines
V4:
- split first representor refactor patch into
1: add representor type
2: refector representor list parsing
- push the patch supporting multi-devargs for same device.
V5:
- add comments for parsing functions
- updateswitch_representation.rst- Thanks Ajit
Hi,
The series can't recognize i40e device, so testpmd start failed.
./x86_64-native-linuxapp-gcc/app/dpdk-testpmd -l 4-8 -n 6 -a 17:00.0 -- -i --txq=2 --rxq=2 <...> EAL: Probe PCI driver: net_i40e (8086:158b) device: 0000:17:00.0 (socket 0) EAL: No legacy callbacks, legacy socket not created testpmd: No probed ethernet devices Interactive-mode selected Fail: input txq (2) can't be greater than max_tx_queues (0) of port 0 EAL: Error - exiting with code: 1 Cause: txq 2 invalid - must be >= 0 && <= 0
thanks
PATCH v5 1/9 ethdev: introduce representor type
In reply to Xueming LiTo support more representor type, this patch introduces representor type enum. The enum is subject to extend for new types upcoming.
--- drivers/net/bnxt/bnxt_ethdev.c | 7 +++++++ drivers/net/enic/enic_ethdev.c | 7 +++++++ drivers/net/i40e/i40e_ethdev.c | 8 ++++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++++ drivers/net/mlx5/linux/mlx5_os.c | 11 +++++++++++ lib/librte_ethdev/ethdev_private.c | 5 +++++ lib/librte_ethdev/rte_ethdev_driver.h | 9 +++++++++ 7 files changed, 55 insertions(+)
drivers/net/bnxt/bnxt_ethdev.c +7 -0
@@ -5586,6 +5586,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
drivers/net/enic/enic_ethdev.c +7 -0
@@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval)return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,
drivers/net/i40e/i40e_ethdev.c +8 -0
@@ -638,6 +638,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,return retval; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/ixgbe/ixgbe_ethdev.c +8 -0
@@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/mlx5/linux/mlx5_os.c +11 -0
@@ -705,6 +705,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type !=RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)
lib/librte_ethdev/ethdev_private.c +5 -0
@@ -111,11 +111,16 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,return 0 ; } +/* +* representor format: +* #: range or single number of VF representor +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; + eth_da->type =RTE_ETH_REPRESENTOR_VF ;return rte_eth_devargs_process_range (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); }
lib/librte_ethdev/rte_ethdev_driver.h +9 -0
@@ -1193,6 +1193,14 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); +/** Ethernet device representor port type */ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of Virtual Function. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of Sub Function. */ +RTE_ETH_REPRESENTOR_PF ,/**< representor of host Physical Function. */ +}; +/** Generic Ethernet device arguments */ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];
@@ -1203,6 +1211,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/**
Signature · 1 line
2.25.1
PATCH v5 2/9 ethdev: support representor port list
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and ranges
--- lib/librte_ethdev/ethdev_private.c | 124 ++++++++++++++++------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- 4 files changed, 72 insertions(+), 64 deletions(-)
lib/librte_ethdev/ethdev_private.c +69 -55
@@ -38,82 +38,93 @@ eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) +/* Put new value into list. */ +static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val) { -char *str_start; -int state; -int result; +uint16_t i; -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; - -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; +if (*len_list >= max_list) +return -1 ; +for (i =0 ; i < *len_list; i++) { +if (list[i] == val) +return 0 ; } + list[(*len_list)++] = val;return 0 ; } -static int +/* Parse and enlist a range expression of "min-max" or a single value. */ +static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val;int result; +char *pos = str; result =sscanf (str,"%hu-%hu" , &lo, &hi);if (result ==1 ) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = lo; +if (rte_eth_devargs_enlist (list, len_list, max_list, lo) !=0 ) +return NULL ; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) -return -EINVAL ; +if (lo >= hi) +return NULL ;for (val = lo; val <= hi; val++) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = val; +if (rte_eth_devargs_enlist (list, len_list, max_list, + val) !=0 ) +return NULL ; } }else -return -EINVAL ; -return 0 ; +return NULL ; +while (*pos !=0 && ((*pos >='0' && *pos <='9' ) || *pos =='-' )) + pos++; +return pos; +} + +/* +* Parse list of values separated by ",". +* Each value could be a range [min-max] or single number. +* Examples: +* 2 - single +* [1,2,3] - single list +* [1,3-5,7,9-11] - list with singles and ranges +*/ +static char * +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; + +if (*pos =='[' ) + pos++; +while (1 ) { + pos =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (pos ==NULL ) +return NULL ; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return NULL ; +if (*pos ==']' ) + pos++; +return pos; }/* -* representor format: +* Parse representor ports from a single value or lists. +* +* Representor format: * #: range or single number of VF representor +* +* Examples of #: +* 2 - single +* [1,2,3] - single list +* [1,3-5,7,9-11] - list with singles and ranges */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -121,6 +132,9 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data; eth_da->type =RTE_ETH_REPRESENTOR_VF ; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, + str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +if (str ==NULL ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return str ==NULL ?-1 :0 ; }
lib/librte_ethdev/ethdev_private.h +0 -3
@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus
lib/librte_ethdev/rte_class_eth.c +1 -3
@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */
lib/librte_ethdev/rte_ethdev.c +2 -3
@@ -5561,9 +5561,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 2/9] ethdev: support representor port list
Quoted 9 lines · Xueming Li
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
It looks like my comments to the previous version are all applicable here. Sorry, I should review this one from the very beginning.
Re: [dpdk-dev] [PATCH v5 2/9] ethdev: support representor port list
Quoted 18 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 3:48 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 2/9] ethdev: support representor port listQuoted 6 lines · Xueming Li
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and ranges
Quoted 6 lines
Quoted 3 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>It looks like my comments to the previous version are all applicable here. Sorry, I should review this one from the very beginning.
NP, noted and WIP.
PATCH v5 3/9 ethdev: support new VF representor syntax
In reply to Xueming LiCurrent VF representor syntax:
representor=2 - single representor
representor=[0-3] - single range
To prepare for more representor types, this patch adds compatible VF representor devargs syntax:
vf#:
representor=vf2 - single representor representor=vf[1,3,5] - single list representor=vf[0-3] - single range representor=vf[0,1,4-7] - list with singles and range
For backwards compatibility, representor "#" is interpreted as "vf#".
--- doc/guides/prog_guide/poll_mode_drv.rst | 7 ++++--- lib/librte_ethdev/ethdev_private.c | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +4 -3
@@ -374,9 +374,10 @@ parameters to those ports. this argument allows user to specify which switch ports to enable port representors for.:: - -a DBDF,representor=0 - -a DBDF,representor=[0,4,6,9] - -a DBDF,representor=[0-31] + -a DBDF,representor=vf0 + -a DBDF,representor=vf[0,4,6,9] + -a DBDF,representor=vf[0-31] + -a DBDF,representor=vf[0,2-4,7,9-11] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -119,7 +119,8 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,* Parse representor ports from a single value or lists. * * Representor format: -* #: range or single number of VF representor +* #: range or single number of VF representor - legacy +* vf#: VF port representor/s * * Examples of #: * 2 - single
@@ -132,6 +133,8 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data; eth_da->type =RTE_ETH_REPRESENTOR_VF ; +if (str[0 ] =='v' && str[1 ] =='f' ) + str +=2 ; str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (str ==NULL )
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 3/9] ethdev: support new VF representor syntax
Quoted 13 lines · Xueming Li
Current VF representor syntax:
representor=2 - single representor
representor=[0-3] - single rangeTo prepare for more representor types, this patch adds compatible VF representor devargs syntax:
vf#:
representor=vf2 - single representor representor=vf[1,3,5] - single list representor=vf[0-3] - single range representor=vf[0,1,4-7] - list with singles and range
Quoted 5 lines
For backwards compatibility, representor "#" is interpreted as "vf#".
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
PATCH v5 4/9 ethdev: support sub function representor
In reply to Xueming LiSubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.
To support SF representor, this patch introduces new devargs syntax, examples:
representor=sf0 - single SubFunction representor representor=sf[1,3,5] - single list representor=sf[0-3], - single range
representor=sf[0,2-6,8,10-12] - list with singles and ranges
--- doc/guides/prog_guide/poll_mode_drv.rst | 4 +++ .../prog_guide/switch_representation.rst | 35 +++++++++++++------ lib/librte_ethdev/ethdev_private.c | 11 ++++-- 3 files changed, 38 insertions(+), 12 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +4 -0
@@ -378,6 +378,10 @@ parameters to those ports. -a DBDF,representor=vf[0,4,6,9] -a DBDF,representor=vf[0-31] -a DBDF,representor=vf[0,2-4,7,9-11] + -a DBDF,representor=sf0 + -a DBDF,representor=sf[1,3,5] + -a DBDF,representor=sf[0-1023] + -a DBDF,representor=sf[0,2-4,7,9-11] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
doc/guides/prog_guide/switch_representation.rst +25 -10
@@ -13,7 +13,7 @@ Introduction Network adapters with multiple physical ports and/or SR-IOV capabilities usually support the offload of traffic steering rules between their virtual -functions (VFs), physical functions (PFs) and ports. +functions (VFs), sub functions (SFs), physical functions (PFs) and ports. Like for standard Ethernet switches, this involves a combination of automatic MAC learning and manual configuration. For most purposes it is
@@ -24,7 +24,7 @@ layer 2 (L2) traffic (such as OVS) need to steer traffic themselves according on their own criteria. Without a standard software interface to manage traffic steering rules -between VFs, PFs and the various physical ports of a given device, +between VFs, SFs, PFs and the various physical ports of a given device, applications cannot take advantage of these offloads; software processing is mandatory even for traffic which ends up re-injected into the device it originates from.
@@ -34,6 +34,17 @@ the DPDK flow API (**rte_flow**), with emphasis on the SR-IOV use case (PF/VF steering) using a single physical port for clarity, however the same logic applies to any number of ports without necessarily involving SR-IOV. +Sub Function +------------ +Besides SR-IOV, Sub function is a portion of the PCI device, a SF netdev +has its own dedicated queues(txq, rxq). A SF netdev supports E-Switch +representation offload similar to existing PF and VF representors. +A SF shares PCI level resources with other SFs and/or with its parent PCI +function. + +Sub function is created on-demand, coexists with VFs. Number of SFs is +limited by hardware resources. + Port Representors -----------------
@@ -42,15 +53,16 @@ applications usually have to process a bit of traffic in software before thinking about offloading specific flows to hardware. Applications therefore need the ability to receive and inject traffic to -various device endpoints (other VFs, PFs or physical ports) before +various device endpoints (other VFs, SFs, PFs or physical ports) before connecting them together. Device drivers must provide means to hook the "other end" of these endpoints and to refer them when configuring flow rules. This role is left to so-called "port representors" (also known as "VF -representors" in the specific context of VFs), which are to DPDK what the -Ethernet switch device driver model (**switchdev**) [1]_ is to Linux, and -which can be thought as a software "patch panel" front-end for applications. +representors" in the specific context of VFs, "SF representors" in the +specific context of SFs), which are to DPDK what the Ethernet switch +device driver model (**switchdev**) [1]_ is to Linux, and which can be +thought as a software "patch panel" front-end for applications. - DPDK port representors are implemented as additional virtual Ethernet device (**ethdev**) instances, spawned on an as needed basis through
@@ -59,9 +71,12 @@ which can be thought as a software "patch panel" front-end for applications. :: - -a pci:dbdf,representor=0 - -a pci:dbdf,representor=[0-3] - -a pci:dbdf,representor=[0,5-11] + -a pci:dbdf,representor=vf0 + -a pci:dbdf,representor=vf[0-3] + -a pci:dbdf,representor=vf[0,5-11] + -a pci:dbdf,representor=sf1 + -a pci:dbdf,representor=sf[0-1023] + -a pci:dbdf,representor=sf[0,2-1023] - As virtual devices, they may be more limited than their physical counterparts, for instance by exposing only a subset of device
@@ -360,7 +375,7 @@ Compared to creating a brand new dedicated interface, **rte_flow** was deemed flexible enough to manage representor traffic only with minor extensions: -- Using physical ports, PF, VF or port representors as targets. +- Using physical ports, PF, SF, VF or port representors as targets. - Affecting traffic that is not necessarily addressed to the DPDK port ID a flow rule is associated with (e.g. forcing VF traffic redirection to PF).
lib/librte_ethdev/ethdev_private.c +9 -2
@@ -121,6 +121,7 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,* Representor format: * #: range or single number of VF representor - legacy * vf#: VF port representor/s +* sf#: SF port representor/s * * Examples of #: * 2 - single
@@ -132,9 +133,15 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) {struct rte_eth_devargs *eth_da = data; - eth_da->type =RTE_ETH_REPRESENTOR_VF ; -if (str[0 ] =='v' && str[1 ] =='f' ) +if (str[0 ] =='v' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ; + }else if (str[0 ] =='s' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_SF ; + str +=2 ; + }else { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + } str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS );if (str ==NULL )
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 4/9] ethdev: support sub function representor
Quoted 7 lines · Xueming Li
SubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated
queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.To support SF representor, this patch introduces new devargs syntax, examples:
Quoted 8 lines
representor=sf0 - single SubFunction representor representor=sf[1,3,5] - single list representor=sf[0-3], - single rangerepresentor=sf[0,2-6,8,10-12] - list with singles and ranges
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
PATCH v5 5/9 ethdev: support PF index in representor
In reply to Xueming LiWith Kernel bonding, multiple underlying PFs are bonded, VFs come from different PF, need to identify representor of VFs unambiguously by adding PF index.
This patch introduces optional 'pf' section to representor devargs syntax, examples:
representor=pf0vf0 - single VF representor
representor=pf[0-1]sf[0-1023] - SF representors from 2 PFs
--- doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +2 -0
@@ -382,6 +382,8 @@ parameters to those ports. -a DBDF,representor=sf[1,3,5] -a DBDF,representor=sf[0-1023] -a DBDF,representor=sf[0,2-4,7,9-11] + -a DBDF,representor=pf1vf0 + -a DBDF,representor=pf[0-1]sf[0-127] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +11 -2
@@ -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 -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [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 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS ); +if (str ==NULL ) + goto err; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;
@@ -144,6 +152,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) } str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 5/9] ethdev: support PF index in representor
Quoted 8 lines · Xueming Li
With Kernel bonding, multiple underlying PFs are bonded, VFs come from different PF, need to identify representor of VFs unambiguously by adding PF index.
This patch introduces optional 'pf' section to representor devargs syntax, examples:
representor=pf0vf0 - single VF representor
representor=pf[0-1]sf[0-1023] - SF representors from 2 PFs
Don't we need
representor=pf3
i.e. without VF or sub-function?
Quoted 39 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)doc/guides/prog_guide/poll_mode_drv.rst +2
-0@@ -382,6 +382,8 @@ parameters to those ports. -a DBDF,representor=sf[1,3,5] -a DBDF,representor=sf[0-1023] -a DBDF,representor=sf[0,2-4,7,9-11] + -a DBDF,representor=pf1vf0 + -a DBDF,representor=pf[0-1]sf[0-127] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.lib/librte_ethdev/ethdev_private.c +2
-2@@ -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 -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [pf#]sf#: SF port representor/s * * Examples of #: * 2 - single
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 140
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +5
-0@@ -133,6 +133,14 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) {struct rte_eth_devargs *eth_da = data; +if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS );
May be RTE_MAX_ETHPORTS -> RTE_DIM(eth_da->ports) ?
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 142
Quoted 2 lines
lib/librte_ethdev/ethdev_private.c +2
-0+if (str ==NULL ) + goto err;
Below we should not allow legacy VF syntax without "vf" prefix.
Quoted 13 lines
lib/librte_ethdev/ethdev_private.c +2
-0+ }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;@@ -144,6 +152,7 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) } str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
Re: [dpdk-dev] [PATCH v5 5/9] ethdev: support PF index in representor
Hi Andrew,
Quoted 20 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:01 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 5/9] ethdev: support PF index in representorQuoted 8 lines · Xueming Li
With Kernel bonding, multiple underlying PFs are bonded, VFs come from different PF, need to identify representor of VFs unambiguously by adding PF index.
This patch introduces optional 'pf' section to representor devargs syntax, examples:
representor=pf0vf0 - single VF representor
representor=pf[0-1]sf[0-1023] - SF representors from 2 PFs
Quoted 3 lines
Don't we need
representor=pf3
i.e. without VF or sub-function?
Standalone PF not used by Mellnaox PMD, but should be supported. Will update.
Quoted 47 lines
Quoted 24 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)doc/guides/prog_guide/poll_mode_drv.rst +2
-0@@ -382,6 +382,8 @@ parameters to those ports. -a DBDF,representor=sf[1,3,5] -a DBDF,representor=sf[0-1023] -a DBDF,representor=sf[0,2-4,7,9-11] + -a DBDF,representor=pf1vf0 + -a DBDF,representor=pf[0-1]sf[0-127] Note: PMDs are not required to support the standard device argumentsQuoted 1 line
and users should consult the relevant PMD documentation to see support
devargs.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_list(char *str, uint16_t
Quoted 6 lines
lib/librte_ethdev/ethdev_private.c +0
-0@@ -120,8 +120,8 @@ rte_eth_devargs_process_list(char *str, uint16_t*list,
uint16_t*len_list,Quoted 14 lines
lib/librte_ethdev/ethdev_private.c +2
-2* * Representor format: * #: range or single number of VF representor - legacy -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [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;
Quoted 7 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 140
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c +5
-0+if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS );May be
RTE_MAX_ETHPORTS->RTE_DIM(eth_da->ports)?
Same here, the dim could be different than MAX value.
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 142
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +2
-0+if (str ==NULL ) + goto err;Below we should not allow legacy VF syntax without "vf" prefix.
For backward compatibility, default numbers to "vf", otherwise some existing app like OVS that working with VF will break.
Quoted 15 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str,
Quoted 6 lines
lib/librte_ethdev/ethdev_private.c +1
-0+ }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;@@ -144,6 +152,7 @@ rte_eth_devargs_parse_representor_ports(char *str,void *data)
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +1
-0} str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
Re: [dpdk-dev] [PATCH v5 5/9] ethdev: support PF index in representor
Quoted 83 lines · Xueming(Steven) Li
Hi Andrew,
Quoted 20 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:01 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 5/9] ethdev: support PF index in representorQuoted 8 lines · Xueming Li
With Kernel bonding, multiple underlying PFs are bonded, VFs come from different PF, need to identify representor of VFs unambiguously by adding PF index.
This patch introduces optional 'pf' section to representor devargs syntax, examples:
representor=pf0vf0 - single VF representor
representor=pf[0-1]sf[0-1023] - SF representors from 2 PFsQuoted 3 lines
Don't we need
representor=pf3
i.e. without VF or sub-function?Standalone PF not used by Mellnaox PMD, but should be supported. Will update.
Quoted 47 lines
Quoted 24 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)doc/guides/prog_guide/poll_mode_drv.rst +2
-0@@ -382,6 +382,8 @@ parameters to those ports. -a DBDF,representor=sf[1,3,5] -a DBDF,representor=sf[0-1023] -a DBDF,representor=sf[0,2-4,7,9-11] + -a DBDF,representor=pf1vf0 + -a DBDF,representor=pf[0-1]sf[0-127] Note: PMDs are not required to support the standard device argumentsQuoted 1 line
and users should consult the relevant PMD documentation to see support
devargs.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_list(char *str, uint16_t
Quoted 6 lines
lib/librte_ethdev/ethdev_private.c +0
-0@@ -120,8 +120,8 @@ rte_eth_devargs_process_list(char *str, uint16_t*list,
uint16_t*len_list,Quoted 14 lines
lib/librte_ethdev/ethdev_private.c +2
-2* * Representor format: * #: range or single number of VF representor - legacy -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [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;Quoted 7 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 140
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c +5
-0+if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS );May be
RTE_MAX_ETHPORTS->RTE_DIM(eth_da->ports)?
Quoted 1 line
Same here, the dim could be different than MAX value.
Hold on, just for my understanding. The maximum says how many entries could be added to the array. So, why?
Quoted 8 lines
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 142
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +2
-0+if (str ==NULL ) + goto err;Below we should not allow legacy VF syntax without "vf" prefix.
For backward compatibility, default numbers to "vf", otherwise some existing app like OVS that working with VF will break.
I mean if new syntax is used (i.e. we have pfX prefix), we must deny legacy syntax for VFs below.
Quoted 16 lines
Quoted 15 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str,
Quoted 6 lines
lib/librte_ethdev/ethdev_private.c +1
-0+ }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;@@ -144,6 +152,7 @@ rte_eth_devargs_parse_representor_ports(char *str,void *data)
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +1
-0} str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
Re: [dpdk-dev] [PATCH v5 5/9] ethdev: support PF index in representor
Quoted 95 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 5:36 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 5/9] ethdev: support PF index in representorQuoted 84 lines · Xueming(Steven) Li
Hi Andrew,
Quoted 20 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:01 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 5/9] ethdev: support PF index in representorQuoted 8 lines · Xueming Li
With Kernel bonding, multiple underlying PFs are bonded, VFs come from different PF, need to identify representor of VFs unambiguously by adding PF index.
This patch introduces optional 'pf' section to representor devargs syntax, examples:
representor=pf0vf0 - single VF representor
representor=pf[0-1]sf[0-1023] - SF representors from 2 PFsQuoted 3 lines
Don't we need
representor=pf3
i.e. without VF or sub-function?Standalone PF not used by Mellnaox PMD, but should be supported. Will update.
Quoted 55 lines
Quoted 24 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)doc/guides/prog_guide/poll_mode_drv.rst +2
-0@@ -382,6 +382,8 @@ parameters to those ports. -a DBDF,representor=sf[1,3,5] -a DBDF,representor=sf[0-1023] -a DBDF,representor=sf[0,2-4,7,9-11] + -a DBDF,representor=pf1vf0 + -a DBDF,representor=pf[0-1]sf[0-127] Note: PMDs are not required to support the standard deviceQuoted 2 lines
arguments and users should consult the relevant PMD documentation to see support
devargs.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_list(char *str, uint16_t
Quoted 6 lines
lib/librte_ethdev/ethdev_private.c +0
-0@@ -120,8 +120,8 @@ rte_eth_devargs_process_list(char *str, uint16_t*list,
uint16_t*len_list,Quoted 11 lines
lib/librte_ethdev/ethdev_private.c +2
-2* * Representor format: * #: range or single number of VF representor - legacy -* vf#: VF port representor/s -* sf#: SF port representor/s +* [pf#]vf#: VF port representor/s +* [pf#]sf#: SF port representor/s * * Examples of #: * 2 - single lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char · line 140
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +5
-0@@ -133,6 +133,14 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) {struct rte_eth_devargs *eth_da = data; +if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ; + str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_MAX_ETHPORTS );May be
RTE_MAX_ETHPORTS->RTE_DIM(eth_da->ports)?
Quoted 4 lines
Quoted 1 line
Same here, the dim could be different than MAX value.
Hold on, just for my understanding. The maximum says how many entries could be added to the array. So, why?
Right, will change to RTE_DIM(), thanks!
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 142
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +2
-0+if (str ==NULL ) + goto err;Below we should not allow legacy VF syntax without "vf" prefix.
Quoted 5 lines
Quoted 2 lines
For backward compatibility, default numbers to "vf", otherwise some existing app like OVS that working with VF will break.
I mean if new syntax is used (i.e. we have pfX prefix), we must deny legacy syntax for VFs below.
Correct, will add check, thanks!
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char · line 152
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +1
-0+ }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;@@ -144,6 +152,7 @@ rte_eth_devargs_parse_representor_ports(char *str,void *data)
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +1
-0} str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str == NULL ? -1 : 0;
PATCH v5 6/9 ethdev: support multi-host in representor
In reply to Xueming LiThe 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.
--- 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(-)
config/rte_config.h +1 -0
@@ -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
lib/librte_ethdev/ethdev_private.c +10 -2
@@ -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, + ð_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 ;
lib/librte_ethdev/rte_ethdev_driver.h +4 -0
@@ -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;
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 6/9] ethdev: support multi-host in representor
Quoted 57 lines · Xueming Li
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 <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- 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(-)config/rte_config.h +1
-0@@ -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 64lib/librte_ethdev/ethdev_private.c +2
-2@@ -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
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 142
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +7
-0@@ -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, + ð_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.
Quoted 20 lines
lib/librte_ethdev/ethdev_private.c +1
-0+ }if (str[0 ] =='p' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_PF ; str +=2 ;lib/librte_ethdev/rte_ethdev_driver.h +4
-0@@ -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;
Re: [dpdk-dev] [PATCH v5 6/9] ethdev: support multi-host in representor
Quoted 73 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:03 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Bruce Richardson <[email protected]>; NBU- Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 6/9] ethdev: support multi-host in representorlib/librte_ethdev/ethdev_private.c rte_eth_devargs_process_list(char *str, uint16_t
Quoted 47 lines · Xueming Li
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 <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- 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(-)config/rte_config.h index renamed from config/rte_config.h +0
-0
a0b5160ff2..23d02d51ef100644config/rte_config.h +0
-0@@ -58,6 +58,7 @@#define RTE_MAX_QUEUES_PER_PORT 1024 #define RTE_ETHDEV_QUEUE_STAT_CNTRS 16 /* max 256 */ #define
RTE_ETHDEV_RXTX_CALLBACKS1config/rte_config.h +1
-0+#define RTE_MAX_MULTI_HOST_CTRLS 4/* cryptodev defines */ #define RTE_CRYPTO_MAX_DEVS 64lib/librte_ethdev/ethdev_private.c +0
-0@@ -120,8 +120,8 @@ rte_eth_devargs_process_list(char *str, uint16_t*list,
uint16_t*len_list,Quoted 14 lines
lib/librte_ethdev/ethdev_private.c +2
-2* * 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;
Quoted 11 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 142
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +7
-0+if (str[0 ] =='c' ) { + str +=1 ; + str =rte_eth_devargs_process_list (str, eth_da- mh_controllers, + ð_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.
Quoted 21 lines
Quoted 21 lines
lib/librte_ethdev/ethdev_private.c +1
-0+ }if (str[0 ] =='p' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_PF ;lib/librte_ethdev/ethdev_private.c +0
-0str +=2 ;lib/librte_ethdev/rte_ethdev_driver.h +4
-0@@ -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 v5 7/9 devarg: change representor ID to bitmap
In reply to Xueming LiThe NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if any).
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx
|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf id
LL controller(host) id
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
In the future, the representor ID field and each section should extend to bigger width to support more devices.
--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/rte_class_eth.c | 38 +++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 53 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 9 files changed, 122 insertions(+), 13 deletions(-)
drivers/net/bnxt/bnxt_reps.c +2 -1
@@ -186,7 +186,8 @@ int bnxt_representor_init(struct rte_eth_dev *eth_dev, void *params) eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = rep_params->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , rep_params->vf_id);rte_eth_random_addr (vf_rep_bp->dflt_mac_addr); memcpy(vf_rep_bp->mac_addr, vf_rep_bp->dflt_mac_addr,
drivers/net/enic/enic_vf_representor.c +2 -1
@@ -674,7 +674,8 @@ int enic_vf_representor_init(struct rte_eth_dev *eth_dev, void *init_params) eth_dev->dev_ops = &enic_vf_representor_dev_ops; eth_dev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - eth_dev->data->representor_id = vf->vf_id; + eth_dev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , vf->vf_id); eth_dev->data->mac_addrs =rte_zmalloc ("enic_mac_addr_vf" ,sizeof (struct rte_ether_addr ) *ENIC_UNICAST_PERFECT_FILTERS ,0 );
drivers/net/i40e/i40e_vf_representor.c +2 -1
@@ -510,7 +510,8 @@ i40e_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params) ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR |RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Setting the number queues allocated to the VF */ ethdev->data->nb_rx_queues = vf->vsi->nb_qps;
drivers/net/ixgbe/ixgbe_vf_representor.c +2 -1
@@ -196,7 +196,8 @@ ixgbe_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)return -ENODEV ; ethdev->data->dev_flags |=RTE_ETH_DEV_REPRESENTOR ; - ethdev->data->representor_id = representor->vf_id; + ethdev->data->representor_id =rte_eth_representor_id_encode ( +0 ,0 ,RTE_ETH_REPRESENTOR_VF , representor->vf_id);/* Set representor device ops */ ethdev->dev_ops = &ixgbe_vf_representor_dev_ops;
drivers/net/mlx5/linux/mlx5_os.c +3 -1
@@ -1025,7 +1025,9 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,#endif /* representor_id field keeps the unmodified VF index. */ priv->representor_id = switch_info->representor ? - switch_info->port_name :-1 ; +rte_eth_representor_id_encode (0 ,0 ,RTE_ETH_REPRESENTOR_VF , + switch_info->port_name) : +-1 ;/* * Look for sibling devices in order to reuse their switch domain * if any, otherwise allocate one.
lib/librte_ethdev/rte_class_eth.c +30 -8
@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +76,39 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_representor_ports (values, &representors); +memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }
lib/librte_ethdev/rte_ethdev.c +26 -0
@@ -5575,6 +5575,32 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{ +if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,
lib/librte_ethdev/rte_ethdev_driver.h +53 -0
59 lines not on this page · raw message
lib/librte_ethdev/version.map +2 -0
@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse; rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind;
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 7/9] devarg: change representor ID to bitmap
Quoted 79 lines
-----Original Message-----
From: Xueming Li <[email protected]>
Sent: Tuesday, January 19, 2021 15:15
Cc: [email protected]; Viacheslav Ovsiienko <[email protected]>; [email protected]; Asaf Penso <[email protected]>; Ajit Khaparde <[email protected]>; Somnath Kotur <[email protected]>; Daley, John <[email protected]>; Hyong Youb Kim <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: [PATCH v5 7/9] devarg: change representor ID to bitmapThe NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if any).
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf idLL controller(host) id
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
In the future, the representor ID field and each section should extend to bigger width to support more devices.
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/rte_class_eth.c | 38 +++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 53 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 9 files changed, 122 insertions(+), 13 deletions(-)lib/librte_ethdev/rte_ethdev.c +16
-0+uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5603
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} +
Rename 'parse' to 'decode' ? Since not parse from string. ;-) The these two functions are pair style.
rte_eth_representor_id_encode / rte_eth_representor_id_decode ?
Quoted 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 7/9] devarg: change representor ID to bitmap
Hi Haiyue,
Quoted 108 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, January 19, 2021 3:37 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Ajit Khaparde <[email protected]>; Somnath Kotur <[email protected]>; Daley, John <[email protected]>; Hyong Youb Kim <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact- Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: RE: [PATCH v5 7/9] devarg: change representor ID to bitmapQuoted 7 lines
-----Original Message-----
From: Xueming Li <[email protected]>
Sent: Tuesday, January 19, 2021 15:15
Cc: [email protected]; Viacheslav Ovsiienko <[email protected]>; [email protected]; Asaf Penso <[email protected]>; Ajit Khaparde <[email protected]>; Somnath Kotur <[email protected]>; Daley, John <[email protected]>;Hyong
Quoted 9 lines
Youb Kim <[email protected]>; Xing, Beilei <[email protected]>; Guo, Jia <[email protected]>; Wang, Haiyue <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Thomas Monjalon <[email protected]>; Yigit, Ferruh <[email protected]>; Andrew Rybchenko <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: [PATCH v5 7/9] devarg: change representor ID to bitmapQuoted 5 lines
The NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if
any).
Quoted 58 lines
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf idLL controller(host) id
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
In the future, the representor ID field and each section should extend to bigger width to support more devices.
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- drivers/net/bnxt/bnxt_reps.c | 3 +- drivers/net/enic/enic_vf_representor.c | 3 +- drivers/net/i40e/i40e_vf_representor.c | 3 +- drivers/net/ixgbe/ixgbe_vf_representor.c | 3 +- drivers/net/mlx5/linux/mlx5_os.c | 4 +- lib/librte_ethdev/rte_class_eth.c | 38 +++++++++++++---- lib/librte_ethdev/rte_ethdev.c | 26 ++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 53 ++++++++++++++++++++++++ lib/librte_ethdev/version.map | 2 + 9 files changed, 122 insertions(+), 13 deletions(-)lib/librte_ethdev/rte_ethdev.c +12
-0+uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ +return (((controller &3 ) <<14 ) | + ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port &0x7ff )); +} + +uint16_t lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+rte_eth_representor_id_parse(const uint16_t representor_id, + uint16_t *controller, uint16_t *pf, + enum rte_eth_representor_type *type) { + if (controller) + *controller = (representor_id >>14 ) &3 ; +if (pf) + *pf = (representor_id >>12 ) &3 ; +if (type) + *type = ((representor_id >>11 ) &1 ) ? + RTE_ETH_REPRESENTOR_SF :
RTE_ETH_REPRESENTOR_VF;
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5603
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+return representor_id &0x7ff ; +} +Rename 'parse' to 'decode' ? Since not parse from string. ;-) The these two functions are pair style.
rte_eth_representor_id_encode/rte_eth_representor_id_decode?
Nice catch, thanks!
Quoted 2 lines
Quoted 2 lines
2.25.1
Re: [dpdk-dev] [PATCH v5 7/9] devarg: change representor ID to bitmap
In reply to Xueming LiQuoted 20 lines · Xueming Li
The NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if any).
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Quoted 6 lines
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf idLL controller(host) id
What about PF representor case? I.e. representor for entire PF.
Also it implies that controller ID 0 is the caller. I.e. special meaning. So, space for just 3 specific contoller left
Similar for PF. In fact it is worse. E.g. PMD is bound to the second PF (PF number 1). If so, vf0 means the first VF of the PF itself, i.e. PF 1 VF 0. But, pf0vf0 should mean PF 1 VF 1.
Quoted 89 lines
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
In the future, the representor ID field and each section should extend to bigger width to support more devices.
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>lib/librte_ethdev/rte_class_eth.c +30
-8@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */ @@ -76,17 +76,39 @@ eth_representor_cmp(const char *key __rte_unused, values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_representor_ports (values, &representors); +memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }lib/librte_ethdev/rte_ethdev.c +7
-0@@ -5575,6 +5575,32 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ + return (((controller & 3) << 14) | + ((pf & 3) << 12) |
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5594
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port & 0x7ff)); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) +{ +if (controller)
Compare vs NULL in accordance with DPDK coding style guide
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5596
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+ *controller = (representor_id >>14 ) &3 ; +if (pf)
Compare vs NULL in accordance with DPDK coding style guide
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5598
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+ *pf = (representor_id >>12 ) &3 ; +if (type)
Compare vs NULL in accordance with DPDK coding style guide
Quoted 77 lines
lib/librte_ethdev/rte_ethdev.c +5
-0+ *type = ((representor_id >>11 ) &1 ) ? +RTE_ETH_REPRESENTOR_SF :RTE_ETH_REPRESENTOR_VF ; +return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,lib/librte_ethdev/rte_ethdev_driver.h +53
-0@@ -1218,6 +1218,59 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +#define RTE_NO_REPRESENTOR_ID UINT16_MAX/**< No representor ID. */ + +/** +* PMD helper function to encode representor ID +* +* The compact format is used for device iterator that comparing +* ethdev representor ID with target devargs. +* +* xxxx xxxx xxxx xxxx +* |||| |LLL LLLL LLLL vf/sf id +* |||| L 1:sf, 0:vf +* ||LL pf id +* LL controller(host) id +* +* @param controller +* Controller ID. +* @param pf +* PF port ID. +* @param type +* Representor type. +* @param representor_port +* Representor port ID. +* +* @return +* Encoded representor ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port); + +/** +* PMD helper function to parse representor ID +* +* @param representor_id +* Representor ID. +* @param controller +* Parsed controller ID. +* @param pf +* Parsed PF port ID. +* @param type +* Parsed representor type. +* +* @return +* Parsed representor port ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type); +/** * PMD helper function to parse ethdev arguments * lib/librte_ethdev/version.map +0
-0
lib/librte_ethdev/version.map INTERNAL { · line 261
Quoted 5 lines
lib/librte_ethdev/version.map +2
-0@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse;
The place looks wrong. It must be sorted or added at bottom with the comment with version number. I'd prefer to have it simply alphanumberically sorted.
Quoted 4 lines
lib/librte_ethdev/version.map +0
-0rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind;
Re: [dpdk-dev] [PATCH v5 7/9] devarg: change representor ID to bitmap
19/01/2021 09:20, Andrew Rybchenko:
Quoted 5 lines · Xueming Li
Quoted 4 lines
lib/librte_ethdev/version.map +0
-0@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port;
Quoted 8 lines
lib/librte_ethdev/version.map INTERNAL { · line 261
Quoted 4 lines
lib/librte_ethdev/version.map +2
-0rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse;The place looks wrong. It must be sorted or added at bottom with the comment with version number. I'd prefer to have it simply alphanumberically sorted.
We add a version number for experimental symbols to help moving old ones to stable.
In this case, they are internal symbols, so we don't need version, but you're right it must be alphabetically sorted.
Re: [dpdk-dev] [PATCH v5 7/9] devarg: change representor ID to bitmap
In reply to Andrew RybchenkoQuoted 45 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:21 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Ajit Khaparde <[email protected]>; Somnath Kotur <[email protected]>; John Daley <[email protected]>; Hyong Youb Kim <[email protected]>; Beilei Xing <[email protected]>; Jeff Guo <[email protected]>; Haiyue Wang <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v5 7/9] devarg: change representor ID to bitmapQuoted 5 lines · Xueming Li
The NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if
any).
Quoted 15 lines
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Quoted 6 lines
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf idLL controller(host) id
Quoted 8 lines
What about PF representor case? I.e. representor for entire PF.
Also it implies that controller ID 0 is the caller. I.e. special meaning. So, space for just 3 specific contoller left
Similar for PF. In fact it is worse. E.g. PMD is bound to the second PF (PF number 1). If so, vf0 means the first VF of the PF itself, i.e. PF 1 VF 0. But, pf0vf0 should mean PF 1 VF 1.
Agree, need to extend bits width in LTS release.
PF representor is not considered here, how about moving one bit from vf/sf id? 1k SF devices should be fine for me so far.
The controller ID and PF ID is related to the context device, how device configured and bonding state is critical for PMD to interpret the IDs. For example:
"<BDF>,representor=pf1vf1" is valid for bonding device, invalid for standalone device. "c#" is meaningful for multi-host scenario, invalid for normal NIC. PMD is responsible to encode representor ID correctly according to device configuration to make Device+ReprID unique, because the ReprID is used in device iterator. So the user app should specify representor syntax with necessary parts to cover device configuration, PMD should extract required info according to device state.
Quoted 208 lines
Quoted 31 lines
This approach keeps binary compatibility with all drivers, VF representor id matches with simple id for non-bonding and non-multi-host configurations.
In the future, the representor ID field and each section should extend to bigger width to support more devices.
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>lib/librte_ethdev/rte_class_eth.c +2
-2@@ -66,8 +66,8 @@ eth_representor_cmp(const char *key __rte_unused,int ret;char *values;const struct rte_eth_dev_data *data = opaque; -struct rte_eth_devargs representors; -uint16_t index; +struct rte_eth_devargs eth_da; +uint16_t index, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 ) return -1; /* not a representor port */ @@ -76,17 +76,39 @@eth_representor_cmp(const char *key
__rte_unused,lib/librte_ethdev/rte_class_eth.c eth_representor_cmp(const char *key __rte_unused,
Quoted 5 lines
lib/librte_ethdev/rte_class_eth.c +0
-2values =strdup (value);if (values ==NULL )return -1 ; -memset (&representors,0 ,sizeof (representors)); - ret = rte_eth_devargs_parse_representor_ports(values,&representors);
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct
Quoted 45 lines
lib/librte_ethdev/rte_class_eth.c +28
-4+memset (ð_da,0 ,sizeof (eth_da)); + ret =rte_eth_devargs_parse_representor_ports (values, ð_da);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */ +/* Set default values. */ +if (eth_da.nb_mh_controllers ==0 ) { + eth_da.nb_mh_controllers =1 ; + eth_da.mh_controllers[0 ] =0 ; + } +if (eth_da.nb_ports ==0 ) { + eth_da.nb_ports =1 ; + eth_da.ports[0 ] =0 ; + } +if (eth_da.nb_representor_ports ==0 ) { + eth_da.nb_representor_ports =1 ; + eth_da.representor_ports[0 ] =0 ; + }/* Return 0 if representor id is matching one of the values. */ -for (index =0 ; index < representors.nb_representor_ports; index++) -if (data->representor_id == - representors.representor_ports[index]) -return 0 ; +for (c =0 ; c < eth_da.nb_mh_controllers; ++c) { +for (p =0 ; p < eth_da.nb_ports; ++p) { +for (f =0 ; f < eth_da.nb_representor_ports; ++f) { + index =rte_eth_representor_id_encode ( + eth_da.mh_controllers[c], + eth_da.ports[p], + eth_da.type, + eth_da.representor_ports[f]); +if (data->representor_id == index) +return 0 ; + } + } + }return -1 ;/* no match */ }(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex91b3263338..2cac0ccfbd100644lib/librte_ethdev/rte_ethdev.c +0
-0@@ -5575,6 +5575,32 @@ rte_eth_devargs_parse(const char *dargs, struct
rte_eth_devargs*eth_da)Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +6
-0return result; } +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port) +{ + return (((controller & 3) << 14) |lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5594
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ ((pf &3 ) <<12 ) | + (!!(type ==RTE_ETH_REPRESENTOR_SF ) <<11 ) | + (representor_port & 0x7ff)); +} + +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type) { +if (controller)Compare vs NULL in accordance with DPDK coding style guide
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5596
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+ *controller = (representor_id >>14 ) &3 ; +if (pf)Compare vs NULL in accordance with DPDK coding style guide
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5598
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+ *pf = (representor_id >>12 ) &3 ; +if (type)Compare vs NULL in accordance with DPDK coding style guide
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct · line 5599
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+ *type = ((representor_id >>11 ) &1 ) ? + RTE_ETH_REPRESENTOR_SF :
RTE_ETH_REPRESENTOR_VF;Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+return representor_id &0x7ff ; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,lib/librte_ethdev/rte_ethdev_driver.h +0
-0lib/librte_ethdev/rte_ethdev_driver.h struct rte_eth_devargs { · line 1220
Quoted 3 lines
lib/librte_ethdev/rte_ethdev_driver.h +1
-0@@ -1218,6 +1218,59 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +#define RTE_NO_REPRESENTOR_ID UINT16_MAX/**< No representor ID. */
Quoted 60 lines
lib/librte_ethdev/rte_ethdev_driver.h +52
-0+ +/** +* PMD helper function to encode representor ID +* +* The compact format is used for device iterator that comparing +* ethdev representor ID with target devargs. +* +* xxxx xxxx xxxx xxxx +* |||| |LLL LLLL LLLL vf/sf id +* |||| L 1:sf, 0:vf +* ||LL pf id +* LL controller(host) id +* +* @param controller +* Controller ID. +* @param pf +* PF port ID. +* @param type +* Representor type. +* @param representor_port +* Representor port ID. +* +* @return +* Encoded representor ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_encode (uint16_t controller,uint16_t pf, +enum rte_eth_representor_type type, +uint16_t representor_port); + +/** +* PMD helper function to parse representor ID +* +* @param representor_id +* Representor ID. +* @param controller +* Parsed controller ID. +* @param pf +* Parsed PF port ID. +* @param type +* Parsed representor type. +* +* @return +* Parsed representor port ID. +*/ +__rte_internal +uint16_t +rte_eth_representor_id_parse (const uint16_t representor_id, +uint16_t *controller,uint16_t *pf, +enum rte_eth_representor_type *type); +/** * PMD helper function to parse ethdev arguments * (quoted diff) +0
-0b/lib/librte_ethdev/version.map index
d3f5410806..44edaed507100644lib/librte_ethdev/version.map INTERNAL { · line 261
Quoted 5 lines
lib/librte_ethdev/version.map +2
-0@@ -257,6 +257,8 @@ INTERNAL { rte_eth_dev_release_port; rte_eth_dev_internal_reset; rte_eth_devargs_parse; + rte_eth_representor_id_encode; + rte_eth_representor_id_parse;The place looks wrong. It must be sorted or added at bottom with the comment with version number. I'd prefer to have it simply alphanumberically sorted.
Quoted 4 lines
lib/librte_ethdev/version.map +0
-0rte_eth_dma_zone_free; rte_eth_dma_zone_reserve; rte_eth_hairpin_queue_peer_bind;
Re: [dpdk-dev] [PATCH v5 7/9] devarg: change representor ID to bitmap
Quoted 47 lines · Xueming(Steven) Li
Quoted 47 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:21 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Ajit Khaparde <[email protected]>; Somnath Kotur <[email protected]>; John Daley <[email protected]>; Hyong Youb Kim <[email protected]>; Beilei Xing <[email protected]>; Jeff Guo <[email protected]>; Haiyue Wang <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v5 7/9] devarg: change representor ID to bitmapQuoted 5 lines · Xueming Li
The NIC can have multiple PCIe links and can be attached to 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. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if
any).
Quoted 15 lines
SR-IOV and SubFunction are created on top of PF. PF index is introduced because there might be multiple PFs in the bonding configuration and only bonding device is probed.
In eth representor comparator callback, ethdev was compared with devarg. Since ethdev representor port didn't contain controller index and PF index information, callback returned representor from other PF or controller.
This patch changes representor ID to bitmap so that the ethdev representor comparer callback returns correct ethdev by comparing full representor information including: controller index, PF index, representor type, SF or VF index.
Quoted 6 lines
Representor ID bitmap definition:
xxxx xxxx xxxx xxxx|||| |LLL LLLL LLLL vf/sf id |||| L 1:sf, 0:vf ||LL pf idLL controller(host) id
What about PF representor case? I.e. representor for entire PF.
Quoted 8 lines
Quoted 6 lines
Also it implies that controller ID 0 is the caller. I.e. special meaning. So, space for just 3 specific contoller left
Similar for PF. In fact it is worse. E.g. PMD is bound to the second PF (PF number 1). If so, vf0 means the first VF of the PF itself, i.e. PF 1 VF 0. But, pf0vf0 should mean PF 1 VF 1.
Agree, need to extend bits width in LTS release.
See my reply to cover mail.
Quoted 2 lines
PF representor is not considered here, how about moving one bit from vf/sf id? 1k SF devices should be fine for me so far.
We could reserve max VF/SF number to denote PF itself.
Quoted 3 lines
The controller ID and PF ID is related to the context device, how device configured and bonding state is critical for PMD to interpret the IDs. For example:
"<BDF>,representor=pf1vf1" is valid for bonding device, invalid for standalone device.
I guess it is mlx5 specific. IMHO, pf1vf1 makes sense even without bonding.
Quoted 5 lines
"c#" is meaningful for multi-host scenario, invalid for normal NIC. PMD is responsible to encode representor ID correctly according to device configuration to make Device+ReprID unique, because the ReprID is used in device iterator. So the user app should specify representor syntax with necessary parts to cover device configuration, PMD should extract required info according to device state.
See cover mail reply.
PATCH v5 8/9 ethdev: add capability of sub-function representor
In reply to Xueming LiOld DPDK version or some drivers didn't support SubFunction representor. For application to adapt different DPDK version automatically, or to be used for different NICs, this patch introduces new eth device capability of supporting SubFunction representor device.
--- lib/librte_ethdev/rte_ethdev.h | 2 ++ 1 file changed, 2 insertions(+)
lib/librte_ethdev/rte_ethdev.h +2 -0
@@ -1433,6 +1433,8 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001/** Device supports Tx queue setup after device started. */ #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 +/** Device supports SubFunction representor. */ +#define RTE_ETH_DEV_CAPA_REPRESENTOR_SF 0x00000004/**@}*/ /*
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v5 8/9] ethdev: add capability of sub-function representor
Quoted 4 lines · Xueming Li
Old DPDK version or some drivers didn't support SubFunction representor. For application to adapt different DPDK version automatically, or to be used for different NICs, this patch introduces new eth device capability of supporting SubFunction representor device.
Sorry, it does not sound sufficient motivation to introduce the capability. I simply need real life example why application need to know it.
Quoted 12 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- lib/librte_ethdev/rte_ethdev.h | 2 ++ 1 file changed, 2 insertions(+)lib/librte_ethdev/rte_ethdev.h +0
-0
lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1437
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +2
-0@@ -1433,6 +1433,8 @@ struct rte_eth_conf {#define RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP 0x00000001/** Device supports Tx queue setup after device started. */ #define RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP 0x00000002 +/** Device supports SubFunction representor. */ +#define RTE_ETH_DEV_CAPA_REPRESENTOR_SF 0x00000004
Will we have a PMD which supports it in the release cycle?
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.h +0
-0/**@}*/ /*
Re: [dpdk-dev] [PATCH v5 8/9] ethdev: add capability of sub-function representor
Quoted 10 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:06 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 8/9] ethdev: add capability of sub-function representor
Quoted 8 lines
Quoted 4 lines · Xueming Li
Old DPDK version or some drivers didn't support SubFunction representor. For application to adapt different DPDK version automatically, or to be used for different NICs, this patch introduces new eth device capability of supporting SubFunction representor device.
Sorry, it does not sound sufficient motivation to introduce the capability. I simply need real life example why application need to know it.
I had same internal discussion on this as well :)
A simple example, for customer running DPDK based app with NICs from different vendors, app need a flag to know whether the device support SF representor, hotplug SF if the capability shows "support". This also happens with different model/fw even from same vendor. PMD report device+driver capability that whether SF supported.
Quoted 8 lines
Quoted 8 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- lib/librte_ethdev/rte_ethdev.h | 2 ++ 1 file changed, 2 insertions(+)
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_conf { · line 1437
Quoted 10 lines
(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.hindex2cbce958cf..da65adf1ab100644lib/librte_ethdev/rte_ethdev.h +0
-0@@ -1433,6 +1433,8 @@ struct rte_eth_conf { #define
RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP0x00000001
/** Device supports Tx queue setup after device started. */ #defineRTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP0x00000002lib/librte_ethdev/rte_ethdev.h +2
-0+/** Device supports SubFunction representor. */ +#define RTE_ETH_DEV_CAPA_REPRESENTOR_SF 0x00000004Will we have a PMD which supports it in the release cycle?
Please see reply above, it also reflect device hw capability.
Quoted 4 lines
Quoted 4 lines
/**@}*/
/*
Re: [dpdk-dev] [PATCH v5 8/9] ethdev: add capability of sub-function representor
Quoted 16 lines · Xueming(Steven) Li
Quoted 16 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, January 19, 2021 4:06 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v5 8/9] ethdev: add capability of sub-function representorQuoted 4 lines · Xueming Li
Old DPDK version or some drivers didn't support SubFunction representor. For application to adapt different DPDK version automatically, or to be used for different NICs, this patch introduces new eth device capability of supporting SubFunction representor device.
Quoted 8 lines
Quoted 2 lines
Sorry, it does not sound sufficient motivation to introduce the capability. I simply need real life example why application need to know it.
I had same internal discussion on this as well :)
A simple example, for customer running DPDK based app with NICs from different vendors, app need a flag to know whether the device support SF representor, hotplug SF if the capability shows "support". This also happens with different model/fw even from same vendor. PMD report device+driver capability that whether SF supported.
Single feature bit is insufficient. Application needs to know how many SF may be used on which PF.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
[snip]
PATCH v5 9/9 kvargs: update parser to support lists
In reply to Xueming LiThis patch updates kvargs parser to support lists on top of range, allow multiple lists or range:
k1=a[1,2]b[3-5]
--- app/test/test_kvargs.c | 46 +++++++++++++-- lib/librte_kvargs/rte_kvargs.c | 101 +++++++++++++++++++++++---------- 2 files changed, 112 insertions(+), 35 deletions(-)
app/test/test_kvargs.c +40 -6
@@ -35,6 +35,25 @@ static int check_handler(const char *key, const char *value,return 0 ; } +/* test parsing. */ +static int test_kvargs_parsing (const char *args,unsigned int n) +{ +struct rte_kvargs *kvlist; + + kvlist =rte_kvargs_parse (args,NULL ); +if (kvlist ==NULL ) { +printf ("rte_kvargs_parse() error: %s\n" , args); +return -1 ; + } +if (kvlist->count != n) { +printf ("invalid count value %d: %s\n" , kvlist->count, args); +rte_kvargs_free (kvlist); +return -1 ; + } +rte_kvargs_free (kvlist); +return 0 ; +} +/* test a valid case */ static int test_valid_kvargs (void ) {
@@ -42,6 +61,19 @@ static int test_valid_kvargs(void)const char *args;const char *valid_keys_list[] = {"foo" ,"check" ,NULL };const char **valid_keys; +static const struct { +unsigned int expected; +const char *input; + } valid_inputs[] = { + {2 ,"foo=1,foo=" }, + {2 ,"foo=1,foo=" }, + {2 ,"foo=1,foo" }, + {2 ,"foo=1,=2" }, + {1 ,"foo=[1,2" }, + {1 ,",=" }, + {1 ,"foo=[" }, + }; +unsigned int i;/* empty args is valid */ args ="" ;
@@ -191,6 +223,14 @@ static int test_valid_kvargs(void) }rte_kvargs_free (kvlist); + valid_keys =NULL ; + +for (i =0 ; i <RTE_DIM (valid_inputs); ++i) { + args = valid_inputs[i].input; +if (test_kvargs_parsing (args, valid_inputs[i].expected)) + goto fail; + } +return 0 ; fail:
@@ -212,12 +252,6 @@ static int test_invalid_kvargs(void)/* list of argument that should fail */ const char *args_list[] = {"wrong-key=x" ,/* key not in valid_keys_list */ -"foo=1,foo=" ,/* empty value */ -"foo=1,foo" ,/* no value */ -"foo=1,=2" ,/* no key */ -"foo=[1,2" ,/* no closing bracket in value */ -",=" ,/* also test with a smiley */ -"foo=[" ,/* no value in list and no closing bracket */ NULL };const char **args;const char *valid_keys_list[] = {"foo" ,"check" ,NULL };
lib/librte_kvargs/rte_kvargs.c +72 -29
129 lines not on this page · raw message
Signature · 1 line
2.25.1
v6 cover ethdev: support SubFunction representor
In reply to Xueming LiSubFunction [1] is a portion of the PCI device, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports E-Switch representation offload similar to existing PF and VF representors. A SF shares PCI level resources with other SFs and/or with its parent PCI function.
From SmartNIC perspective, when PCI device is shared for multi-host, representors for host controller and host PF is required.
This patch set introduces new representor types in addtion to existing VF representor. Syntax:
[[c#]pf#]vf#: VF port representor/s from controller/pf [[c#]pf#]sf#: SF port representor/s from controller/pf #: VF representor - for backwards compatibility
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
For backward compatibility, this patch also introduces new netdev capability to indicate the capability of supportting SF representor.
Version history:
RFC:
initial version [2]
V2:
- separate patch for represnetor infrastructure, controller, pf and sf.
- replace representor ID macro with functions:
rte_eth_representor_id_encode() rte_eth_representor_id_parse()
- new patch to allow devargs with same PCI BDF but different representors.
- other minor code updates according to comments, thanks Andrew!
- update document
V3:
- improve probing of allowed devargs with same name.
- parse single word of kvargs as key.
- update kvargs test cases.
V4:
- split first representor refactor patch into
1: add representor type
2: refector representor list parsing
- push the patch supporting multi-devargs for same device.
V5:
- add comments for parsing functions
- update switch_representation.rst - Thanks Ajit
V6:
- split representor types into different patches, move to rte_ethdev.h
- improvements of rte_eth_devargs_process_list() according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability with rte_eth_representor_info_get()
- add new ethdev ops api to get representor info from PMD
- replace representor ID encode/decode with conversion from representor info
- change ethdev representor iterator to use new ID encoding
Xueming Li (9):
ethdev: introduce representor type
ethdev: support representor port list
ethdev: support new VF representor syntax
ethdev: support sub function representor
ethdev: support PF index in representor
ethdev: support multi-host in representor
ethdev: new API to get representor info
ethdev: representor iterator compare complete info
kvargs: update parser to support lists
app/test/test_kvargs.c | 46 ++++- config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 13 +- .../prog_guide/switch_representation.rst | 35 +++- drivers/net/bnxt/bnxt_ethdev.c | 7 + drivers/net/enic/enic_ethdev.c | 6 + drivers/net/i40e/i40e_ethdev.c | 7 + drivers/net/ixgbe/ixgbe_ethdev.c | 7 + drivers/net/mlx5/linux/mlx5_os.c | 11 ++ lib/librte_ethdev/ethdev_driver.h | 49 ++++- lib/librte_ethdev/ethdev_private.c | 173 ++++++++++++------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 ++-- lib/librte_ethdev/rte_ethdev.c | 102 ++++++++++- lib/librte_ethdev/rte_ethdev.h | 53 ++++++ lib/librte_ethdev/version.map | 4 + lib/librte_kvargs/rte_kvargs.c | 101 +++++++--- 17 files changed, 535 insertions(+), 123 deletions(-)
Signature · 1 line
2.25.1
PATCH v6 1/9 ethdev: introduce representor type
To support more representor type, this patch introduces representor type enum. The enum is subject to be extended to support new representor in patches upcoming.
For each devarg structure, only one type supported.
--- drivers/net/bnxt/bnxt_ethdev.c | 7 +++++++ drivers/net/enic/enic_ethdev.c | 6 ++++++ drivers/net/i40e/i40e_ethdev.c | 7 +++++++ drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++ drivers/net/mlx5/linux/mlx5_os.c | 11 +++++++++++ lib/librte_ethdev/ethdev_driver.h | 7 ++++++- lib/librte_ethdev/ethdev_private.c | 5 +++++ lib/librte_ethdev/rte_ethdev.h | 8 ++++++++ 8 files changed, 57 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +7 -0
@@ -5618,6 +5618,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev,int i, ret =0 ;struct rte_kvargs *kvlist =NULL ; +if (eth_da->type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (eth_da->type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type %d\n" , + eth_da->type); +return -ENOTSUP ; + } num_rep = eth_da->nb_representor_ports;if (num_rep >BNXT_MAX_VF_REPS ) { PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n",
drivers/net/enic/enic_ethdev.c +6 -0
@@ -1312,6 +1312,12 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval)return retval; } +if (eth_da.nb_representor_ports >0 && + eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct enic), eth_dev_pci_specific_init, pci_dev,
drivers/net/i40e/i40e_ethdev.c +7 -0
@@ -639,6 +639,13 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,return retval; } +if (eth_da.nb_representor_ports >0 && + eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct i40e_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/ixgbe/ixgbe_ethdev.c +7 -0
@@ -1718,6 +1718,13 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }else memset (ð_da,0 ,sizeof (eth_da)); +if (eth_da.nb_representor_ports >0 && + eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +PMD_DRV_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } + retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, sizeof(struct ixgbe_adapter), eth_dev_pci_specific_init, pci_dev,
drivers/net/mlx5/linux/mlx5_os.c +11 -0
@@ -704,6 +704,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, strerror(rte_errno));return NULL ; } +if (eth_da.type ==RTE_ETH_REPRESENTOR_NONE ) { +/* Representor not specified. */ + rte_errno =EBUSY ; +return NULL ; + } +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { + rte_errno =ENOTSUP ; +DRV_LOG (ERR ,"unsupported representor type: %s" , + dpdk_dev->devargs->args); +return NULL ; + }for (i =0 ; i < eth_da.nb_representor_ports; ++i)if (eth_da.representor_ports[i] == (uint16_t )switch_info->port_name)
lib/librte_ethdev/ethdev_driver.h +6 -1
@@ -1216,7 +1216,11 @@ __rte_internalint rte_eth_switch_domain_free (uint16_t domain_id); -/** Generic Ethernet device arguments */ +/** +* Generic Ethernet device arguments +* +* One type of representor each structure. +*/ struct rte_eth_devargs {uint16_t ports[RTE_MAX_ETHPORTS ];/** port/s number to enable on a multi-port single function */
@@ -1226,6 +1230,7 @@ struct rte_eth_devargs {/** representor port/s identifier to enable on device */ uint16_t nb_representor_ports;/** number of ports in representor port field */ +enum rte_eth_representor_type type;/* type of representor */ };/**
lib/librte_ethdev/ethdev_private.c +5 -0
@@ -111,11 +111,16 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list,return 0 ; } +/* +* representor format: +* #: range or single number of VF representor +*/ int rte_eth_devargs_parse_representor_ports (char *str,void *data) {struct rte_eth_devargs *eth_da = data; + eth_da->type =RTE_ETH_REPRESENTOR_VF ;return rte_eth_devargs_process_range (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); }
lib/librte_ethdev/rte_ethdev.h +8 -0
@@ -1506,6 +1506,14 @@ struct rte_eth_rxseg_capa {* Ethernet device information */ +/** +* Ethernet device representor port type. +*/ +enum rte_eth_representor_type { +RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ +RTE_ETH_REPRESENTOR_VF ,/**< representor of Virtual Function. */ +}; +/** * A structure used to retrieve the contextual information of * an Ethernet device, such as the controlling driver of the
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v6 1/9] ethdev: introduce representor type
Quoted 22 lines
-----Original Message-----
From: Xueming Li <[email protected]>
Sent: Sunday, February 14, 2021 12:22 PM
Cc: [email protected]; Viacheslav Ovsiienko <[email protected]>; [email protected]; Asaf Penso <[email protected]>; Ajit Khaparde <[email protected]>; Somnath Kotur <[email protected]>; John Daley (johndale) <[email protected]>; Hyong Youb Kim (hyonkim) <[email protected]>; Beilei Xing <[email protected]>; Jeff Guo <[email protected]>; Haiyue Wang <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Andrew Rybchenko <[email protected]>
Subject: [PATCH v6 1/9] ethdev: introduce representor typeTo support more representor type, this patch introduces representor type enum. The enum is subject to be extended to support new representor in patches upcoming.
For each devarg structure, only one type supported.
Signed-off-by Xueming Li <[email protected]>
[...]
Quoted 17 lines
drivers/net/enic/enic_ethdev.c +6
-0@@ -1312,6 +1312,12 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, if (retval)return retval; } +if (eth_da.nb_representor_ports >0 && + eth_da.type !=RTE_ETH_REPRESENTOR_VF ) { +ENICPMD_LOG (ERR ,"unsupported representor type: %s\n" , + pci_dev->device.devargs->args); +return -ENOTSUP ; + } retval = rte_eth_dev_create(&pci_dev->device, pci_dev- >device.name,
drivers/net/enic/enic_ethdev.c static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, · line 1323
Quoted 2 lines
drivers/net/enic/enic_ethdev.c +0
-0sizeof (struct enic ), eth_dev_pci_specific_init, pci_dev,
For enic,
Thanks.
-Hyong
PATCH v6 2/9 ethdev: support representor port list
In reply to Xueming LiTo support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and ranges
--- lib/librte_ethdev/ethdev_private.c | 129 ++++++++++++++++------------- lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 4 +- lib/librte_ethdev/rte_ethdev.c | 5 +- 4 files changed, 74 insertions(+), 67 deletions(-)
lib/librte_ethdev/ethdev_private.c +71 -58
@@ -38,82 +38,91 @@ eth_find_device(const struct rte_eth_dev *start, rte_eth_cmp_t cmp,return NULL ; } -int -rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data) +/* Put new value into list. */ +static int +rte_eth_devargs_enlist (uint16_t *list,uint16_t *len_list, +const uint16_t max_list,uint16_t val) { -char *str_start; -int state; -int result; - -if (*str !='[' ) -/* Single element, not a list */ -return callback (str, data); - -/* Sanity check, then strip the brackets */ - str_start = &str[strlen (str) -1 ]; -if (*str_start !=']' ) { -RTE_LOG (ERR ,EAL ,"(%s): List does not end with ']'\n" , str); -return -EINVAL ; - } - str++; - *str_start ='\0' ; +uint16_t i; -/* Process list elements */ - state =0 ; -while (1 ) { -if (state ==0 ) { -if (*str =='\0' ) -break ; -if (*str !=',' ) { - str_start = str; - state =1 ; - } - }else if (state ==1 ) { -if (*str ==',' || *str =='\0' ) { -if (str > str_start) { -/* Non-empty string fragment */ - *str ='\0' ; - result =callback (str_start, data); -if (result <0 ) -return result; - } - state =0 ; - } - } - str++; +for (i =0 ; i < *len_list; i++) { +if (list[i] == val) +return 0 ; } +if (*len_list >= max_list) +return -1 ; + list[(*len_list)++] = val;return 0 ; } -static int +/* Parse and enlist a range expression of "min-max" or a single value. */ +static char *rte_eth_devargs_process_range (char *str,uint16_t *list,uint16_t *len_list,const uint16_t max_list) {uint16_t lo, hi, val; -int result; +int result, n =0 ; +char *pos = str; - result =sscanf (str,"%hu-%hu" , &lo, &hi); + result =sscanf (str,"%hu%n-%hu%n" , &lo, &n, &hi, &n);if (result ==1 ) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = lo; +if (rte_eth_devargs_enlist (list, len_list, max_list, lo) !=0 ) +return NULL ; }else if (result ==2 ) { -if (lo >= hi || lo >RTE_MAX_ETHPORTS || hi >RTE_MAX_ETHPORTS ) -return -EINVAL ; +if (lo > hi) +return NULL ;for (val = lo; val <= hi; val++) { -if (*len_list >= max_list) -return -ENOMEM ; - list[(*len_list)++] = val; +if (rte_eth_devargs_enlist (list, len_list, max_list, + val) !=0 ) +return NULL ; } }else -return -EINVAL ; -return 0 ; +return NULL ; +return pos + n; +} + +/* +* Parse list of values separated by ",". +* Each value could be a range [min-max] or single number. +* Examples: +* 2 - single +* [1,2,3] - single list +* [1,3-5,7,9-11] - list with singles and ranges +*/ +static char * +rte_eth_devargs_process_list (char *str,uint16_t *list,uint16_t *len_list, +const uint16_t max_list) +{ +char *pos = str; + +if (*pos =='[' ) + pos++; +while (1 ) { + pos =rte_eth_devargs_process_range (pos, list, len_list, + max_list); +if (pos ==NULL ) +return NULL ; +if (*pos !=',' )/* end of list */ +break ; + pos++; + } +if (*str =='[' && *pos !=']' ) +return NULL ; +if (*pos ==']' ) + pos++; +return pos; }/* -* representor format: +* Parse representor ports from a single value or lists. +* +* Representor format: * #: range or single number of VF representor +* +* Examples of #: +* 2 - single +* [1,2,3] - single list +* [1,3-5,7,9-11] - list with singles and ranges */ int rte_eth_devargs_parse_representor_ports (char *str,void *data)
@@ -121,6 +130,10 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data; eth_da->type =RTE_ETH_REPRESENTOR_VF ; -return rte_eth_devargs_process_range (str, eth_da->representor_ports, - ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); + str =rte_eth_devargs_process_list (str, eth_da->representor_ports, + ð_da->nb_representor_ports, +RTE_DIM (eth_da->representor_ports)); +if (str ==NULL ) +RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str); +return str ==NULL ?-1 :0 ; }
lib/librte_ethdev/ethdev_private.h +0 -3
@@ -26,9 +26,6 @@ eth_find_device(const struct rte_eth_dev *_start, rte_eth_cmp_t cmp, const void *data);/* Parse devargs value for representor parameter. */ -typedef int (*rte_eth_devargs_callback_t )(char *str,void *data); -int rte_eth_devargs_parse_list (char *str,rte_eth_devargs_callback_t callback, -void *data);int rte_eth_devargs_parse_representor_ports (char *str,void *data);#ifdef __cplusplus
lib/librte_ethdev/rte_class_eth.c +1 -3
@@ -77,9 +77,7 @@ eth_representor_cmp(const char *key __rte_unused,if (values ==NULL )return -1 ;memset (&representors,0 ,sizeof (representors)); - ret =rte_eth_devargs_parse_list (values, - rte_eth_devargs_parse_representor_ports, - &representors); + ret =rte_eth_devargs_parse_representor_ports (values, &representors);free (values);if (ret !=0 )return -1 ;/* invalid devargs value */
lib/librte_ethdev/rte_ethdev.c +2 -3
@@ -5589,9 +5589,8 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)for (i =0 ; i < args.count; i++) { pair = &args.pairs[i];if (strcmp ("representor" , pair->key) ==0 ) { - result =rte_eth_devargs_parse_list (pair->value, - rte_eth_devargs_parse_representor_ports, - eth_da); + result =rte_eth_devargs_parse_representor_ports ( + pair->value, eth_da);if (result <0 ) goto parse_cleanup; }
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v6 2/9] ethdev: support representor port list
Quoted 9 lines · Xueming Li
To support extended representor syntax, this patch extends the representor list parsing to support for representor port range in devargs, examples:
representor=[1,2,3] - single list
representor=[1,3-5,7,9-11] - list with singles and rangesSigned-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
PATCH v6 3/9 ethdev: support new VF representor syntax
In reply to Xueming LiCurrent VF representor syntax:
representor=2 - single representor
representor=[0-3] - single range
To prepare for more representor types, this patch adds compatible VF representor devargs syntax:
vf#:
representor=vf2 - single representor representor=vf[1,3,5] - single list representor=vf[0-3] - single range representor=vf[0,1,4-7] - list with singles and range
For backwards compatibility, representor "#" is interpreted as "vf#".
--- doc/guides/prog_guide/poll_mode_drv.rst | 7 ++++--- lib/librte_ethdev/ethdev_private.c | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +4 -3
@@ -374,9 +374,10 @@ parameters to those ports. this argument allows user to specify which switch ports to enable port representors for.:: - -a DBDF,representor=0 - -a DBDF,representor=[0,4,6,9] - -a DBDF,representor=[0-31] + -a DBDF,representor=vf0 + -a DBDF,representor=vf[0,4,6,9] + -a DBDF,representor=vf[0-31] + -a DBDF,representor=vf[0,2-4,7,9-11] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +4 -1
@@ -117,7 +117,8 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,* Parse representor ports from a single value or lists. * * Representor format: -* #: range or single number of VF representor +* #: range or single number of VF representor - legacy +* vf#: VF port representor/s * * Examples of #: * 2 - single
@@ -130,6 +131,8 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)struct rte_eth_devargs *eth_da = data; eth_da->type =RTE_ETH_REPRESENTOR_VF ; +if (str[0 ] =='v' && str[1 ] =='f' ) + str +=2 ; str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_DIM (eth_da->representor_ports));
Signature · 1 line
2.25.1
PATCH v6 4/9 ethdev: support sub function representor
In reply to Xueming LiSubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.
To support SF representor, this patch introduces new devargs syntax, examples:
representor=sf0 - single SubFunction representor representor=sf[1,3,5] - single list representor=sf[0-3], - single range
representor=sf[0,2-6,8,10-12] - list with singles and ranges
--- doc/guides/prog_guide/poll_mode_drv.rst | 4 +++ .../prog_guide/switch_representation.rst | 35 +++++++++++++------ lib/librte_ethdev/ethdev_private.c | 11 ++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 4 files changed, 39 insertions(+), 12 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +4 -0
@@ -378,6 +378,10 @@ parameters to those ports. -a DBDF,representor=vf[0,4,6,9] -a DBDF,representor=vf[0-31] -a DBDF,representor=vf[0,2-4,7,9-11] + -a DBDF,representor=sf0 + -a DBDF,representor=sf[1,3,5] + -a DBDF,representor=sf[0-1023] + -a DBDF,representor=sf[0,2-4,7,9-11] Note: PMDs are not required to support the standard device arguments and users should consult the relevant PMD documentation to see support devargs.
doc/guides/prog_guide/switch_representation.rst +25 -10
@@ -13,7 +13,7 @@ Introduction Network adapters with multiple physical ports and/or SR-IOV capabilities usually support the offload of traffic steering rules between their virtual -functions (VFs), physical functions (PFs) and ports. +functions (VFs), sub functions (SFs), physical functions (PFs) and ports. Like for standard Ethernet switches, this involves a combination of automatic MAC learning and manual configuration. For most purposes it is
@@ -24,7 +24,7 @@ layer 2 (L2) traffic (such as OVS) need to steer traffic themselves according on their own criteria. Without a standard software interface to manage traffic steering rules -between VFs, PFs and the various physical ports of a given device, +between VFs, SFs, PFs and the various physical ports of a given device, applications cannot take advantage of these offloads; software processing is mandatory even for traffic which ends up re-injected into the device it originates from.
@@ -34,6 +34,17 @@ the DPDK flow API (**rte_flow**), with emphasis on the SR-IOV use case (PF/VF steering) using a single physical port for clarity, however the same logic applies to any number of ports without necessarily involving SR-IOV. +Sub Function +------------ +Besides SR-IOV, Sub function is a portion of the PCI device, a SF netdev +has its own dedicated queues(txq, rxq). A SF netdev supports E-Switch +representation offload similar to existing PF and VF representors. +A SF shares PCI level resources with other SFs and/or with its parent PCI +function. + +Sub function is created on-demand, coexists with VFs. Number of SFs is +limited by hardware resources. + Port Representors -----------------
@@ -42,15 +53,16 @@ applications usually have to process a bit of traffic in software before thinking about offloading specific flows to hardware. Applications therefore need the ability to receive and inject traffic to -various device endpoints (other VFs, PFs or physical ports) before +various device endpoints (other VFs, SFs, PFs or physical ports) before connecting them together. Device drivers must provide means to hook the "other end" of these endpoints and to refer them when configuring flow rules. This role is left to so-called "port representors" (also known as "VF -representors" in the specific context of VFs), which are to DPDK what the -Ethernet switch device driver model (**switchdev**) [1]_ is to Linux, and -which can be thought as a software "patch panel" front-end for applications. +representors" in the specific context of VFs, "SF representors" in the +specific context of SFs), which are to DPDK what the Ethernet switch +device driver model (**switchdev**) [1]_ is to Linux, and which can be +thought as a software "patch panel" front-end for applications. - DPDK port representors are implemented as additional virtual Ethernet device (**ethdev**) instances, spawned on an as needed basis through
@@ -59,9 +71,12 @@ which can be thought as a software "patch panel" front-end for applications. :: - -a pci:dbdf,representor=0 - -a pci:dbdf,representor=[0-3] - -a pci:dbdf,representor=[0,5-11] + -a pci:dbdf,representor=vf0 + -a pci:dbdf,representor=vf[0-3] + -a pci:dbdf,representor=vf[0,5-11] + -a pci:dbdf,representor=sf1 + -a pci:dbdf,representor=sf[0-1023] + -a pci:dbdf,representor=sf[0,2-1023] - As virtual devices, they may be more limited than their physical counterparts, for instance by exposing only a subset of device
@@ -360,7 +375,7 @@ Compared to creating a brand new dedicated interface, **rte_flow** was deemed flexible enough to manage representor traffic only with minor extensions: -- Using physical ports, PF, VF or port representors as targets. +- Using physical ports, PF, SF, VF or port representors as targets. - Affecting traffic that is not necessarily addressed to the DPDK port ID a flow rule is associated with (e.g. forcing VF traffic redirection to PF).
lib/librte_ethdev/ethdev_private.c +9 -2
@@ -119,6 +119,7 @@ rte_eth_devargs_process_list(char *str, uint16_t *list, uint16_t *len_list,* Representor format: * #: range or single number of VF representor - legacy * vf#: VF port representor/s +* sf#: SF port representor/s * * Examples of #: * 2 - single
@@ -130,9 +131,15 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) {struct rte_eth_devargs *eth_da = data; - eth_da->type =RTE_ETH_REPRESENTOR_VF ; -if (str[0 ] =='v' && str[1 ] =='f' ) +if (str[0 ] =='v' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ; + }else if (str[0 ] =='s' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_SF ; + str +=2 ; + }else { + eth_da->type =RTE_ETH_REPRESENTOR_VF ; + } str =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_DIM (eth_da->representor_ports));
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1512,6 +1512,7 @@ struct rte_eth_rxseg_capa {enum rte_eth_representor_type {RTE_ETH_REPRESENTOR_NONE ,/**< not a representor. */ RTE_ETH_REPRESENTOR_VF ,/**< representor of Virtual Function. */ +RTE_ETH_REPRESENTOR_SF ,/**< representor of Sub Function. */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v6 4/9] ethdev: support sub function representor
Hi,
Quoted 10 lines · Xueming Li
SubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated
queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.To support SF representor, this patch introduces new devargs syntax, examples:
representor=sf0 - single SubFunction representor representor=sf[1,3,5] - single list representor=sf[0-3], - single range
Quoted 6 lines
representor=sf[0,2-6,8,10-12] - list with singles and ranges
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
What happens if I try to mix different types of representors:
A: -a DBDF,representor=sf0,representor=vf1
B: -a DBDF,representor=sf0 -a DBDF,representor=vf1 (DBDF is the same in args B in both cases).
I'm not trying to say that it must work, since most likely hotplug will be used to add representors. But behaviour must be consistent (error?).
The question is raised here, since it is the first patch where the second type of representor appears.
Andrew.
Re: [dpdk-dev] [PATCH v6 4/9] ethdev: support sub function representor
Quoted 25 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 15, 2021 4:26 PM
To: Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>
Subject: Re: [PATCH v6 4/9] ethdev: support sub function representorHi,
Quoted 12 lines · Xueming Li
SubFunction is a portion of the PCI device, created on demand, a SF netdev has its own dedicated
queues(txq, rxq). A SF netdev supports eswitch representation offload similar to existing PF and VF representors.To support SF representor, this patch introduces new devargs syntax, examples:
representor=sf0 - single SubFunction representor representor=sf[1,3,5] - single list representor=sf[0-3], - single rangerepresentor=sf[0,2-6,8,10-12] - list with singles and ranges
Quoted 7 lines
Quoted 4 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Acked-by Andrew Rybchenko <[email protected]>What happens if I try to mix different types of representors:
A: -a DBDF,representor=sf0,representor=vf1
Currently, the next representor will overwrite type of first, but append to representor ports.
Quoted 1 line
B: -a DBDF,representor=sf0 -a DBDF,representor=vf1 (DBDF is the same in args B in both cases).
This is a behavior of EAL, if DBDF are same, only the first get probed, even if the second is "sf1"
Quoted 3 lines
I'm not trying to say that it must work, since most likely hotplug will be used to add representors. But behaviour must be consistent (error?).
Good catch, agree with error, will add check.
Quoted 4 lines
The question is raised here, since it is the first patch where the second type of representor appears.
Andrew.