support SubFunction representor
PATCH v6 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
PF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representor
--- doc/guides/prog_guide/poll_mode_drv.rst | 2 ++ lib/librte_ethdev/ethdev_private.c | 18 ++++++++++++++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 3 files changed, 19 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 +16 -2
@@ -118,8 +118,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
@@ -131,6 +131,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_DIM (eth_da->ports)); +if (str ==NULL ) + goto err; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;
@@ -138,11 +146,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else { +/* Don't mix legacy syntax with 'pf' section. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { + str =NULL ; + goto err; + } 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)); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1513,6 +1513,7 @@ 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 Physical Function. */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v6 5/9] ethdev: support PF index in representor
Quoted 9 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 7 lines
PF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representorSigned-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
Re: [dpdk-dev] [PATCH v6 5/9] ethdev: support PF index in representor
In reply to Xueming LiQuoted 51 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 PFsPF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representorSigned-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 | 18 ++++++++++++++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 3 files changed, 19 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@@ -118,8 +118,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 135
Quoted 5 lines
lib/librte_ethdev/ethdev_private.c +2
-0@@ -131,6 +131,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 ;
Is it actually supported? Above documentation does not say so, i.e. -a DBDF,representor=pf1 is missing.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 148
Quoted 13 lines
lib/librte_ethdev/ethdev_private.c +6
-0+ str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_DIM (eth_da->ports)); +if (str ==NULL ) + goto err; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;@@ -138,11 +146,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else {
If PF representors are actually supported, shouldn't it be if (str[0] != '\0')
plus rte_eth_devargs_process_list() after the body should be inside in fact?
Quoted 27 lines
lib/librte_ethdev/ethdev_private.c +6
-0+/* Don't mix legacy syntax with 'pf' section. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { + str =NULL ; + goto err; + } 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)); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;lib/librte_ethdev/rte_ethdev.h +1
-0@@ -1513,6 +1513,7 @@ 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 Physical Function. */ };/**
Re: [dpdk-dev] [PATCH v6 5/9] ethdev: support PF index in representor
Quoted 66 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 15, 2021 4:35 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 5/9] ethdev: support PF index in representorQuoted 56 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 PFsPF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representorSigned-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 | 18 ++++++++++++++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 3 files changed, 19 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 argumentsand users should consult the relevant PMD documentation to see support devargs.
lib/librte_ethdev/ethdev_private.c +2
-2@@ -118,8 +118,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 @@ -131,6 +131,14 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) {struct rte_eth_devargs *eth_da = data;
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 135
Quoted 2 lines
lib/librte_ethdev/ethdev_private.c +2
-0+if (str[0 ] =='p' && str[1 ] =='f' ) { + eth_da->type =RTE_ETH_REPRESENTOR_PF ;Is it actually supported? Above documentation does not say so, i.e. -a DBDF,representor=pf1 is missing.
Yes, will update.
Quoted 17 lines
Quoted 11 lines
lib/librte_ethdev/ethdev_private.c +6
-0+ str +=2 ; + str =rte_eth_devargs_process_list (str, eth_da->ports, + ð_da->nb_ports,RTE_DIM (eth_da->ports)); +if (str ==NULL ) + goto err; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 148
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +0
-0@@ -138,11 +146,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else {If PF representors are actually supported, shouldn't it be if (str[0] != '\0') plus
rte_eth_devargs_process_list()after the body should be inside in fact?
Yes, need this check, I'll add it after 'pf' parsing.
Also, 'c' should be followed by 'pf', 'pf' should followed by 'vf' or 'sf', I'll update check.
Quoted 28 lines
Quoted 28 lines
lib/librte_ethdev/ethdev_private.c +6
-0+/* Don't mix legacy syntax with 'pf' section. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { + str =NULL ; + goto err; + } 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)); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.hindex26b5e109c3..9cd519bf59100644lib/librte_ethdev/rte_ethdev.h +1
-0@@ -1513,6 +1513,7 @@ 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 Physical Function. */ };/**
PATCH v6 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_driver.h | 4 ++++ lib/librte_ethdev/ethdev_private.c | 25 +++++++++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-)
config/rte_config.h +1 -0
@@ -57,6 +57,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_driver.h +4 -0
@@ -1222,6 +1222,10 @@ rte_eth_switch_domain_free(uint16_t domain_id);* One type of representor each structure. */ 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;
lib/librte_ethdev/ethdev_private.c +21 -4
@@ -118,8 +118,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
@@ -131,6 +131,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 ;
@@ -146,8 +154,9 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else { -/* Don't mix legacy syntax with 'pf' section. */ -if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { +/* Don't mix legacy syntax with 'pf' and 'c' section. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF || + eth_da->nb_mh_controllers >0 ) { str =NULL ; goto err; }
@@ -156,6 +165,14 @@ 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_DIM (eth_da->representor_ports)); +if (str ==NULL ) + goto err; +/* "pf" must sit in middle of "c" and "vf"/"sf". */ +if (eth_da->nb_representor_ports >0 && eth_da->nb_mh_controllers >0 && + eth_da->nb_ports ==0 ) { +RTE_LOG (ERR ,EAL ,"'pf' section missing: %s\n" , str); +return -1 ; + } err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v6 6/9] ethdev: support multi-host in representor
Quoted 16 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.
Quoted 7 lines
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]>
PATCH v6 7/9 ethdev: new API to get representor info
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).
This patch introduces a new API rte_eth_representor_info_get() to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.
New ethdev callback representor_info_get() is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.
--- lib/librte_ethdev/ethdev_driver.h | 6 +++++ lib/librte_ethdev/rte_ethdev.c | 14 ++++++++++ lib/librte_ethdev/rte_ethdev.h | 43 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 3 +++ 4 files changed, 66 insertions(+)
lib/librte_ethdev/ethdev_driver.h +6 -0
@@ -289,6 +289,10 @@ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, char *fw_version, size_t fw_size);/**< @internal Get firmware information of an Ethernet device. */ +typedef int (*eth_representor_info_get_t )(struct rte_eth_dev *dev, +struct rte_eth_representor_info *info); +/**< @internal Get representor type and ID range. */ +typedef int (*eth_tx_done_cleanup_t )(void *txq,uint32_t free_cnt);/**< @internal Force mbufs to be from TX ring. */
@@ -823,6 +827,8 @@ struct eth_dev_ops {eth_burst_mode_get_t rx_burst_mode_get;/**< Get RX burst mode */ eth_burst_mode_get_t tx_burst_mode_get;/**< Get TX burst mode */ eth_fw_version_get_t fw_version_get;/**< Get firmware version. */ +eth_representor_info_get_t representor_info_get; +/**< Get representor info. */ eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;/**< Get packet types supported and identified by device. */ eth_dev_ptypes_set_t dev_ptypes_set;
lib/librte_ethdev/rte_ethdev.c +14 -0
@@ -3265,6 +3265,20 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) fw_version, fw_size)); } +int +rte_eth_representor_info_get (uint16_t port_id, +struct rte_eth_representor_info *info) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->fw_version_get, -ENOTSUP ); +return eth_err (port_id, (*dev->dev_ops->representor_info_get)(dev, + info)); +} +int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info) {
lib/librte_ethdev/rte_ethdev.h +43 -0
55 lines not on this page · raw message
lib/librte_ethdev/version.map +3 -0
@@ -243,6 +243,9 @@ EXPERIMENTAL { # added in 21.02 rte_eth_get_monitor_addr; + + # added in 21.05 + rte_eth_representor_info_get; }; INTERNAL {
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v6 7/9] ethdev: new API to get representor info
Quoted 13 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.
Quoted 5 lines
New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.Signed-off-by Xueming Li <[email protected]>
LGTM, except minor notes below.
Quoted 23 lines
--- lib/librte_ethdev/ethdev_driver.h | 6 +++++ lib/librte_ethdev/rte_ethdev.c | 14 ++++++++++ lib/librte_ethdev/rte_ethdev.h | 43 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 3 +++ 4 files changed, 66 insertions(+)lib/librte_ethdev/ethdev_driver.h +4
-0@@ -289,6 +289,10 @@ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, char *fw_version, size_t fw_size);/**< @internal Get firmware information of an Ethernet device. */ +typedef int (*eth_representor_info_get_t )(struct rte_eth_dev *dev, +struct rte_eth_representor_info *info); +/**< @internal Get representor type and ID range. */ +typedef int (*eth_tx_done_cleanup_t )(void *txq,uint32_t free_cnt);/**< @internal Force mbufs to be from TX ring. */
lib/librte_ethdev/ethdev_driver.h struct eth_dev_ops { · line 831
Quoted 5 lines
lib/librte_ethdev/ethdev_driver.h +2
-0@@ -823,6 +827,8 @@ struct eth_dev_ops {eth_burst_mode_get_t rx_burst_mode_get;/**< Get RX burst mode */ eth_burst_mode_get_t tx_burst_mode_get;/**< Get TX burst mode */ eth_fw_version_get_t fw_version_get;/**< Get firmware version. */ +eth_representor_info_get_t representor_info_get; +/**< Get representor info. */
Why is it added in the middle of the ops structure?
Quoted 11 lines
lib/librte_ethdev/ethdev_driver.h +0
-0eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;/**< Get packet types supported and identified by device. */ eth_dev_ptypes_set_t dev_ptypes_set;lib/librte_ethdev/rte_ethdev.c +0
-0@@ -3265,6 +3265,20 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) fw_version, fw_size)); }
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) · line 3277
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+int +rte_eth_representor_info_get (uint16_t port_id, +struct rte_eth_representor_info *info) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->fw_version_get, -ENOTSUP );
I guess you mean to check representor_info_get here.
Quoted 27 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+return eth_err (port_id, (*dev->dev_ops->representor_info_get)(dev, + info)); +} +int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info) {lib/librte_ethdev/rte_ethdev.h +12
-0@@ -1581,6 +1581,30 @@ struct rte_eth_dev_info {void *reserved_ptrs[2 ];/**< Reserved for future fields */ }; +/** +* @warning +* @b EXPERIMENTAL: this structure may change without prior notice. +* +* Ethernet device representor information +*/ +struct rte_eth_representor_info { +uint16_t controller;/**< Controller ID of caller device. */ +uint16_t pf;/**< Physical function ID of caller device. */ +struct { +enum rte_eth_representor_type type;/**< Representor type */ +int controller;/**< Controller ID, -1 to ignore */
lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1605
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+int pf;/**< Physical function ID, -1 to ignore */ + __extension__ +union { +int vf;/**< VF start index */ +int sf;/**< SF start index */ + }; +uint16_t id_base;/**< Representor ID start index */ +uint16_t id_end;/**< Representor ID end index */ +char name[RTE_DEV_NAME_MAX_LEN ];/**< Representor name */ + } ranges[]; /**< Representor ID range by type */
I'm pretty sure that you need separate type for the structure when you add support, since you need to allocate memory and calculate required size.
Quoted 31 lines
lib/librte_ethdev/rte_ethdev.h +21
-0+}; +/** * Ethernet device RX queue information structure. * Used to retrieve information about configured queue. @@ -3038,6 +3062,25 @@ int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);*/ int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info); +/** +* Retrieve the representor info of the device. +* +* @param port_id +* The port identifier of the device. +* @param info +* A pointer to a representor info structure. +* NULL to return number of range entries and allocate memory +* for next call to store detail. +* @return +* - (-ENOTSUP) if operation is not supported. +* - (-ENODEV) if *port_id* invalid. +* - (-EIO) if device is removed. +* - (>=0) number of representor range entries supported by device. +*/ +__rte_experimental +int rte_eth_representor_info_get(uint16_t port_id, +struct rte_eth_representor_info *info); +/** * Retrieve the firmware version of a device. *
Re: [dpdk-dev] [PATCH v6 7/9] ethdev: new API to get representor info
Quoted 55 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 15, 2021 4:50 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]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v6 7/9] ethdev: new API to get representor infoQuoted 13 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.Quoted 5 lines
New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.Signed-off-by Xueming Li <[email protected]>LGTM, except minor notes below.
Quoted 23 lines
--- lib/librte_ethdev/ethdev_driver.h | 6 +++++ lib/librte_ethdev/rte_ethdev.c | 14 ++++++++++ lib/librte_ethdev/rte_ethdev.h | 43 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 3 +++ 4 files changed, 66 insertions(+)lib/librte_ethdev/ethdev_driver.h +0
-0@@ -289,6 +289,10 @@ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, char *fw_version, size_t fw_size); /**< @internal Getfirmware information of an Ethernet device. */
lib/librte_ethdev/ethdev_driver.h +4
-0+typedef int (*eth_representor_info_get_t )(struct rte_eth_dev *dev, +struct rte_eth_representor_info *info);/**< @internal Get +representor type and ID range. */ +typedef int (*eth_tx_done_cleanup_t )(void *txq,uint32_t free_cnt);/**< @internal Force mbufs to be from TX ring. */
Quoted 8 lines
lib/librte_ethdev/ethdev_driver.h struct eth_dev_ops { · line 831
Quoted 6 lines
lib/librte_ethdev/ethdev_driver.h +2
-0@@ -823,6 +827,8 @@ struct eth_dev_ops {eth_burst_mode_get_t rx_burst_mode_get;/**< Get RX burst mode */ eth_burst_mode_get_t tx_burst_mode_get;/**< Get TX burst mode */ eth_fw_version_get_t fw_version_get;/**< Get firmware version. */ +eth_representor_info_get_t representor_info_get; +/**< Get representor info. */ Why is it added in the middle of the ops structure?
Looks like here group of function that getting information. Will move to end.
Quoted 12 lines
Quoted 12 lines
lib/librte_ethdev/ethdev_driver.h +0
-0eth_dev_supported_ptypes_get_t dev_supported_ptypes_get;/**< Get packet types supported and identified by device. */ eth_dev_ptypes_set_t dev_ptypes_set; diff --git
a/lib/librte_ethdev/rte_ethdev.cb/lib/librte_ethdev/rte_ethdev.cindexfe9466a03e..07c6debb58100644lib/librte_ethdev/rte_ethdev.c +0
-0@@ -3265,6 +3265,20 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) fw_version, fw_size)); }
Quoted 11 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) · line 3277
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +9
-0+int +rte_eth_representor_info_get (uint16_t port_id, +struct rte_eth_representor_info *info) { +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->fw_version_get, -ENOTSUP );I guess you mean to check
representor_info_gethere.
Thanks, my bad.
Quoted 31 lines
Quoted 31 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+return eth_err (port_id, (*dev->dev_ops->representor_info_get)(dev, + info)); +} +int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info) { diff --git a/lib/librte_ethdev/rte_ethdev.h
b/lib/librte_ethdev/rte_ethdev.hindex9cd519bf59..35eb0a5721100644lib/librte_ethdev/rte_ethdev.h +16
-0@@ -1581,6 +1581,30 @@ struct rte_eth_dev_info {void *reserved_ptrs[2 ];/**< Reserved for future fields */ }; +/** +* @warning +* @b EXPERIMENTAL: this structure may change without prior notice. +* + * Ethernet device representor information */ struct +rte_eth_representor_info { + uint16_t controller; /**< Controller ID of caller device. */ + uint16_t pf; /**< Physical function ID of caller device. */ + struct { + enum rte_eth_representor_type type; /**< Representor type */ + int controller; /**< Controller ID, -1 to ignore */ + int pf; /**< Physical function ID, -1 to ignore */ + __extension__ + union { + int vf; /**< VF start index */ + int sf; /**< SF start index */
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1605
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.h +5
-0+ }; +uint16_t id_base;/**< Representor ID start index */ +uint16_t id_end;/**< Representor ID end index */ +char name[RTE_DEV_NAME_MAX_LEN ];/**< Representor name */ + } ranges[]; /**< Representor ID range by type */I'm pretty sure that you need separate type for the structure when you add support, since you need to allocate memory and calculate required size.
Sizeof(info.ranges[0]) works, but splitting looks a good idea :)
Quoted 33 lines
Quoted 33 lines
lib/librte_ethdev/rte_ethdev.h +21
-0+}; +/** * Ethernet device RX queue information structure. * Used to retrieve information about configured queue. @@ -3038,6 +3062,25 @@ int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);*/ int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info); +/** +* Retrieve the representor info of the device. +* +* @param port_id +* The port identifier of the device. +* @param info +* A pointer to a representor info structure. +* NULL to return number of range entries and allocate memory +* for next call to store detail. +* @return +* - (-ENOTSUP) if operation is not supported. +* - (-ENODEV) if *port_id* invalid. +* - (-EIO) if device is removed. +* - (>=0) number of representor range entries supported by device. +*/ +__rte_experimental +int rte_eth_representor_info_get(uint16_t port_id, +struct rte_eth_representor_info *info); +/** * Retrieve the firmware version of a device. *
PATCH v6 8/9 ethdev: representor iterator compare complete info
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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to convert representor controller, pf and vf/sf index to representor ID. Representor comparer callback convert representor info into ID and compare with device representor ID.
--- lib/librte_ethdev/ethdev_driver.h | 32 ++++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++---- lib/librte_ethdev/rte_ethdev.c | 83 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 145 insertions(+), 9 deletions(-)
lib/librte_ethdev/ethdev_driver.h +32 -0
@@ -1243,6 +1243,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* PMD helper function to convert representor ID from location detail +* +* Convert representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* If PMD doesn't return representor range info, simply ignore controller +* and pf to keep backward compatibility. +* +* @param ethdev +* Handle of ethdev port. +* @param id +* Pointer to converted representor ID. +* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* Representor port ID, -1 if unspecified. +* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port); +/** * PMD helper function to parse ethdev arguments *
lib/librte_ethdev/rte_class_eth.c +29 -9
@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +77,36 @@ 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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports :1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_convert (edev, + &id, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f]) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }
@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */
lib/librte_ethdev/rte_ethdev.c +83 -0
89 lines not on this page · raw message
lib/librte_ethdev/version.map +1 -0
@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_convert; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v6 8/9] ethdev: representor iterator compare complete info
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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to convert representor controller, pf and vf/sf index to representor ID. Representor comparer callback convert representor info into ID and compare with device representor ID.
Signed-off-by Xueming Li <[email protected]>--- lib/librte_ethdev/ethdev_driver.h | 32 ++++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++---- lib/librte_ethdev/rte_ethdev.c | 83 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 145 insertions(+), 9 deletions(-)lib/librte_ethdev/ethdev_driver.h +0
-0@@ -1243,6 +1243,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1253
Quoted 10 lines
lib/librte_ethdev/ethdev_driver.h +8
-0}; +/** +* PMD helper function to convert representor ID from location detail +* +* Convert representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* If PMD doesn't return representor range info, simply ignore controller +* and pf to keep backward compatibility.
It does not sound right. If controller and/or pf is specified, it must not be ignored.
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1257
Quoted 4 lines
lib/librte_ethdev/ethdev_driver.h +4
-0+* +* @param ethdev +* Handle of ethdev port. +* @param id
May I suggest to name it 'repr_id' to make it less ambguous.
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1258
Quoted 1 line
lib/librte_ethdev/ethdev_driver.h +1
-0+* Pointer to converted representor ID.
I'd prefer do not mix in and out paramters. I suggest to make it the last parameter.
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1266
Quoted 8 lines
lib/librte_ethdev/ethdev_driver.h +8
-0+* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* Representor port ID, -1 if unspecified.
Not sure that I understand what is it? Is it vf or sf number?
Quoted 101 lines
lib/librte_ethdev/ethdev_driver.h +11
-0+* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port); +/** * PMD helper function to parse ethdev arguments * lib/librte_ethdev/rte_class_eth.c +29
-9@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */ @@ -76,17 +77,36 @@ 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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports :1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_convert (edev, + &id, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f]) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */ lib/librte_ethdev/rte_ethdev.c +10
-0@@ -5617,6 +5617,89 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port) +{ +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ; +size_t size; +
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5639
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (id ==NULL ) +return -EINVAL ; + +/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) { +/* Fallback to direct mapping for compatibility. */ + *id = representor_port;
I think it is a bad behaviour as I stated above. It is only if and only if type is VF, controller and PF are unspecified and representor_port is specified.
Quoted 14 lines
lib/librte_ethdev/rte_ethdev.c +14
-0+ } + n = ret; + size =sizeof (*info) + n *sizeof (info->ranges[0 ]); + info =calloc (1 , size); +if (info ==NULL ) +return -ENOMEM ; + ret =rte_eth_representor_info_get (ethdev->data->port_id, info); +if (ret <0 ) + goto out; + +/* Default controller and pf to caller. */ +if (controller ==-1 ) + controller = info->controller; +if (pf ==-1 )
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5663
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ pf = info->pf; + +/* Locate representor ID. */ +for (i =0 ; i < n; ++i) { +if (info->ranges[i].type != type) +continue ; +/* PMD hit: ignore controller if -1. */ +if (info->ranges[i].controller !=-1 && + info->ranges[i].controller != (uint16_t )controller) +continue ;
I think it is incorrect to ignore controller in range if controller is specified in request. It must match.
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+ count = info->ranges[i].id_end - info->ranges[i].id_base +1 ; +if (info->ranges[i].type ==RTE_ETH_REPRESENTOR_PF ) { +/* PF. */ +if (pf >= info->ranges[i].pf + count)
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5677
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+continue ; + *id = info->ranges[i].id_base + + (pf - info->ranges[i].pf); + goto out; + } +/* VF or SF. */ +/* PMD hit: ignore pf if -1. */ +if (info->ranges[i].pf !=-1 && + info->ranges[i].pf != (uint16_t )pf) +continue ;
Same for PF.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5678
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +1
-0+if (info->ranges[i].type ==RTE_ETH_REPRESENTOR_VF ) {
Typically switch/case looks a bit a bitter for such code.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5679
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +1
-0+/* VF. */
The comment is useless
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5686
Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +7
-0+if (representor_port >= info->ranges[i].vf + count) +continue ; + *id = info->ranges[i].id_base + + (representor_port - info->ranges[i].vf); + goto out; + }else if (info->ranges[i].type ==RTE_ETH_REPRESENTOR_SF ) { +/* SF. */
The comment is useless
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5699
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +13
-0+if (representor_port >= info->ranges[i].sf + count) +continue ; + *id = info->ranges[i].id_base + + (representor_port - info->ranges[i].sf); + goto out; + } + } +/* Not matching representor ID range. */ + ret = -ENOENT ; + +out: +if (info !=NULL ) +free (info);
There is no necessity to check against NULL above, free() does it in any case.
Quoted 19 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+return ret; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,lib/librte_ethdev/version.map +1
-0@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_convert; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
Re: [dpdk-dev] [PATCH v6 8/9] ethdev: representor iterator compare complete info
Quoted 45 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 15, 2021 5:32 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]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v6 8/9] ethdev: representor iterator compare complete infoQuoted 34 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to convert representor controller, pf and vf/sf index to representor ID. Representor comparer callback convert representor info into ID and compare with device representor ID.
Signed-off-by Xueming Li <[email protected]>--- lib/librte_ethdev/ethdev_driver.h | 32 ++++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++---- lib/librte_ethdev/rte_ethdev.c | 83 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 145 insertions(+), 9 deletions(-)lib/librte_ethdev/ethdev_driver.h +0
-0@@ -1243,6 +1243,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ };
Quoted 11 lines
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1253
Quoted 9 lines
lib/librte_ethdev/ethdev_driver.h +9
-0+/** +* PMD helper function to convert representor ID from location detail +* +* Convert representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* If PMD doesn't return representor range info, simply ignore +controller +* and pf to keep backward compatibility. It does not sound right. If controller and/or pf is specified, it must not be ignored.
Okay, return error if info not found.
Quoted 7 lines
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1257
Quoted 5 lines
lib/librte_ethdev/ethdev_driver.h +4
-0+* +* @param ethdev +* Handle of ethdev port. +* @param id May I suggest to name it '
repr_id' to make it less ambguous.
Accept.
Quoted 14 lines
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1258
Quoted 2 lines
lib/librte_ethdev/ethdev_driver.h +1
-0+* Pointer to converted representor ID. I'd prefer do not mix in and out paramters. I suggest to make it the last parameter.
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1266
Quoted 8 lines
lib/librte_ethdev/ethdev_driver.h +8
-0+* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* Representor port ID, -1 if unspecified.
Quoted 1 line
Not sure that I understand what is it? Is it vf or sf number?
Yes, will make it clear.
Quoted 108 lines
Quoted 108 lines
lib/librte_ethdev/ethdev_driver.h +11
-0+* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port); +/** * PMD helper function to parse ethdev arguments * lib/librte_ethdev/rte_class_eth.c +4
-3@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 ) return -1; /* not a representor port */ @@ -76,17 +77,36 @@eth_representor_cmp(const char *key
__rte_unused,lib/librte_ethdev/rte_class_eth.c +26
-6values =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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports : +1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_convert (edev, + &id, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f]) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */ (quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex07c6debb58..da0cf1a920100644lib/librte_ethdev/rte_ethdev.c +14
-0@@ -5617,6 +5617,89 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port) { +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ; +size_t size; + +if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (id ==NULL ) +return -EINVAL ; +
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5639
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +5
-0+/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) { +/* Fallback to direct mapping for compatibility. */ + *id = representor_port;I think it is a bad behaviour as I stated above. It is only if and only if type is VF, controller and PF are unspecified and
representor_portis specified.
Agree, will make it only valid for legacy VF representor.
Quoted 19 lines
Quoted 19 lines
lib/librte_ethdev/rte_ethdev.c +18
-0+ } + n = ret; + size =sizeof (*info) + n *sizeof (info->ranges[0 ]); + info =calloc (1 , size); +if (info ==NULL ) +return -ENOMEM ; + ret =rte_eth_representor_info_get (ethdev->data->port_id, info); +if (ret <0 ) + goto out; + +/* Default controller and pf to caller. */ +if (controller ==-1 ) + controller = info->controller; +if (pf ==-1 ) + pf = info->pf; + +/* Locate representor ID. */ +for (i =0 ; i < n; ++i) {
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5663
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+if (info->ranges[i].type != type) +continue ; +/* PMD hit: ignore controller if -1. */ +if (info->ranges[i].controller !=-1 && + info->ranges[i].controller != (uint16_t )controller) +continue ;I think it is incorrect to ignore controller in range if controller is specified in request. It must match.
This is a real requirement I'm facing from orchestration, before orchestration having knowledge on port status, it always send "pf#vf#" to OVS->DPDK, although "pf#" is meaningless in standard mode. It will take time for orchestration and OVS to evolve... PMD uses this option to decide ignore them or not.
Quoted 18 lines
Quoted 5 lines
lib/librte_ethdev/rte_ethdev.c +4
-0+ count = info->ranges[i].id_end - info->ranges[i].id_base +1 ; +if (info->ranges[i].type ==RTE_ETH_REPRESENTOR_PF ) { +/* PF. */ +if (pf >= info->ranges[i].pf + count)lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5677
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+continue ; + *id = info->ranges[i].id_base + + (pf - info->ranges[i].pf); + goto out; + } +/* VF or SF. */ +/* PMD hit: ignore pf if -1. */ +if (info->ranges[i].pf !=-1 && + info->ranges[i].pf != (uint16_t )pf) +continue ;Same for PF.
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5678
Quoted 1 line
lib/librte_ethdev/rte_ethdev.c +1
-0+if (info->ranges[i].type ==RTE_ETH_REPRESENTOR_VF ) {Typically switch/case looks a bit a bitter for such code.
'bitter'? :) will update.
Quoted 4 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5679
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +1
-0+/* VF. */ The comment is useless
Accept this one and bellows.
Quoted 46 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5686
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +7
-0+if (representor_port >= info->ranges[i].vf + count) +continue ; + *id = info->ranges[i].id_base + + (representor_port - info->ranges[i].vf); + goto out; + }else if (info->ranges[i].type ==RTE_ETH_REPRESENTOR_SF ) { +/* SF. */ The comment is useless
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5699
Quoted 13 lines
lib/librte_ethdev/rte_ethdev.c +13
-0+if (representor_port >= info->ranges[i].sf + count) +continue ; + *id = info->ranges[i].id_base + + (representor_port - info->ranges[i].sf); + goto out; + } + } +/* Not matching representor ID range. */ + ret = -ENOENT ; + +out: +if (info !=NULL ) +free (info);There is no necessity to check against NULL above,
free()does it in any case.Quoted 19 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+return ret; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,(quoted diff) +0
-0b/lib/librte_ethdev/version.map index
bb6f7436c2..2891f5734e100644lib/librte_ethdev/version.map +1
-0@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_convert; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
Re: [dpdk-dev] [PATCH v6 8/9] ethdev: representor iterator compare complete info
Quoted 30 lines · Xueming(Steven) Li
Quoted 30 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, February 15, 2021 5:32 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]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v6 8/9] ethdev: representor iterator compare complete infoQuoted 19 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to convert representor controller, pf and vf/sf index to representor ID. Representor comparer callback convert representor info into ID and compare with device representor ID.
Signed-off-by Xueming Li <[email protected]>
[snip]
Quoted 27 lines
Quoted 18 lines
Quoted 18 lines
lib/librte_ethdev/rte_ethdev.c +18
-0+ } + n = ret; + size =sizeof (*info) + n *sizeof (info->ranges[0 ]); + info =calloc (1 , size); +if (info ==NULL ) +return -ENOMEM ; + ret =rte_eth_representor_info_get (ethdev->data->port_id, info); +if (ret <0 ) + goto out; + +/* Default controller and pf to caller. */ +if (controller ==-1 ) + controller = info->controller; +if (pf ==-1 ) + pf = info->pf; + +/* Locate representor ID. */ +for (i =0 ; i < n; ++i) {Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5663
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+if (info->ranges[i].type != type) +continue ; +/* PMD hit: ignore controller if -1. */ +if (info->ranges[i].controller !=-1 && + info->ranges[i].controller != (uint16_t )controller) +continue ;I think it is incorrect to ignore controller in range if controller is specified in request. It must match.
Quoted 3 lines
This is a real requirement I'm facing from orchestration, before orchestration having knowledge on port status, it always send "pf#vf#" to
OVS->DPDK, although "pf#" is meaningless in standard mode. It will take time for orchestration and OVS to evolve... PMD uses this option to decide ignore them or not.
I'll take a look at it on the next version, but it still sounds wrong when something is specified, but ignored. May be I simply misunderstand.
Thanks for working on the patch series.
PATCH v6 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 v6 0/9] ethdev: support SubFunction representor
In reply to Xueming LiQuoted 80 lines · On Sun, 14 Feb 2021 03:21:30 +0000 Xueming Li <[email protected]> wrote:
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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 encodingXueming 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 listsapp/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 ++++-
Quoted 9 lines
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(-)
A couple of higher level design questions:
1. How does Linux and other OS handle this in their API?
2. This solution seems quite tied into a specific implementation on your hardware. Is there a PCI standard for this?
3. Maybe a more general solution where these were represented as buses would allow for other connection methods in the future?
Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representor
Quoted 100 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Tuesday, February 23, 2021 09:55
To: Xueming Li <[email protected]>
Cc: [email protected]; Viacheslav Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 80 lines · On Sun, 14 Feb 2021 03:21:30 +0000 Xueming Li <[email protected]> wrote:
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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 encodingXueming 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 listsapp/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 ++++-Quoted 9 lines
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(-)
Quoted 7 lines
A couple of higher level design questions:
1. How does Linux and other OS handle this in their API?
2. This solution seems quite tied into a specific implementation on your hardware. Is there a PCI standard for this?3. Maybe a more general solution where these were represented as buses would allow for other connection methods in the future?
It should be "auxiliary bus", I think. ;-)
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/auxiliary.c
mlx5 subfunction support
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=24a790da0ac4d9bcce2a9becc8799241716672f6
Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representor
Quoted 113 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, February 23, 2021 7:46 PM
To: Stephen Hemminger <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 104 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Tuesday, February 23, 2021 09:55
To: Xueming Li <[email protected]>
Cc: [email protected]; Viacheslav Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 80 lines · On Sun, 14 Feb 2021 03:21:30 +0000 Xueming Li <[email protected]> wrote:
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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 encodingXueming 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 listsapp/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 ++++-Quoted 9 lines
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(-)A couple of higher level design questions:
1. How does Linux and other OS handle this in their API?
Hi Stephen, thanks for looking this!
Representor was a type of ethdev, OS independent.
SF representor is a new type besides existing VF representor type.
Quoted 2 lines
Quoted 2 lines
2. This solution seems quite tied into a specific implementation on your hardware. Is there a PCI standard for this?
SF has been carved in kernel, supported by devlink. The devlink document in the link Haiyue posted should be helpful to understand the overall picture:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=24a790da0ac4d9bcce2a9becc8799241716672f6
Quoted 5 lines
Quoted 3 lines
3. Maybe a more general solution where these were represented as buses would allow for other connection methods in the future?
It should be "auxiliary bus", I think. ;-) https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/auxiliary.c
Good link, Mellanox has exactly implemented SF based auxiliary bus, I'm going to post another RFC to support auxiliary bus. But this patchset still needed to support representor of SF.
Quoted 3 lines
mlx5 subfunction support
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=24a790da0ac4d9bcce2a9becc8799241716672f6
Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representor
In reply to Wang, HaiyueQuoted 116 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, February 23, 2021 7:46 PM
To: Stephen Hemminger <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 106 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Tuesday, February 23, 2021 09:55
To: Xueming Li <[email protected]>
Cc: [email protected]; Viacheslav Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 80 lines · On Sun, 14 Feb 2021 03:21:30 +0000 Xueming Li <[email protected]> wrote:
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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 encodingXueming 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 listsapp/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 ++++-Quoted 9 lines
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(-)A couple of higher level design questions:
1. How does Linux and other OS handle this in their API?
2. This solution seems quite tied into a specific implementation on your hardware. Is there a PCI standard for this?
Quoted 7 lines
Quoted 2 lines
3. Maybe a more general solution where these were represented as buses would allow for other connection methods in the future?
It should be "auxiliary bus", I think. ;-) https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/auxiliary.c
mlx5 subfunction support
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=24a790da0ac4d9bcce2a9becc8799241716672f6
Hi,
The Auxiliary driver for DPDK posted, welcome to have a look :)
http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Thanks
Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representor
Quoted 129 lines
-----Original Message-----
From: Xueming(Steven) Li <[email protected]>
Sent: Wednesday, March 31, 2021 13:49
To: Wang, Haiyue <[email protected]>; Stephen Hemminger <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 114 lines
-----Original Message-----
From: Wang, Haiyue <[email protected]>
Sent: Tuesday, February 23, 2021 7:46 PM
To: Stephen Hemminger <[email protected]>; Xueming(Steven) Li <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: RE: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 106 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Stephen Hemminger
Sent: Tuesday, February 23, 2021 09:55
To: Xueming Li <[email protected]>
Cc: [email protected]; Viacheslav Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 0/9] ethdev: support SubFunction representorQuoted 80 lines · On Sun, 14 Feb 2021 03:21:30 +0000 Xueming Li <[email protected]> wrote:
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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 encodingXueming 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 listsapp/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 ++++-Quoted 9 lines
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(-)A couple of higher level design questions:
1. How does Linux and other OS handle this in their API?
2. This solution seems quite tied into a specific implementation on your hardware. Is there a PCI standard for this?Quoted 4 lines
Quoted 2 lines
3. Maybe a more general solution where these were represented as buses would allow for other connection methods in the future?
It should be "auxiliary bus", I think. ;-)
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/base/auxiliary.c
Quoted 1 line
Quoted 8 lines
Quoted 2 lines
mlx5 subfunction support
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=24a790da0ac4d9bcce2a9be
cc8799241716672f6Hi,
The Auxiliary driver for DPDK posted, welcome to have a look :)
http://patchwork.dpdk.org/project/dpdk/patch/[email protected]/
Cool. ;-)
Quoted 3 lines
Thanks
v7 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
V7:
- error on duplicated representor argument:
DBDF,representor=a,representor=b
- fix pf representor type parsing
- other small fixes suggested by Andrew.
[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
[6] V5:
http://patchwork.dpdk.org/project/dpdk/list/?series=14834
[7] V6:
http://patchwork.dpdk.org/project/dpdk/list/?series=15258
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 | 18 +- .../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 | 50 +++++- lib/librte_ethdev/ethdev_private.c | 169 ++++++++++++------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++-- lib/librte_ethdev/rte_ethdev.c | 116 +++++++++++- lib/librte_ethdev/rte_ethdev.h | 61 +++++++ lib/librte_ethdev/version.map | 4 + lib/librte_kvargs/rte_kvargs.c | 101 ++++++++--- 17 files changed, 557 insertions(+), 125 deletions(-)
Signature · 1 line
2.25.1
PATCH v7 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 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
PATCH v7 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 v7 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 | 6 +++- .../prog_guide/switch_representation.rst | 35 +++++++++++++------ lib/librte_ethdev/ethdev_private.c | 11 ++++-- lib/librte_ethdev/rte_ethdev.c | 6 ++++ lib/librte_ethdev/rte_ethdev.h | 1 + 5 files changed, 46 insertions(+), 13 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +5 -1
@@ -372,12 +372,16 @@ parameters to those ports. * ``representor`` for a device which supports the creation of representor ports this argument allows user to specify which switch ports to enable port - representors for.:: + representors for. Multiple representors in one device argument is invalid:: -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] + -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.c +6 -0
@@ -5589,6 +5589,12 @@ 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 ) { +if (eth_da->type !=RTE_ETH_REPRESENTOR_NONE ) { +RTE_LOG (ERR ,EAL ,"duplicated representor key: %s\n" , + dargs); + result =-1 ; + goto parse_cleanup; + } result =rte_eth_devargs_parse_representor_ports ( pair->value, eth_da);if (result <0 )
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
PATCH v7 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
PF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representor
--- doc/guides/prog_guide/poll_mode_drv.rst | 3 +++ lib/librte_ethdev/ethdev_private.c | 19 +++++++++++++++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +3 -0
@@ -382,6 +382,9 @@ 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] + -a DBDF,representor=pf1 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 +17 -2
@@ -118,8 +118,9 @@ 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 +* pf#: PF port representor/s * * Examples of #: * 2 - single
@@ -131,6 +132,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_DIM (eth_da->ports)); +if (str ==NULL || str[0 ] =='\0' ) + goto err; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;
@@ -138,11 +147,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else { +/* 'pf' must followed by 'vf' or 'sf'. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { + str =NULL ; + goto err; + } 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)); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1513,6 +1513,7 @@ 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 Physical Function. */ };/**
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v7 5/9] ethdev: support PF index in representor
Quoted 9 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 6 lines
PF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representorSigned-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
A nit below.
Quoted 37 lines
--- doc/guides/prog_guide/poll_mode_drv.rst | 3 +++ lib/librte_ethdev/ethdev_private.c | 19 +++++++++++++++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-)doc/guides/prog_guide/poll_mode_drv.rst +3
-0@@ -382,6 +382,9 @@ 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] + -a DBDF,representor=pf1 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 +3
-2@@ -118,8 +118,9 @@ 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 +* pf#: PF port representor/s * * Examples of #: * 2 - single
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 141
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +7
-0@@ -131,6 +132,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_DIM (eth_da->ports)); +if (str ==NULL || str[0 ] =='\0' ) + goto err;
'err' label name is misleading here, since it is not always error as far as I can see. It is a normal path in the case of 'pfX'. May be rename it as 'done' or something like this.
Quoted 35 lines
lib/librte_ethdev/ethdev_private.c +7
-0+ }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;@@ -138,11 +147,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else { +/* 'pf' must followed by 'vf' or 'sf'. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { + str =NULL ; + goto err; + } 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)); +err:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;lib/librte_ethdev/rte_ethdev.h +1
-0@@ -1513,6 +1513,7 @@ 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 Physical Function. */ };/**
PATCH v7 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_driver.h | 4 ++++ lib/librte_ethdev/ethdev_private.c | 18 +++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-)
config/rte_config.h +1 -0
@@ -57,6 +57,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_driver.h +4 -0
@@ -1222,6 +1222,10 @@ rte_eth_switch_domain_free(uint16_t domain_id);* One type of representor each structure. */ 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;
lib/librte_ethdev/ethdev_private.c +15 -3
@@ -118,9 +118,9 @@ 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 -* pf#: PF port representor/s +* [[c#]pf#]vf#: VF port representor/s +* [[c#]pf#]sf#: SF port representor/s +* [c#]pf#: PF port representor/s * * Examples of #: * 2 - single
@@ -132,6 +132,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 ;
@@ -139,6 +147,10 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) ð_da->nb_ports, RTE_DIM(eth_da->ports));if (str ==NULL || str[0 ] =='\0' ) goto err; + }else if (eth_da->nb_mh_controllers >0 ) { +/* 'c' must followed by 'pf'. */ + str =NULL ; + goto err; }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ;
Signature · 1 line
2.25.1
PATCH v7 7/9 ethdev: new API to get representor info
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).
This patch introduces a new API rte_eth_representor_info_get() to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.
New ethdev callback representor_info_get() is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.
--- lib/librte_ethdev/ethdev_driver.h | 7 +++++ lib/librte_ethdev/rte_ethdev.c | 14 +++++++++ lib/librte_ethdev/rte_ethdev.h | 51 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 3 ++ 4 files changed, 75 insertions(+)
lib/librte_ethdev/ethdev_driver.h +7 -0
@@ -289,6 +289,10 @@ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, char *fw_version, size_t fw_size);/**< @internal Get firmware information of an Ethernet device. */ +typedef int (*eth_representor_info_get_t )(struct rte_eth_dev *dev, +struct rte_eth_representor_info *info); +/**< @internal Get representor type and ID range. */ +typedef int (*eth_tx_done_cleanup_t )(void *txq,uint32_t free_cnt);/**< @internal Force mbufs to be from TX ring. */
@@ -940,6 +944,9 @@ struct eth_dev_ops {eth_get_monitor_addr_t get_monitor_addr;/**< Get power monitoring condition for Rx queue. */ + +eth_representor_info_get_t representor_info_get; +/**< Get representor info. */ };/**
lib/librte_ethdev/rte_ethdev.c +14 -0
@@ -3265,6 +3265,20 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) fw_version, fw_size)); } +int +rte_eth_representor_info_get (uint16_t port_id, +struct rte_eth_representor_info *info) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->representor_info_get, -ENOTSUP ); +return eth_err (port_id, (*dev->dev_ops->representor_info_get)(dev, + info)); +} +int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info) {
lib/librte_ethdev/rte_ethdev.h +51 -0
63 lines not on this page · raw message
lib/librte_ethdev/version.map +3 -0
@@ -243,6 +243,9 @@ EXPERIMENTAL { # added in 21.02 rte_eth_get_monitor_addr; + + # added in 21.05 + rte_eth_representor_info_get; }; INTERNAL {
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v7 7/9] ethdev: new API to get representor info
Quoted 13 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.
Quoted 5 lines
New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.Signed-off-by Xueming Li <[email protected]>
LGTM, except style nitpicking, see below. Just be consistent.
Quoted 12 lines
--- lib/librte_ethdev/ethdev_driver.h | 7 +++++ lib/librte_ethdev/rte_ethdev.c | 14 +++++++++ lib/librte_ethdev/rte_ethdev.h | 51 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 3 ++ 4 files changed, 75 insertions(+)lib/librte_ethdev/ethdev_driver.h +0
-0
lib/librte_ethdev/ethdev_driver.h typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, · line 295
Quoted 7 lines
lib/librte_ethdev/ethdev_driver.h +4
-0@@ -289,6 +289,10 @@ typedef int (*eth_fw_version_get_t)(struct rte_eth_dev *dev, char *fw_version, size_t fw_size);/**< @internal Get firmware information of an Ethernet device. */ +typedef int (*eth_representor_info_get_t )(struct rte_eth_dev *dev, +struct rte_eth_representor_info *info); +/**< @internal Get representor type and ID range. */ +
Here the snippet is added after FW version get.
lib/librte_ethdev/ethdev_driver.h struct eth_dev_ops { · line 949
Quoted 10 lines
lib/librte_ethdev/ethdev_driver.h +3
-0typedef int (*eth_tx_done_cleanup_t )(void *txq,uint32_t free_cnt);/**< @internal Force mbufs to be from TX ring. */ @@ -940,6 +944,9 @@ struct eth_dev_ops {eth_get_monitor_addr_t get_monitor_addr;/**< Get power monitoring condition for Rx queue. */ + +eth_representor_info_get_t representor_info_get; +/**< Get representor info. */
Here at the end.
Quoted 15 lines
lib/librte_ethdev/ethdev_driver.h +0
-0};/** lib/librte_ethdev/rte_ethdev.c +4
-0@@ -3265,6 +3265,20 @@ rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) fw_version, fw_size)); } +int +rte_eth_representor_info_get (uint16_t port_id, +struct rte_eth_representor_info *info) +{
lib/librte_ethdev/rte_ethdev.c rte_eth_dev_fw_version_get(uint16_t port_id, char *fw_version, size_t fw_size) · line 3281
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->representor_info_get, -ENOTSUP ); +return eth_err (port_id, (*dev->dev_ops->representor_info_get)(dev, + info)); +} +
Here after FW version get again.
Quoted 33 lines
lib/librte_ethdev/rte_ethdev.c +0
-0int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info) {lib/librte_ethdev/rte_ethdev.h +22
-0@@ -1581,6 +1581,38 @@ struct rte_eth_dev_info {void *reserved_ptrs[2 ];/**< Reserved for future fields */ }; +/** +* @warning +* @b EXPERIMENTAL: this structure may change without prior notice. +* +* ethernet device representor ID range entry +*/ +struct rte_eth_representor_range { +enum rte_eth_representor_type type;/**< Representor type */ +int controller;/**< Controller ID, -1 to ignore */ +int pf;/**< Physical function ID, -1 to ignore */ + __extension__ +union { +int vf;/**< VF start index */ +int sf;/**< SF start index */ + }; +uint16_t id_base;/**< Representor ID start index */ +uint16_t id_end;/**< Representor ID end index */ +char name[RTE_DEV_NAME_MAX_LEN ];/**< Representor name */ +}; + +/** +* @warning
lib/librte_ethdev/rte_ethdev.h struct rte_eth_dev_info { · line 1615
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+* @b EXPERIMENTAL: this structure may change without prior notice. +* +* Ethernet device representor information +*/ +struct rte_eth_representor_info { +uint16_t controller;/**< Controller ID of caller device. */ +uint16_t pf;/**< Physical function ID of caller device. */ +struct rte_eth_representor_range ranges[];/**< Representor ID range. */ +}; +
I'd put it just before rte_eth_representor_info_get().
Quoted 16 lines
lib/librte_ethdev/rte_ethdev.h +9
-0/** * Ethernet device RX queue information structure. * Used to retrieve information about configured queue. @@ -3038,6 +3070,25 @@ int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr);*/ int rte_eth_dev_info_get (uint16_t port_id,struct rte_eth_dev_info *dev_info); +/** +* Retrieve the representor info of the device. +* +* @param port_id +* The port identifier of the device. +* @param info +* A pointer to a representor info structure. +* NULL to return number of range entries and allocate memory +* for next call to store detail.
lib/librte_ethdev/rte_ethdev.h int rte_eth_macaddr_get(uint16_t port_id, struct rte_ether_addr *mac_addr); · line 3091
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.h +10
-0+* @return +* - (-ENOTSUP) if operation is not supported. +* - (-ENODEV) if *port_id* invalid. +* - (-EIO) if device is removed. +* - (>=0) number of representor range entries supported by device. +*/ +__rte_experimental +int rte_eth_representor_info_get(uint16_t port_id, +struct rte_eth_representor_info *info); +
Here you add it *before* FW version get.
Quoted 18 lines
lib/librte_ethdev/rte_ethdev.h +0
-0/** * Retrieve the firmware version of a device. * lib/librte_ethdev/version.map +3
-0@@ -243,6 +243,9 @@ EXPERIMENTAL { # added in 21.02 rte_eth_get_monitor_addr; + + # added in 21.05 + rte_eth_representor_info_get; }; INTERNAL {
PATCH v7 8/9 ethdev: representor iterator compare complete info
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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to convert representor controller, pf and vf/sf index to representor ID. Representor comparer callback convert representor info into ID and compare with device representor ID.
--- lib/librte_ethdev/ethdev_driver.h | 32 +++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++--- lib/librte_ethdev/rte_ethdev.c | 91 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 153 insertions(+), 9 deletions(-)
lib/librte_ethdev/ethdev_driver.h +32 -0
@@ -1244,6 +1244,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* PMD helper function to convert representor ID from location detail +* +* Convert representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* For backward compatibility, if no representor info, direct +* map legacy VF (no controller and pf). +* +* @param ethdev +* Handle of ethdev port. +* @param repr_id +* Pointer to converted representor ID. +* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* VF or SF representor port number, -1 if unspecified. +* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *repr_id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port); +/** * PMD helper function to parse ethdev arguments *
lib/librte_ethdev/rte_class_eth.c +29 -9
@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +77,36 @@ 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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports :1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_convert (edev, + &id, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f]) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }
@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */
lib/librte_ethdev/rte_ethdev.c +91 -0
97 lines not on this page · raw message
lib/librte_ethdev/version.map +1 -0
@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_convert; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v7 8/9] ethdev: representor iterator compare complete info
Quoted 31 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to convert representor controller, pf and vf/sf index to representor ID. Representor comparer callback convert representor info into ID and compare with device representor ID.
Signed-off-by Xueming Li <[email protected]>--- lib/librte_ethdev/ethdev_driver.h | 32 +++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++--- lib/librte_ethdev/rte_ethdev.c | 91 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 153 insertions(+), 9 deletions(-)lib/librte_ethdev/ethdev_driver.h +0
-0
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1248
Quoted 5 lines
lib/librte_ethdev/ethdev_driver.h +2
-0@@ -1244,6 +1244,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* PMD helper function to convert representor ID from location detail
Full stop is missing above.
Also I'm not sure in term "convert" here. It sounds a bit misleading to me. May be just "get". I.e
PMD helper function to get representor ID by location detail. andrte_eth_representor_id_get()
What do you think?
Quoted 9 lines
lib/librte_ethdev/ethdev_driver.h +9
-0+* +* Convert representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* For backward compatibility, if no representor info, direct +* map legacy VF (no controller and pf). +* +* @param ethdev +* Handle of ethdev port.
lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1267
Quoted 10 lines
lib/librte_ethdev/ethdev_driver.h +10
-0+* @param repr_id +* Pointer to converted representor ID. +* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* VF or SF representor port number, -1 if unspecified.
Mixing input and output parameters looks bad to me. May I suggest to put repr_id the last?
I.e. to have all input parameters first. (May be I've already mentioned it, if I missed your reply, please, repeat it once again).
Quoted 131 lines
lib/librte_ethdev/ethdev_driver.h +11
-0+* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *repr_id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port); +/** * PMD helper function to parse ethdev arguments * lib/librte_ethdev/rte_class_eth.c +29
-9@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */ @@ -76,17 +77,36 @@ 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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports :1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_convert (edev, + &id, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f]) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */ lib/librte_ethdev/rte_ethdev.c +40
-0@@ -5623,6 +5623,97 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *repr_id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port) +{ +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ; +size_t size; + +if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (repr_id ==NULL ) +return -EINVAL ; + +/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) { +if (type ==RTE_ETH_REPRESENTOR_VF && controller ==-1 && + pf ==-1 ) { +/* Direct mapping for legacy VF representor. */ + *repr_id = representor_port; +return 0 ; + }else { +return ret; + } + } + n = ret; + size =sizeof (*info) + n *sizeof (info->ranges[0 ]); + info =calloc (1 , size); +if (info ==NULL ) +return -ENOMEM ; + ret =rte_eth_representor_info_get (ethdev->data->port_id, info); +if (ret <0 ) + goto out; + +/* Default controller and pf to caller. */ +if (controller ==-1 ) + controller = info->controller; +if (pf ==-1 )
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5675
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ pf = info->pf; + +/* Locate representor ID. */ + ret = -ENOENT ; +for (i =0 ; i < n; ++i) { +if (info->ranges[i].type != type) +continue ; +/* PMD hit: ignore controller if -1. */ +if (info->ranges[i].controller !=-1 && + info->ranges[i].controller != (uint16_t )controller)
First of all I don't understand why 'controller' is cast to uint16_t here. Both 'controller' and range->controller have 'int' type.
Second, I'm sorry, but I still don't understand the ignore logic. Why information retrieval may return -1 for controller and/or PF? What does it mean?
Above fallback to the device controller and pf if unspecified by the caller look good and make sense.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5681
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+continue ; + count = info->ranges[i].id_end - info->ranges[i].id_base +1 ; +switch (info->ranges[i].type) { +case RTE_ETH_REPRESENTOR_PF : +if (pf >= info->ranges[i].pf + count) +continue ;
Condition must be stricter. We must ensure that requested port within both boundaries of the range.
I.e. representor_port should not be smaller than info->ranges[i].pf.
It is required for below subtraction.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5689
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +8
-0+ *repr_id = info->ranges[i].id_base + + (pf - info->ranges[i].pf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_VF : +/* PMD hit: ignore pf if -1. */ +if (info->ranges[i].pf !=-1 && + info->ranges[i].pf != (uint16_t )pf)
Same as above. Cast seems to be not required.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5691
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+continue ; +if (representor_port >= info->ranges[i].vf + count)
Same as above.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5700
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +9
-0+continue ; + *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].vf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_SF : +/* PMD hit: ignore pf if -1. */ +if (info->ranges[i].pf !=-1 && + info->ranges[i].pf != (uint16_t )pf)
Same as above. Cast seems to be not required.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5703
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+continue ; +if (representor_port >= info->ranges[i].sf + count) +continue ;
Same as above.
Quoted 29 lines
lib/librte_ethdev/rte_ethdev.c +13
-0+ *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].sf); + ret =0 ; + goto out; +default : +break ; + } + } +out: +free (info); +return ret; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,lib/librte_ethdev/version.map +1
-0@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_convert; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
Re: [dpdk-dev] [PATCH v7 8/9] ethdev: representor iterator compare complete info
Quoted 51 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, March 2, 2021 10:10 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]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v7 8/9] ethdev: representor iterator compare complete infoQuoted 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to convert representor controller, pf and vf/sf index to representor ID. Representor comparer callback convert representor info into ID and compare with device representor ID.
Signed-off-by Xueming Li <[email protected]>--- lib/librte_ethdev/ethdev_driver.h | 32 +++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++--- lib/librte_ethdev/rte_ethdev.c | 91 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 153 insertions(+), 9 deletions(-)lib/librte_ethdev/ethdev_driver.h +0
-0lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1247
Quoted 4 lines
lib/librte_ethdev/ethdev_driver.h +2
-0@@ -1244,6 +1244,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* PMD helper function to convert representor ID from location detail Full stop is missing above.
Quoted 6 lines
Also I'm not sure in term "convert" here. It sounds a bit misleading to me. May be just "get". I.e PMD helper function to get representor ID by location detail.
andrte_eth_representor_id_get()What do you think?
Looks good, I was struggling on the naming, 'get' looks straightforward, no conversion but lookup, thanks!
Quoted 21 lines
Quoted 10 lines
lib/librte_ethdev/ethdev_driver.h +9
-0+* +* Convert representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* For backward compatibility, if no representor info, direct +* map legacy VF (no controller and pf). +* +* @param ethdev +* Handle of ethdev port. lib/librte_ethdev/ethdev_driver.h struct rte_eth_devargs { · line 1267
Quoted 10 lines
lib/librte_ethdev/ethdev_driver.h +10
-0+* @param repr_id +* Pointer to converted representor ID. +* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* VF or SF representor port number, -1 if unspecified.
Quoted 4 lines
Mixing input and output parameters looks bad to me.
May I suggest to putrepr_idthe last?
I.e. to have all input parameters first.
(May be I've already mentioned it, if I missed your reply, please, repeat it once again).
Make sense
Quoted 137 lines
Quoted 137 lines
lib/librte_ethdev/ethdev_driver.h +11
-0+* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *repr_id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port); +/** * PMD helper function to parse ethdev arguments * lib/librte_ethdev/rte_class_eth.c +4
-3@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 ) return -1; /* not a representor port */ @@ -76,17 +77,36 @@eth_representor_cmp(const char *key
__rte_unused,lib/librte_ethdev/rte_class_eth.c +26
-6values =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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports : +1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_convert (edev, + &id, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f]) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */ (quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindexc88e345e7d..78cdef11be100644lib/librte_ethdev/rte_ethdev.c +43
-0@@ -5623,6 +5623,97 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +int +rte_eth_representor_id_convert (const struct rte_eth_dev *ethdev, +uint16_t *repr_id, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port) { +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ; +size_t size; + +if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (repr_id ==NULL ) +return -EINVAL ; + +/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) { +if (type ==RTE_ETH_REPRESENTOR_VF && controller ==-1 && + pf ==-1 ) { +/* Direct mapping for legacy VF representor. */ + *repr_id = representor_port; +return 0 ; + }else { +return ret; + } + } + n = ret; + size =sizeof (*info) + n *sizeof (info->ranges[0 ]); + info =calloc (1 , size); +if (info ==NULL ) +return -ENOMEM ; + ret =rte_eth_representor_info_get (ethdev->data->port_id, info); +if (ret <0 ) + goto out; + +/* Default controller and pf to caller. */ +if (controller ==-1 ) + controller = info->controller; +if (pf ==-1 ) + pf = info->pf; + +/* Locate representor ID. */ + ret = -ENOENT ;
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5675
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+for (i =0 ; i < n; ++i) { +if (info->ranges[i].type != type) +continue ; +/* PMD hit: ignore controller if -1. */ +if (info->ranges[i].controller !=-1 && + info->ranges[i].controller != (uint16_t )controller)First of all I don't understand why 'controller' is cast to
uint16_there. Both 'controller' andrange->controllerhave 'int' type.
Yes, I should have removed the cast.
Quoted 2 lines
Second, I'm sorry, but I still don't understand the ignore logic. Why information retrieval may return -1 for controller and/or PF? What does it mean?
In some circumstances, PMD don't need the controller and PF, i.e. no bonding and multi-host, it locate device from PCI address. Since openstack can't tell different case, these info are sent without difference, that's why PMD want to ignore them.
But I have a workaround in PMD now, will remove it in next version. But keeping flexibility might be a good choice IMHO.
Quoted 14 lines
Above fallback to the device controller and pf if unspecified by the caller look good and make sense.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5681
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+continue ; + count = info->ranges[i].id_end - info->ranges[i].id_base +1 ; +switch (info->ranges[i].type) { +case RTE_ETH_REPRESENTOR_PF : +if (pf >= info->ranges[i].pf + count) +continue ;Condition must be stricter. We must ensure that requested port within both boundaries of the range. I.e.
representor_portshould not be smaller than
info->ranges[i].pf.
It is required for below subtraction.
Good catch!
Quoted 64 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5689
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +8
-0+ *repr_id = info->ranges[i].id_base + + (pf - info->ranges[i].pf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_VF : +/* PMD hit: ignore pf if -1. */ +if (info->ranges[i].pf !=-1 && + info->ranges[i].pf != (uint16_t )pf)Same as above. Cast seems to be not required.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5690
Quoted 2 lines
lib/librte_ethdev/rte_ethdev.c +2
-0+continue ; +if (representor_port >= info->ranges[i].vf + count)Same as above.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5700
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +9
-0+continue ; + *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].vf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_SF : +/* PMD hit: ignore pf if -1. */ +if (info->ranges[i].pf !=-1 && + info->ranges[i].pf != (uint16_t )pf)Same as above. Cast seems to be not required.
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5703
Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +3
-0+continue ; +if (representor_port >= info->ranges[i].sf + count) +continue ;Same as above.
Quoted 29 lines
lib/librte_ethdev/rte_ethdev.c +13
-0+ *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].sf); + ret =0 ; + goto out; +default : +break ; + } + } +out: +free (info); +return ret; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,(quoted diff) +0
-0b/lib/librte_ethdev/version.map index
bb6f7436c2..2891f5734e100644lib/librte_ethdev/version.map +1
-0@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_convert; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
PATCH v7 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
v8 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
V7:
- error on duplicated representor argument:
DBDF,representor=a,representor=b
- fix pf representor type parsing
- other small fixes suggested by Andrew.
V8:
- remove the "ignore" hint from pmd representor info
- changed representor_id type in representor info to u32
- rename rte_eth_representor_id_convert() to ..._get()
- other small fixes suggested by Andrew
[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
[6] V5:
http://patchwork.dpdk.org/project/dpdk/list/?series=14834
[7] V6:
http://patchwork.dpdk.org/project/dpdk/list/?series=15258
[8] v7:
http://patchwork.dpdk.org/project/dpdk/list/?series=15441
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 | 18 +- .../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 | 50 +++++- lib/librte_ethdev/ethdev_private.c | 169 ++++++++++++------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++-- lib/librte_ethdev/rte_ethdev.c | 113 +++++++++++- lib/librte_ethdev/rte_ethdev.h | 61 +++++++ lib/librte_ethdev/version.map | 4 + lib/librte_kvargs/rte_kvargs.c | 101 ++++++++--- 17 files changed, 554 insertions(+), 125 deletions(-)
Signature · 1 line
2.25.1
PATCH v8 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
@@ -5646,6 +5646,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
@@ -751,6 +751,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 v8 1/9] ethdev: introduce representor type
Quoted 12 lines · Xueming Li
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.
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Acked-by Ajit Khaparde <[email protected]>Acked-by Andrew Rybchenko <[email protected]>Acked-by Hyong Youb Kim <[email protected]>
Quoted 10 lines
--- 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(-)
Hi Xueming,
There are a few instance of 'rte_eth_devargs_parse()' usages in the drivers, they may be added after you started this work. Can you please rebase on latest head for it?
PATCH v8 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 v8 2/9] ethdev: support representor port list
Quoted 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
Isn't above syntax already supported, can you please document what is added?
From documentation, what already supported is:
-w pci:dbdf,representor=0
-w pci:dbdf,representor=[0-3]
-w pci:dbdf,representor=[0,5-11]
Quoted 4 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
<...>
Re: [dpdk-dev] [PATCH v8 2/9] ethdev: support representor port list
Quoted 21 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:38 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]
Subject: Re: [PATCH v8 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 rangesIsn't above syntax already supported, can you please document what is added?
From documentation, what already supported is:
Review
Quoted 3 lines
(quoted diff) +0
-3-w pci:dbdf,representor=0 -w pci:dbdf,representor=[0-3] -w pci:dbdf,representor=[0,5-11]
Just a refactor to prepare for the extended representor syntax which need to reuse the value parsing function for controller and pf section.
Quoted 9 lines
Quoted 5 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Acked-by Andrew Rybchenko <[email protected]><...>
Re: [dpdk-dev] [PATCH v8 2/9] ethdev: support representor port list
Quoted 19 lines · Xueming(Steven) Li
Quoted 19 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:38 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]
Subject: Re: [PATCH v8 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 rangesIsn't above syntax already supported, can you please document what is added?
Quoted 8 lines
Review
Quoted 5 lines
From documentation, what already supported is:
(quoted diff) +0
-3-w pci:dbdf,representor=0 -w pci:dbdf,representor=[0-3] -w pci:dbdf,representor=[0,5-11]Just a refactor to prepare for the extended representor syntax which need to reuse the value parsing function for controller and pf section.
OK, can you please highlight this is a refactoring, from patch title and commit log it feels like new syntax support is added.
Quoted 10 lines
Quoted 9 lines
Quoted 5 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Acked-by Andrew Rybchenko <[email protected]><...>
Re: [dpdk-dev] [PATCH v8 2/9] ethdev: support representor port list
Quoted 38 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, March 9, 2021 12:22 AM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]
Subject: Re: [PATCH v8 2/9] ethdev: support representor port listQuoted 21 lines · Xueming(Steven) Li
Quoted 21 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:38 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; [email protected]
Subject: Re: [PATCH v8 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 rangesIsn't above syntax already supported, can you please document what is added?
Quoted 7 lines
Review
Quoted 5 lines
From documentation, what already supported is:
(quoted diff) +0
-3-w pci:dbdf,representor=0 -w pci:dbdf,representor=[0-3] -w pci:dbdf,representor=[0,5-11]Just a refactor to prepare for the extended representor syntax which need to reuse the value parsing function for controller and pf
Quoted 4 lines
section.
Quoted 1 line
OK, can you please highlight this is a refactoring, from patch title and commit log it feels like new syntax support is added.
Sure.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 6 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Acked-by Andrew Rybchenko <[email protected]><...>
PATCH v8 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 v8 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 | 6 +++- .../prog_guide/switch_representation.rst | 35 +++++++++++++------ lib/librte_ethdev/ethdev_private.c | 11 ++++-- lib/librte_ethdev/rte_ethdev.c | 6 ++++ lib/librte_ethdev/rte_ethdev.h | 1 + 5 files changed, 46 insertions(+), 13 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +5 -1
@@ -372,12 +372,16 @@ parameters to those ports. * ``representor`` for a device which supports the creation of representor ports this argument allows user to specify which switch ports to enable port - representors for.:: + representors for. Multiple representors in one device argument is invalid:: -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] + -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.c +6 -0
@@ -5589,6 +5589,12 @@ 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 ) { +if (eth_da->type !=RTE_ETH_REPRESENTOR_NONE ) { +RTE_LOG (ERR ,EAL ,"duplicated representor key: %s\n" , + dargs); + result =-1 ; + goto parse_cleanup; + } result =rte_eth_devargs_parse_representor_ports ( pair->value, eth_da);if (result <0 )
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
PATCH v8 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
PF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representor
--- doc/guides/prog_guide/poll_mode_drv.rst | 3 +++ lib/librte_ethdev/ethdev_private.c | 19 +++++++++++++++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +3 -0
@@ -382,6 +382,9 @@ 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] + -a DBDF,representor=pf1 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 +17 -2
@@ -118,8 +118,9 @@ 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 +* pf#: PF port representor/s * * Examples of #: * 2 - single
@@ -131,6 +132,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_DIM (eth_da->ports)); +if (str ==NULL || str[0 ] =='\0' ) + goto done; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;
@@ -138,11 +147,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else { +/* 'pf' must followed by 'vf' or 'sf'. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { + str =NULL ; + goto done; + } 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)); +done:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1513,6 +1513,7 @@ 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 Physical Function. */ };/**
Signature · 1 line
2.25.1
PATCH v8 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_driver.h | 4 ++++ lib/librte_ethdev/ethdev_private.c | 18 +++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-)
config/rte_config.h +1 -0
@@ -57,6 +57,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_driver.h +4 -0
@@ -1222,6 +1222,10 @@ rte_eth_switch_domain_free(uint16_t domain_id);* One type of representor each structure. */ 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;
lib/librte_ethdev/ethdev_private.c +15 -3
@@ -118,9 +118,9 @@ 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 -* pf#: PF port representor/s +* [[c#]pf#]vf#: VF port representor/s +* [[c#]pf#]sf#: SF port representor/s +* [c#]pf#: PF port representor/s * * Examples of #: * 2 - single
@@ -132,6 +132,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 done; + }if (str[0 ] =='p' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_PF ; str +=2 ;
@@ -139,6 +147,10 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) ð_da->nb_ports, RTE_DIM(eth_da->ports));if (str ==NULL || str[0 ] =='\0' ) goto done; + }else if (eth_da->nb_mh_controllers >0 ) { +/* 'c' must followed by 'pf'. */ + str =NULL ; + goto done; }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ;
Signature · 1 line
2.25.1
PATCH v8 7/9 ethdev: new API to get representor info
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).
This patch introduces a new API rte_eth_representor_info_get() to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.
New ethdev callback representor_info_get() is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.
--- lib/librte_ethdev/ethdev_driver.h | 7 +++++ lib/librte_ethdev/rte_ethdev.c | 14 +++++++++ lib/librte_ethdev/rte_ethdev.h | 51 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 3 ++ 4 files changed, 75 insertions(+)
lib/librte_ethdev/ethdev_driver.h +7 -0
@@ -783,6 +783,10 @@ typedef int (*eth_hairpin_queue_peer_unbind_t)typedef int (*eth_get_monitor_addr_t )(void *rxq,struct rte_power_monitor_cond *pmc); +typedef int (*eth_representor_info_get_t )(struct rte_eth_dev *dev, +struct rte_eth_representor_info *info); +/**< @internal Get representor type and ID range. */ +/** * @internal A structure containing the functions exported by an Ethernet driver. */
@@ -940,6 +944,9 @@ struct eth_dev_ops {eth_get_monitor_addr_t get_monitor_addr;/**< Get power monitoring condition for Rx queue. */ + +eth_representor_info_get_t representor_info_get; +/**< Get representor info. */ };/**
lib/librte_ethdev/rte_ethdev.c +14 -0
@@ -5816,6 +5816,20 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue, direction); } +int +rte_eth_representor_info_get (uint16_t port_id, +struct rte_eth_representor_info *info) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->representor_info_get, -ENOTSUP ); +return eth_err (port_id, (*dev->dev_ops->representor_info_get)(dev, + info)); +} +RTE_LOG_REGISTER (rte_eth_dev_logtype, lib.ethdev,INFO );RTE_INIT (ethdev_init_telemetry)
lib/librte_ethdev/rte_ethdev.h +51 -0
57 lines not on this page · raw message
lib/librte_ethdev/version.map +3 -0
@@ -243,6 +243,9 @@ EXPERIMENTAL { # added in 21.02 rte_eth_get_monitor_addr; + + # added in 21.05 + rte_eth_representor_info_get; }; INTERNAL {
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v8 7/9] ethdev: new API to get representor info
Quoted 13 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.
Quoted 6 lines
New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.Signed-off-by Xueming Li <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
This is middle layer implementation, and there is not problem with it but without PMD and application implementations it is harder to get why/how this API will be used.
As far as I can see this API is not directly needed for this set, what do you think making this another set with PMD and application implementations on top of current set?
Re: [dpdk-dev] [PATCH v8 7/9] ethdev: new API to get representor info
Quoted 27 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:44 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v8 7/9] ethdev: new API to get representor infoQuoted 17 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.
Quoted 8 lines
Quoted 2 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Andrew Rybchenko <[email protected]>This is middle layer implementation, and there is not problem with it but without PMD and application implementations it is harder to get why/how this API will be used.
As far as I can see this API is not directly needed for this set, what do you think making this another set with PMD and application implementations on top of current set?
Hi Ferruh,
Thanks for checking this! The patch next, 8/9 which update device iterator for SF representor needs this API to get representor ID then compare.
Re: [dpdk-dev] [PATCH v8 7/9] ethdev: new API to get representor info
Quoted 33 lines · Xueming(Steven) Li
Quoted 33 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:44 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v8 7/9] ethdev: new API to get representor infoQuoted 13 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.Quoted 6 lines
New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.Signed-off-by Xueming Li <[email protected]>Acked-by Andrew Rybchenko <[email protected]>This is middle layer implementation, and there is not problem with it but without PMD and application implementations it is harder to get why/how this API will be used.
Quoted 7 lines
Quoted 2 lines
As far as I can see this API is not directly needed for this set, what do you think making this another set with PMD and application implementations on top of current set?
Hi Ferruh,
Thanks for checking this! The patch next, 8/9 which update device iterator for SF representor needs this API to get representor ID then compare.
Got it thanks.
Intention of the new API seems to get info to be able to calculate the unique "representor ID" and the helper function 'rte_eth_representor_id_get()' implements a logic to calculate this unique ID but that logic is not clear, can you please document it more to help the PMD developers to implement 'representor_info_get()'?
Re: [dpdk-dev] [PATCH v8 7/9] ethdev: new API to get representor info
Quoted 53 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, March 9, 2021 12:12 AM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v8 7/9] ethdev: new API to get representor infoQuoted 36 lines · Xueming(Steven) Li
Quoted 36 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:44 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v8 7/9] ethdev: new API to get representor infoQuoted 13 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to convert representor from devargs to representor ID.Quoted 6 lines
New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.Signed-off-by Xueming Li <[email protected]>Acked-by Andrew Rybchenko <[email protected]>This is middle layer implementation, and there is not problem with it
but without PMD and application implementations it is harder to get why/how this API will be used.Quoted 6 lines
Quoted 2 lines
As far as I can see this API is not directly needed for this set,
what do you think making this another set with PMD and application implementations on top of current set?Hi Ferruh,
Thanks for checking this! The patch next, 8/9 which update device iterator for SF representor needs this API to get representor ID
Quoted 8 lines
then compare.
Quoted 1 line
Got it thanks.
Intention of the new API seems to get info to be able to calculate the unique "representor ID" and the helper function 'rte_eth_representor_id_get()'
implements a logic to calculate this unique ID but that logic is not clear, can you please document it more to help the PMD developers to implement 'representor_info_get()'?
Sure, will update.
PATCH v8 8/9 ethdev: representor iterator compare complete info
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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to get representor ID from controller, pf and vf/sf index. Representor comparer callback get representor ID then compare with device representor ID.
--- lib/librte_ethdev/ethdev_driver.h | 32 +++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 +++++++++---- lib/librte_ethdev/rte_ethdev.c | 88 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 150 insertions(+), 9 deletions(-)
lib/librte_ethdev/ethdev_driver.h +32 -0
@@ -1244,6 +1244,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* PMD helper function to get representor ID from location detail. +* +* Get representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* For backward compatibility, if no representor info, direct +* map legacy VF (no controller and pf). +* +* @param ethdev +* Handle of ethdev port. +* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* VF or SF representor port number, -1 if unspecified. +* @param repr_id +* Pointer to output representor ID. +* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_get (const struct rte_eth_dev *ethdev, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port, +uint16_t *repr_id); +/** * PMD helper function to parse ethdev arguments *
lib/librte_ethdev/rte_class_eth.c +29 -9
@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +77,36 @@ 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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports :1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_get (edev, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f], + &id) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }
@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */
lib/librte_ethdev/rte_ethdev.c +88 -0
94 lines not on this page · raw message
lib/librte_ethdev/version.map +1 -0
@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_get; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v8 8/9] ethdev: representor iterator compare complete info
Quoted 19 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to get representor ID from controller, pf and vf/sf index. Representor comparer callback get representor ID then compare with device representor ID.
Signed-off-by Xueming Li <[email protected]>
<...>
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c +8
-0+int +rte_eth_representor_id_get (const struct rte_eth_dev *ethdev, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port, +uint16_t *repr_id) +{ +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ;
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5629
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+size_t size; + +if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (repr_id ==NULL ) +return -EINVAL ; + +/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) {
This seems to support the legacy format, should the return value checked explicitly against the '-ENOTSUP', instead of any error?
Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +9
-0+if (type ==RTE_ETH_REPRESENTOR_VF && controller ==-1 && + pf ==-1 ) { +/* Direct mapping for legacy VF representor. */ + *repr_id = representor_port; +return 0 ; + }else { +return ret; + } + }
<...>
Re: [dpdk-dev] [PATCH v8 8/9] ethdev: representor iterator compare complete info
Quoted 45 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, March 9, 2021 12:19 AM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v8 8/9] ethdev: representor iterator compare complete infoQuoted 19 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to get representor ID from controller, pf and vf/sf index. Representor comparer callback get representor ID then compare with device representor ID.
Signed-off-by Xueming Li <[email protected]><...>
Quoted 12 lines
lib/librte_ethdev/rte_ethdev.c +12
-0+int +rte_eth_representor_id_get (const struct rte_eth_dev *ethdev, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port, +uint16_t *repr_id) +{ +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ; +size_t size; + +if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ;
Quoted 8 lines
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5629
Quoted 6 lines
lib/librte_ethdev/rte_ethdev.c +6
-0+if (repr_id ==NULL ) +return -EINVAL ; + +/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) {This seems to support the legacy format, should the return value checked explicitly against the '
-ENOTSUP', instead of any error?
Good suggestion, thanks
Quoted 13 lines
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +9
-0+if (type ==RTE_ETH_REPRESENTOR_VF && controller ==-1 && + pf ==-1 ) { +/* Direct mapping for legacy VF representor. */ + *repr_id = representor_port; +return 0 ; + }else { +return ret; + } + }<...>
Re: [dpdk-dev] [PATCH v8 8/9] ethdev: representor iterator compare complete info
In reply to Xueming LiQuoted 14 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
Quoted 5 lines
This patch adds new API to get representor ID from controller, pf and vf/sf index. Representor comparer callback get representor ID then compare with device representor ID.
Signed-off-by Xueming Li <[email protected]>
One minor suggestions below to make it a bit more robust against errors in PMDs.
Make thanks for careful review notes processing.
[snip]
Quoted 48 lines
lib/librte_ethdev/rte_ethdev.c +40
-0@@ -5609,6 +5609,94 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +int +rte_eth_representor_id_get (const struct rte_eth_dev *ethdev, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port, +uint16_t *repr_id) +{ +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ; +size_t size; + +if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (repr_id ==NULL ) +return -EINVAL ; + +/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) { +if (type ==RTE_ETH_REPRESENTOR_VF && controller ==-1 && + pf ==-1 ) { +/* Direct mapping for legacy VF representor. */ + *repr_id = representor_port; +return 0 ; + }else { +return ret; + } + } + n = ret; + size =sizeof (*info) + n *sizeof (info->ranges[0 ]); + info =calloc (1 , size); +if (info ==NULL ) +return -ENOMEM ; + ret =rte_eth_representor_info_get (ethdev->data->port_id, info); +if (ret <0 ) + goto out; + +/* Default controller and pf to caller. */ +if (controller ==-1 ) + controller = info->controller; +if (pf ==-1 )
lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5661
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ pf = info->pf; + +/* Locate representor ID. */ + ret = -ENOENT ; +for (i =0 ; i < n; ++i) { +if (info->ranges[i].type != type) +continue ; +if (info->ranges[i].controller != controller) +continue ; + count = info->ranges[i].id_end - info->ranges[i].id_base +1 ;
I think it would be useful to sanity test these values to ensure that we have no overflow here.
Let's check above, log error and skip the range if id_end is smaller than id_base.
Quoted 41 lines
lib/librte_ethdev/rte_ethdev.c +38
-0+switch (info->ranges[i].type) { +case RTE_ETH_REPRESENTOR_PF : +if (pf < info->ranges[i].pf || + pf >= info->ranges[i].pf + count) +continue ; + *repr_id = info->ranges[i].id_base + + (pf - info->ranges[i].pf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_VF : +if (info->ranges[i].pf != pf) +continue ; +if (representor_port < info->ranges[i].vf || + representor_port >= info->ranges[i].vf + count) +continue ; + *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].vf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_SF : +if (info->ranges[i].pf != pf) +continue ; +if (representor_port < info->ranges[i].sf || + representor_port >= info->ranges[i].sf + count) +continue ; + *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].sf); + ret =0 ; + goto out; +default : +break ; + } + } +out: +free (info); +return ret; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,
[snip]
Re: [dpdk-dev] [PATCH v8 8/9] ethdev: representor iterator compare complete info
Quoted 30 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Tuesday, March 9, 2021 4:20 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]>; Ray Kinsella <[email protected]>; Neil Horman <[email protected]>
Subject: Re: [PATCH v8 8/9] ethdev: representor iterator compare complete infoQuoted 18 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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to get representor ID from controller, pf and vf/sf index. Representor comparer callback get representor ID then compare with device representor ID.
Quoted 7 lines
Quoted 1 line
Signed-off-by Xueming Li <[email protected]>Reviewed-by Andrew Rybchenko <[email protected]>One minor suggestions below to make it a bit more robust against errors in PMDs.
Make thanks for careful review notes processing.
Many thanks to your generous and careful review all the time, with patience :) This is my first long public api patchset, can't do it without your help :)
Quoted 108 lines
[snip]
Quoted 48 lines
(quoted diff) +0
-0
b/lib/librte_ethdev/rte_ethdev.cindex3d4ec8ad5c..2dc464a7ad100644lib/librte_ethdev/rte_ethdev.c +40
-0@@ -5609,6 +5609,94 @@ rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da)return result; } +int +rte_eth_representor_id_get (const struct rte_eth_dev *ethdev, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port, +uint16_t *repr_id) +{ +int ret, n, i, count; +struct rte_eth_representor_info *info =NULL ; +size_t size; + +if (type ==RTE_ETH_REPRESENTOR_NONE ) +return 0 ; +if (repr_id ==NULL ) +return -EINVAL ; + +/* Get PMD representor range info. */ + ret =rte_eth_representor_info_get (ethdev->data->port_id,NULL ); +if (ret <0 ) { +if (type ==RTE_ETH_REPRESENTOR_VF && controller ==-1 && + pf ==-1 ) { +/* Direct mapping for legacy VF representor. */ + *repr_id = representor_port; +return 0 ; + }else { +return ret; + } + } + n = ret; + size =sizeof (*info) + n *sizeof (info->ranges[0 ]); + info =calloc (1 , size); +if (info ==NULL ) +return -ENOMEM ; + ret =rte_eth_representor_info_get (ethdev->data->port_id, info); +if (ret <0 ) + goto out; + +/* Default controller and pf to caller. */ +if (controller ==-1 ) + controller = info->controller; +if (pf ==-1 )lib/librte_ethdev/rte_ethdev.c rte_eth_devargs_parse(const char *dargs, struct rte_eth_devargs *eth_da) · line 5661
Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +10
-0+ pf = info->pf; + +/* Locate representor ID. */ + ret = -ENOENT ; +for (i =0 ; i < n; ++i) { +if (info->ranges[i].type != type) +continue ; +if (info->ranges[i].controller != controller) +continue ; + count = info->ranges[i].id_end - info->ranges[i].id_base +1 ;I think it would be useful to sanity test these values to ensure that we have no overflow here. Let's check above, log error and skip the range if
id_endis smaller thanid_base.Quoted 41 lines
lib/librte_ethdev/rte_ethdev.c +38
-0+switch (info->ranges[i].type) { +case RTE_ETH_REPRESENTOR_PF : +if (pf < info->ranges[i].pf || + pf >= info->ranges[i].pf + count) +continue ; + *repr_id = info->ranges[i].id_base + + (pf - info->ranges[i].pf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_VF : +if (info->ranges[i].pf != pf) +continue ; +if (representor_port < info->ranges[i].vf || + representor_port >= info->ranges[i].vf + count) +continue ; + *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].vf); + ret =0 ; + goto out; +case RTE_ETH_REPRESENTOR_SF : +if (info->ranges[i].pf != pf) +continue ; +if (representor_port < info->ranges[i].sf || + representor_port >= info->ranges[i].sf + count) +continue ; + *repr_id = info->ranges[i].id_base + + (representor_port - info->ranges[i].sf); + ret =0 ; + goto out; +default : +break ; + } + } +out: +free (info); +return ret; +} + static int eth_dev_handle_port_list(const char *cmd __rte_unused, const char *params __rte_unused,[snip]
PATCH v8 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 v8 9/9] kvargs: update parser to support lists
Quoted 7 lines · Xueming Li
This patch updates kvargs parser to support lists on top of range, allow multiple lists or range:
k1=a[1,2]b[3-5]Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
Is this update used at all in this set?
Re: [dpdk-dev] [PATCH v8 9/9] kvargs: update parser to support lists
Quoted 15 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:45 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Olivier Matz <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v8 9/9] kvargs: update parser to support listsQuoted 4 lines · Xueming Li
This patch updates kvargs parser to support lists on top of range, allow multiple lists or range:
k1=a[1,2]b[3-5]
Quoted 5 lines
Quoted 3 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Is this update used at all in this set?
Yes, for example to support 'pf[0,1]sf[1,3,5]', this patch is a must.
Re: [dpdk-dev] [PATCH v8 9/9] kvargs: update parser to support lists
Quoted 15 lines · Xueming(Steven) Li
Quoted 15 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:45 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Olivier Matz <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v8 9/9] kvargs: update parser to support listsQuoted 4 lines · Xueming Li
This patch updates kvargs parser to support lists on top of range, allow multiple lists or range:
k1=a[1,2]b[3-5]
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>Is this update used at all in this set?
Yes, for example to support 'pf[0,1]sf[1,3,5]', this patch is a must.
So should this patch be before where 'pf[0,1]sf[1,3,5]' syntax is required/used in this set?
Re: [dpdk-dev] [PATCH v8 9/9] kvargs: update parser to support lists
Quoted 31 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 11:55 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Olivier Matz <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v8 9/9] kvargs: update parser to support listsQuoted 21 lines · Xueming(Steven) Li
Quoted 21 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Monday, March 8, 2021 10:45 PM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>; Olivier Matz <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v8 9/9] kvargs: update parser to support listsQuoted 7 lines · Xueming Li
This patch updates kvargs parser to support lists on top of range, allow multiple lists or range:
k1=a[1,2]b[3-5]Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Is this update used at all in this set?
Yes, for example to support 'pf[0,1]sf[1,3,5]', this patch is a must.
So should this patch be before where 'pf[0,1]sf[1,3,5]' syntax is required/used in this set?
Good suggestion, I'll update in next version, thanks!
Re: [dpdk-dev] [PATCH v8 0/9] ethdev: support SubFunction representor
In reply to Xueming LiQuoted 123 lines · Xueming Li
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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
V7:
- error on duplicated representor argument:
DBDF,representor=a,representor=b
- fix pf representor type parsing
- other small fixes suggested by Andrew.
V8:
- remove the "ignore" hint from pmd representor info
- changedrepresentor_idtype in representor info to u32
- renamerte_eth_representor_id_convert()to ..._get()
- other small fixes suggested by Andrew[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[6] V5:
http://patchwork.dpdk.org/project/dpdk/list/?series=14834[7] V6:
http://patchwork.dpdk.org/project/dpdk/list/?series=15258[8] v7:
http://patchwork.dpdk.org/project/dpdk/list/?series=15441Xueming 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 listsapp/test/test_kvargs.c | 46 ++++- config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 18 +- .../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 | 50 +++++-
Quoted 9 lines
lib/librte_ethdev/ethdev_private.c | 169 ++++++++++++------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++-- lib/librte_ethdev/rte_ethdev.c | 113 +++++++++++- lib/librte_ethdev/rte_ethdev.h | 61 +++++++ lib/librte_ethdev/version.map | 4 + lib/librte_kvargs/rte_kvargs.c | 101 ++++++++--- 17 files changed, 554 insertions(+), 125 deletions(-)
Btw, can you also update the release notes for the feature, if there will be more versions it is OK to hold the update to prevent the release notes rebases on each version, but please include it as the patchset matures.
Re: [dpdk-dev] [PATCH v8 0/9] ethdev: support SubFunction representor
Quoted 142 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, March 9, 2021 12:44 AM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v8 0/9] ethdev: support SubFunction representorQuoted 123 lines · Xueming Li
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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
V7:
- error on duplicated representor argument:
DBDF,representor=a,representor=b
- fix pf representor type parsing
- other small fixes suggested by Andrew.
V8:
- remove the "ignore" hint from pmd representor info
- changedrepresentor_idtype in representor info to u32
- renamerte_eth_representor_id_convert()to ..._get()
- other small fixes suggested by Andrew[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[6] V5:
http://patchwork.dpdk.org/project/dpdk/list/?series=14834[7] V6:
http://patchwork.dpdk.org/project/dpdk/list/?series=15258[8] v7:
http://patchwork.dpdk.org/project/dpdk/list/?series=15441Xueming 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 listsapp/test/test_kvargs.c | 46 ++++- config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 18 +- .../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 | 50 +++++-Quoted 9 lines
lib/librte_ethdev/ethdev_private.c | 169 ++++++++++++------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++-- lib/librte_ethdev/rte_ethdev.c | 113 +++++++++++- lib/librte_ethdev/rte_ethdev.h | 61 +++++++ lib/librte_ethdev/version.map | 4 + lib/librte_kvargs/rte_kvargs.c | 101 ++++++++--- 17 files changed, 554 insertions(+), 125 deletions(-)
Quoted 2 lines
Btw, can you also update the release notes for the feature, if there will be more versions it is OK to hold the update to prevent the release notes rebases on each version, but please include it as the patchset matures.
Got it, thanks!
v9 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
V7:
- error on duplicated representor argument:
DBDF,representor=a,representor=b
- fix pf representor type parsing
- other small fixes suggested by Andrew.
V8:
- remove the "ignore" hint from pmd representor info
- changed representor_id type in representor info to u32
- rename rte_eth_representor_id_convert() to ..._get()
- other small fixes suggested by Andrew
V9:
- more document for PMD to implement representor_info_get callback
- updated ice and txgbe to adapt new representor type
- updated 21.05 release notes
- other small fixes suggested by Ferruh and Andrew, thanks.
Xueming Li (10):
ethdev: introduce representor type
ethdev: refactor representor port list parsing
ethdev: support new VF representor syntax
ethdev: support sub function representor
kvargs: update parser to support multiple lists
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 doc/release: add representor enhancements
app/test/test_kvargs.c | 46 ++++- config/rte_config.h | 1 + doc/guides/prog_guide/poll_mode_drv.rst | 18 +- .../prog_guide/switch_representation.rst | 35 ++-- doc/guides/rel_notes/release_21_05.rst | 18 ++ drivers/net/bnxt/bnxt_ethdev.c | 7 + drivers/net/enic/enic_ethdev.c | 6 + drivers/net/i40e/i40e_ethdev.c | 7 + drivers/net/ice/ice_dcf_ethdev.c | 2 + drivers/net/ixgbe/ixgbe_ethdev.c | 7 + drivers/net/mlx5/linux/mlx5_os.c | 11 ++ drivers/net/txgbe/txgbe_ethdev.c | 2 + lib/librte_ethdev/ethdev_driver.h | 70 +++++++- lib/librte_ethdev/ethdev_private.c | 169 ++++++++++++------ lib/librte_ethdev/ethdev_private.h | 3 - lib/librte_ethdev/rte_class_eth.c | 40 +++-- lib/librte_ethdev/rte_ethdev.c | 118 +++++++++++- lib/librte_ethdev/rte_ethdev.h | 64 +++++++ lib/librte_ethdev/version.map | 4 + lib/librte_kvargs/rte_kvargs.c | 101 ++++++++--- 20 files changed, 604 insertions(+), 125 deletions(-)
Signature · 1 line
2.25.1
PATCH v9 1/10 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/ice/ice_dcf_ethdev.c | 2 ++ drivers/net/ixgbe/ixgbe_ethdev.c | 7 +++++++ drivers/net/mlx5/linux/mlx5_os.c | 11 +++++++++++ drivers/net/txgbe/txgbe_ethdev.c | 2 ++ lib/librte_ethdev/ethdev_driver.h | 7 ++++++- lib/librte_ethdev/ethdev_private.c | 5 +++++ lib/librte_ethdev/rte_ethdev.h | 8 ++++++++ 10 files changed, 61 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_ethdev.c +7 -0
@@ -5646,6 +5646,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/ice/ice_dcf_ethdev.c +2 -0
@@ -1089,6 +1089,8 @@ eth_ice_dcf_pci_probe(__rte_unused struct rte_pci_driver *pci_drv, ice_dcf_dev_init);if (ret || !eth_da.nb_representor_ports)return ret; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) +return -ENOTSUP ; dcf_ethdev =rte_eth_dev_allocated (pci_dev->device.name);if (dcf_ethdev ==NULL )
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
@@ -751,6 +751,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)
drivers/net/txgbe/txgbe_ethdev.c +2 -0
@@ -882,6 +882,8 @@ eth_txgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,if (retval || eth_da.nb_representor_ports <1 )return retval; +if (eth_da.type !=RTE_ETH_REPRESENTOR_VF ) +return -ENOTSUP ; pf_ethdev =rte_eth_dev_allocated (pci_dev->device.name);if (pf_ethdev ==NULL )
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
PATCH v9 2/10 ethdev: refactor representor port list parsing
In reply to Xueming LiTo the extended representor syntax which need to reuse the value parsing function for controller and pf section, this patch refactors the port list parsing.
--- 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
PATCH v9 3/10 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 v9 4/10 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 | 6 +++- .../prog_guide/switch_representation.rst | 35 +++++++++++++------ lib/librte_ethdev/ethdev_private.c | 11 ++++-- lib/librte_ethdev/rte_ethdev.c | 6 ++++ lib/librte_ethdev/rte_ethdev.h | 1 + 5 files changed, 46 insertions(+), 13 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +5 -1
@@ -372,12 +372,16 @@ parameters to those ports. * ``representor`` for a device which supports the creation of representor ports this argument allows user to specify which switch ports to enable port - representors for.:: + representors for. Multiple representors in one device argument is invalid:: -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] + -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.c +6 -0
@@ -5589,6 +5589,12 @@ 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 ) { +if (eth_da->type !=RTE_ETH_REPRESENTOR_NONE ) { +RTE_LOG (ERR ,EAL ,"duplicated representor key: %s\n" , + dargs); + result =-1 ; + goto parse_cleanup; + } result =rte_eth_devargs_parse_representor_ports ( pair->value, eth_da);if (result <0 )
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
PATCH v9 5/10 kvargs: update parser to support multiple lists
In reply to Xueming LiThis patch updates kvargs parser to support value of multiple lists or ranges:
k1=v[1,2]v[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 v9 05/10] kvargs: update parser to support multiple lists
Quoted 4 lines · Xueming Li
This patch updates kvargs parser to support value of multiple lists or ranges:
k1=v[1,2]v[3-5]
Quoted 8 lines
Signed-off-by Xueming Li <[email protected]>Acked-by Thomas Monjalon <[email protected]>--- app/test/test_kvargs.c | 46 +++++++++++++-- lib/librte_kvargs/rte_kvargs.c | 101 +++++++++++++++++++++++---------- 2 files changed, 112 insertions(+), 35 deletions(-)
Hi folks,
This is essentially an FYI.
This change introduced a weak functional ABI regression into DPDK.
When I test librte_kvargs using the v20.11 unit test binary I get the following.
EAL: Detected 80 lcore(s)
EAL: Detected 2 NUMA nodes
EAL: Detected shared linkage of DPDK
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: 4090 hugepages of size 2097152 reserved, but no mounted hugetlbfs found for that size
APP: HPET is not enabled, using TSC as default timer
RTE>>kvargs_autotest
== test valid case ==
== test invalid case ==rte_kvargs_parse() returned 0 (but should not)
while processing <foo=1,foo=> using valid_keys=<foo,check>
Test Failed
RTE>>
The reason this is failing in v20.11 and passing at the HEAD,
is that "no value" test case (foo=1,foo=) were removed from test_invalid_kvargs, and was added to test_valid_kvargs.
So tokens that were definitely invalid in v20.11, are now is valid in v21.11. My 2c is that as long as the valid values in v20.11 are still OK, there is no regression.
Thanks,
Ray K
PATCH v9 6/10 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
PF type representor is supported by using standalone 'pf' section:
representor=pf1 - PF representor
--- doc/guides/prog_guide/poll_mode_drv.rst | 3 +++ lib/librte_ethdev/ethdev_private.c | 19 +++++++++++++++++-- lib/librte_ethdev/rte_ethdev.h | 1 + 3 files changed, 21 insertions(+), 2 deletions(-)
doc/guides/prog_guide/poll_mode_drv.rst +3 -0
@@ -382,6 +382,9 @@ 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] + -a DBDF,representor=pf1 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 +17 -2
@@ -118,8 +118,9 @@ 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 +* pf#: PF port representor/s * * Examples of #: * 2 - single
@@ -131,6 +132,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_DIM (eth_da->ports)); +if (str ==NULL || str[0 ] =='\0' ) + goto done; + }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ; str +=2 ;
@@ -138,11 +147,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type =RTE_ETH_REPRESENTOR_SF ; str +=2 ; }else { +/* 'pf' must followed by 'vf' or 'sf'. */ +if (eth_da->type ==RTE_ETH_REPRESENTOR_PF ) { + str =NULL ; + goto done; + } 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)); +done:if (str ==NULL )RTE_LOG (ERR ,EAL ,"wrong representor format: %s\n" , str);return str ==NULL ?-1 :0 ;
lib/librte_ethdev/rte_ethdev.h +1 -0
@@ -1513,6 +1513,7 @@ 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 Physical Function. */ };/**
Signature · 1 line
2.25.1
PATCH v9 7/10 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_driver.h | 4 ++++ lib/librte_ethdev/ethdev_private.c | 18 +++++++++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-)
config/rte_config.h +1 -0
@@ -57,6 +57,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_driver.h +4 -0
@@ -1222,6 +1222,10 @@ rte_eth_switch_domain_free(uint16_t domain_id);* One type of representor each structure. */ 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;
lib/librte_ethdev/ethdev_private.c +15 -3
@@ -118,9 +118,9 @@ 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 -* pf#: PF port representor/s +* [[c#]pf#]vf#: VF port representor/s +* [[c#]pf#]sf#: SF port representor/s +* [c#]pf#: PF port representor/s * * Examples of #: * 2 - single
@@ -132,6 +132,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 done; + }if (str[0 ] =='p' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_PF ; str +=2 ;
@@ -139,6 +147,10 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) ð_da->nb_ports, RTE_DIM(eth_da->ports));if (str ==NULL || str[0 ] =='\0' ) goto done; + }else if (eth_da->nb_mh_controllers >0 ) { +/* 'c' must followed by 'pf'. */ + str =NULL ; + goto done; }if (str[0 ] =='v' && str[1 ] =='f' ) { eth_da->type =RTE_ETH_REPRESENTOR_VF ;
Signature · 1 line
2.25.1
PATCH v9 8/10 ethdev: new API to get representor info
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).
This patch introduces a new API rte_eth_representor_info_get() to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to calculate representor from devargs to representor ID.
New ethdev callback representor_info_get() is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.
--- lib/librte_ethdev/ethdev_driver.h | 27 ++++++++++++++++ lib/librte_ethdev/rte_ethdev.c | 14 ++++++++ lib/librte_ethdev/rte_ethdev.h | 54 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 3 ++ 4 files changed, 98 insertions(+)
lib/librte_ethdev/ethdev_driver.h +27 -0
@@ -783,6 +783,30 @@ typedef int (*eth_hairpin_queue_peer_unbind_t)typedef int (*eth_get_monitor_addr_t )(void *rxq,struct rte_power_monitor_cond *pmc); +/** +* @internal +* Get representor info to be able to calculate the unique representor ID. +* +* Caller should pass NULL as pointer of info to get number of entries, +* allocate info buffer according to returned entry number, then call +* again with buffer to get real info. +* +* To calculate the representor ID, caller should iterate each entry, +* match controller index, pf index, vf or sf start index and range, +* then calculate representor ID from offset to vf/sf start index. +* @see rte_eth_representor_id_get. +* +* @param dev +* Ethdev handle of port. +* @param [out] info +* Pointer to memory to save device representor info. +* @return +* Negative errno value on error, number of info entries otherwise. +*/ + +typedef int (*eth_representor_info_get_t )(struct rte_eth_dev *dev, +struct rte_eth_representor_info *info); +/** * @internal A structure containing the functions exported by an Ethernet driver. */
@@ -940,6 +964,9 @@ struct eth_dev_ops {eth_get_monitor_addr_t get_monitor_addr;/**< Get power monitoring condition for Rx queue. */ + +eth_representor_info_get_t representor_info_get; +/**< Get representor info. */ };/**
lib/librte_ethdev/rte_ethdev.c +14 -0
@@ -5816,6 +5816,20 @@ rte_eth_hairpin_queue_peer_unbind(uint16_t cur_port, uint16_t cur_queue, direction); } +int +rte_eth_representor_info_get (uint16_t port_id, +struct rte_eth_representor_info *info) +{ +struct rte_eth_dev *dev; + +RTE_ETH_VALID_PORTID_OR_ERR_RET (port_id, -ENODEV ); + dev = &rte_eth_devices[port_id]; + +RTE_FUNC_PTR_OR_ERR_RET (*dev->dev_ops->representor_info_get, -ENOTSUP ); +return eth_err (port_id, (*dev->dev_ops->representor_info_get)(dev, + info)); +} +RTE_LOG_REGISTER (rte_eth_dev_logtype, lib.ethdev,INFO );RTE_INIT (ethdev_init_telemetry)
lib/librte_ethdev/rte_ethdev.h +54 -0
60 lines not on this page · raw message
lib/librte_ethdev/version.map +3 -0
@@ -243,6 +243,9 @@ EXPERIMENTAL { # added in 21.02 rte_eth_get_monitor_addr; + + # added in 21.05 + rte_eth_representor_info_get; }; INTERNAL {
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v9 08/10] ethdev: new API to get representor info
Quoted 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).
This patch introduces a new API
rte_eth_representor_info_get()to retrieve representor corresponding info mapping:
- caller controller index and pf index.
- supported representor ID ranges.
- type, controller, pf and start vf/sf ID of each range.
The API is useful to calculate representor from devargs to representor ID.New ethdev callback
representor_info_get()is added to retrieve info from PMD driver, optional for PMD that doesn't support new devargs representor syntax.Signed-off-by Xueming Li <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
<...>
lib/librte_ethdev/version.map EXPERIMENTAL { · line 249
Quoted 8 lines
lib/librte_ethdev/version.map +3
-0@@ -243,6 +243,9 @@ EXPERIMENTAL { # added in 21.02 rte_eth_get_monitor_addr; + + # added in 21.05 + rte_eth_representor_info_get; };
New API documented in release notes, "API Changes" section, while merging.
Re: [dpdk-dev] [PATCH v9 08/10] ethdev: new API to get representor info
16/03/2021 20:18, Ferruh Yigit:
Quoted 5 lines · Xueming Li
lib/librte_ethdev/version.map EXPERIMENTAL { · line 248
Quoted 2 lines
lib/librte_ethdev/version.map +2
-0+ # added in 21.05 + rte_eth_representor_info_get;New API documented in release notes, "API Changes" section, while merging.
In general we don't mention new API in release notes. What is the intent Ferruh?
Re: [dpdk-dev] [PATCH v9 08/10] ethdev: new API to get representor info
Quoted 10 lines · Thomas Monjalon
16/03/2021 20:18, Ferruh Yigit:
Quoted 5 lines · Xueming Li
lib/librte_ethdev/version.map EXPERIMENTAL { · line 248
Quoted 2 lines
lib/librte_ethdev/version.map +2
-0+ # added in 21.05 + rte_eth_representor_info_get;New API documented in release notes, "API Changes" section, while merging.
In general we don't mention new API in release notes. What is the intent Ferruh?
Intent is just document new APIs.
I recognized that new APIs are not mentioned previously, is there a specific reason to it? Shouldn't be good to document them?
Re: [dpdk-dev] [PATCH v9 08/10] ethdev: new API to get representor info
17/03/2021 00:34, Ferruh Yigit:
Quoted 8 lines · Thomas Monjalon
Quoted 7 lines
16/03/2021 20:18, Ferruh Yigit:
Quoted 5 lines · Xueming Li
lib/librte_ethdev/version.map EXPERIMENTAL { · line 248
Quoted 2 lines
lib/librte_ethdev/version.map +2
-0+ # added in 21.05 + rte_eth_representor_info_get;New API documented in release notes, "API Changes" section, while merging.
Quoted 7 lines
Quoted 3 lines
In general we don't mention new API in release notes. What is the intent Ferruh?
Intent is just document new APIs.
I recognized that new APIs are not mentioned previously, is there a specific reason to it? Shouldn't be good to document them?
In general, a new API comes with a new feature description.
The API changes section is for documenting what must be adapted in the applications.
If we add more info in this section, I'm afraid it will be less straightforward for those who just need to maintain apps.
Re: [dpdk-dev] [PATCH v9 08/10] ethdev: new API to get representor info
Quoted 17 lines · Thomas Monjalon
17/03/2021 00:34, Ferruh Yigit:
Quoted 8 lines · Thomas Monjalon
Quoted 7 lines
16/03/2021 20:18, Ferruh Yigit:
Quoted 5 lines · Xueming Li
lib/librte_ethdev/version.map EXPERIMENTAL { · line 248
Quoted 2 lines
lib/librte_ethdev/version.map +2
-0+ # added in 21.05 + rte_eth_representor_info_get;New API documented in release notes, "API Changes" section, while merging.
Quoted 7 lines
Quoted 3 lines
In general we don't mention new API in release notes. What is the intent Ferruh?
Intent is just document new APIs.
I recognized that new APIs are not mentioned previously, is there a specific reason to it? Shouldn't be good to document them?
Quoted 8 lines
In general, a new API comes with a new feature description.
The API changes section is for documenting what must be adapted in the applications.
If we add more info in this section, I'm afraid it will be less straightforward for those who just need to maintain apps.
OK, I will remove it back.
PATCH v9 9/10 ethdev: representor iterator compare complete info
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 representor ID was compared with devarg. Since controller index and PF index not compared, callback returned representor from other PF or controller.
This patch adds new API to get representor ID from controller, pf and vf/sf index. Representor comparer callback get representor ID then compare with device representor ID.
--- lib/librte_ethdev/ethdev_driver.h | 32 +++++++++++ lib/librte_ethdev/rte_class_eth.c | 38 ++++++++++--- lib/librte_ethdev/rte_ethdev.c | 93 +++++++++++++++++++++++++++++++ lib/librte_ethdev/version.map | 1 + 4 files changed, 155 insertions(+), 9 deletions(-)
lib/librte_ethdev/ethdev_driver.h +32 -0
@@ -1264,6 +1264,38 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* PMD helper function to get representor ID from location detail. +* +* Get representor ID from controller, pf and (sf or vf). +* The mapping is retrieved from rte_eth_representor_info_get(). +* +* For backward compatibility, if no representor info, direct +* map legacy VF (no controller and pf). +* +* @param ethdev +* Handle of ethdev port. +* @param type +* Representor type. +* @param controller +* Controller ID, -1 if unspecified. +* @param pf +* PF port ID, -1 if unspecified. +* @param representor_port +* VF or SF representor port number, -1 if unspecified. +* @param repr_id +* Pointer to output representor ID. +* +* @return +* Negative errno value on error, 0 on success. +*/ +__rte_internal +int +rte_eth_representor_id_get (const struct rte_eth_dev *ethdev, +enum rte_eth_representor_type type, +int controller,int pf,int representor_port, +uint16_t *repr_id); +/** * PMD helper function to parse ethdev arguments *
lib/librte_ethdev/rte_class_eth.c +29 -9
@@ -65,9 +65,10 @@ 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; +const struct rte_eth_dev *edev = opaque; +const struct rte_eth_dev_data *data = edev->data; +struct rte_eth_devargs eth_da; +uint16_t id, nc, np, nf, i, c, p, f;if ((data->dev_flags &RTE_ETH_DEV_REPRESENTOR ) ==0 )return -1 ;/* not a representor port */
@@ -76,17 +77,36 @@ 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 */ +if (eth_da.nb_mh_controllers ==0 && eth_da.nb_ports ==0 && + eth_da.nb_representor_ports ==0 ) +return -1 ; + nc = eth_da.nb_mh_controllers >0 ? eth_da.nb_mh_controllers :1 ; + np = eth_da.nb_ports >0 ? eth_da.nb_ports :1 ; + nf = eth_da.nb_representor_ports >0 ? eth_da.nb_representor_ports :1 ; +/* 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]) +for (i =0 ; i < nc * np * nf; ++i) { + c = i / (np * nf); + p = (i / nf) % np; + f = i % nf; +if (rte_eth_representor_id_get (edev, + eth_da.type, + eth_da.nb_mh_controllers ==0 ?-1 : + eth_da.mh_controllers[c], + eth_da.nb_ports ==0 ?-1 : eth_da.ports[p], + eth_da.nb_representor_ports ==0 ?-1 : + eth_da.representor_ports[f], + &id) <0 ) +continue ; +if (data->representor_id == id)return 0 ; + }return -1 ;/* no match */ }
@@ -112,7 +132,7 @@ eth_dev_match(const struct rte_eth_dev *edev, ret =rte_kvargs_process (kvlist, eth_params_keys[RTE_ETH_PARAM_REPRESENTOR ], - eth_representor_cmp, edev->data); + eth_representor_cmp, (void *)(uintptr_t )edev);if (ret !=0 )return -1 ;/* search for representor key */
lib/librte_ethdev/rte_ethdev.c +93 -0
99 lines not on this page · raw message
lib/librte_ethdev/version.map +1 -0
@@ -268,6 +268,7 @@ INTERNAL { rte_eth_hairpin_queue_peer_bind; rte_eth_hairpin_queue_peer_unbind; rte_eth_hairpin_queue_peer_update; + rte_eth_representor_id_get; rte_eth_switch_domain_alloc; rte_eth_switch_domain_free; };
Signature · 1 line
2.25.1
PATCH v9 10/10 doc/release: add representor enhancements
In reply to Xueming LiUpdates 21.05 release notes to include representor enhancements.
--- doc/guides/rel_notes/release_21_05.rst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
doc/guides/rel_notes/release_21_05.rst +18 -0
@@ -70,6 +70,24 @@ New Features * Added command to display Rx queue used descriptor count. ``show port (port_id) rxq (queue_id) desc used count`` +* **Ethdev representor enhancement** + + Enhanced ethdev representor to support SubFunction and multi-host:: + + representor=# [0,2-4] /* Legacy VF compatible. */ + representor=[[c#]pf#]vf# c1pf2vf3 /* VF 3 on PF 2 of controller 1. */ + representor=[[c#]pf#]sf# sf[0,2-1023] /* 1023 SFs. */ + representor=[c#]pf# c2pf[0,1] /* 2 PFs on controller 2. */ + + * Introduced representor type of VF, SF and PF. + * Enhanced representor syntax parsing. + * Supported SF and PF type representor. + * Supported multi-host in representor. + * Added new PMD callback ``representor_info_get`` to get representor info. + * Added new helper function ``rte_eth_representor_id_get`` to calculate + unique representor ID from info. + * Updated representor iterator to match new enhanced syntax. + Removed Items -------------
Signature · 1 line
2.25.1
Re: [dpdk-dev] [PATCH v9 00/10] ethdev: support SubFunction representor
In reply to Xueming LiQuoted 75 lines · Xueming Li
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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
V7:
- error on duplicated representor argument:
DBDF,representor=a,representor=b
- fix pf representor type parsing
- other small fixes suggested by Andrew.
V8:
- remove the "ignore" hint from pmd representor info
- changedrepresentor_idtype in representor info to u32
- renamerte_eth_representor_id_convert()to ..._get()
- other small fixes suggested by Andrew
V9:
- more document for PMD to implementrepresentor_info_getcallback
- updated ice and txgbe to adapt new representor type
- updated 21.05 release notes
- other small fixes suggested by Ferruh and Andrew, thanks.
Quoted 12 lines
Xueming Li (10):
ethdev: introduce representor type
ethdev: refactor representor port list parsing
ethdev: support new VF representor syntax
ethdev: support sub function representor
kvargs: update parser to support multiple lists
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 doc/release: add representor enhancements
Series applied to dpdk-next-net/main, thanks.
Re: [dpdk-dev] [PATCH v9 00/10] ethdev: support SubFunction representor
Quoted 98 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Wednesday, March 17, 2021 3:19 AM
To: Xueming(Steven) Li <[email protected]>; Andrew Rybchenko <[email protected]>
Cc: [email protected]; Slava Ovsiienko <[email protected]>; Asaf Penso <[email protected]>
Subject: Re: [PATCH v9 00/10] ethdev: support SubFunction representorQuoted 75 lines · Xueming Li
SubFunction [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
- updateswitch_representation.rst- Thanks Ajit
V6:
- split representor types into different patches, move torte_ethdev.h
- improvements ofrte_eth_devargs_process_list()according to Andrew's suggestion
- fixed PF probe failure for Intel i40e
- replace ethdev SF capability withrte_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
V7:
- error on duplicated representor argument:
DBDF,representor=a,representor=b
- fix pf representor type parsing
- other small fixes suggested by Andrew.
V8:
- remove the "ignore" hint from pmd representor info
- changedrepresentor_idtype in representor info to u32
- renamerte_eth_representor_id_convert()to ..._get()
- other small fixes suggested by Andrew
V9:
- more document for PMD to implementrepresentor_info_getcallback
- updated ice and txgbe to adapt new representor type
- updated 21.05 release notes
- other small fixes suggested by Ferruh and Andrew, thanks.Quoted 12 lines
Xueming Li (10):
ethdev: introduce representor type
ethdev: refactor representor port list parsing
ethdev: support new VF representor syntax
ethdev: support sub function representor
kvargs: update parser to support multiple lists
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 doc/release: add representor enhancements
Quoted 1 line
Series applied to dpdk-next-net/main, thanks.
Thanks!
RFC 2/7 ethdev: support multi-host representor
In reply to Xueming LiThis patch introduce 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 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.
--- config/rte_config.h | 1 + lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 4 ++++ 3 files changed, 16 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 +11 -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,15 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)int ret; eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +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' ) { 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 contollerss 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] [RFC 2/7] ethdev: support multi-host representor
Quoted 9 lines · Xueming Li
This patch introduce 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 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.
There is a big question here what is the controller ID and how to explain it to end-user (e.g. OvS admin) which one is 0 and which one is 1, etc.
Quoted 56 lines
Signed-off-by Xueming Li <[email protected]>--- config/rte_config.h | 1 + lib/librte_ethdev/ethdev_private.c | 13 +++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 4 ++++ 3 files changed, 16 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 +11
-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,15 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)int ret; eth_da->type =RTE_ETH_REPRESENTOR_NONE ; +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' ) { str +=2 ;lib/librte_ethdev/rte_ethdev_driver.h +0
-0
lib/librte_ethdev/rte_ethdev_driver.h enum rte_eth_representor_type { · line 1209
Quoted 7 lines
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 contollerss field */
Typo: contollerss
Quoted 4 lines
lib/librte_ethdev/rte_ethdev_driver.h +0
-0uint16_t ports[RTE_MAX_ETHPORTS ];/** port/s number to enable on a multi-port single function */ uint16_t nb_ports;
RFC 3/7 devarg: change reprsentor ID to bitmap
In reply to Xueming LiIn eth representor comparer 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
--- 0000-cover-letter.patch | 44 +++++++++++++++++++++++++++ lib/librte_ethdev/ethdev_private.c | 42 ++++++++++++++++++++++++- lib/librte_ethdev/rte_ethdev_driver.h | 22 ++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 0000-cover-letter.patch
0000-cover-letter.patch new file +44 -0
@@ -0,0 +1,44 @@ +From 4e1f8fc062fa6813e0b57f78ad72760601ca1d98 Mon Sep 17 00:00:00 2001 +From: Xueming Li <[email protected]> +Date: Fri, 18 Dec 2020 22:31:53 +0800 +Subject: [RFC 0/7] *** SUBJECT HERE *** +To: Viacheslav Ovsiienko <[email protected]>, + Thomas Monjalon <[email protected]>, + Ferruh Yigit <[email protected]>, + Andrew Rybchenko <[email protected]>, + Olivier Matz <[email protected]>, + Matan Azrad <[email protected]> +Cc: [email protected], + [email protected], + Asaf Penso <[email protected]> + +*** BLURB HERE *** + +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 + + 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 | 163 ++++++++++++++------- + 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 +++++++---- + 14 files changed, 306 insertions(+), 104 deletions(-) + +-- +2.25.1 +
lib/librte_ethdev/ethdev_private.c +41 -1
63 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev_driver.h +22 -0
@@ -1218,6 +1218,28 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* Encoding representor port 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 +*/ +#define RTE_ETH_REPR (c, pf, sf, port) \ + ((((c) & 3) << 14) | \ + (((pf) & 3) << 12) | \ + (!!(sf) << 11) | \ + ((port) & 0x7ff)) +/** Get 'pf' port id from representor ID */ +#define RTE_ETH_REPR_PF (repr) (((repr) >> 12) & 3) +/** Get 'vf' or 'sf' port from representor ID */ +#define RTE_ETH_REPR_PORT (repr) ((repr) & 0x7ff) +/** * PMD helper function to parse ethdev arguments *
Signature · 1 line
2.25.1
Re: [dpdk-dev] [RFC 3/7] devarg: change reprsentor ID to bitmap
Quoted 1 line · Xueming Li
In eth representor comparer callback, ethdev was compared with devarg.
comparer -> comparator?
Quoted 9 lines
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.
Quoted 6 lines
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
Just 2 bits for PF ID is definitely not future proof.
Quoted 1 line
LL controller(host) id
Same here.
In general, I'm not sure that such approch with bitmap makes sense. I think we need a new API which returns information about available functions which could be represented and IDs there could be used as representor IDs.
Quoted 4 lines
Signed-off-by Xueming Li <[email protected]>--- 0000-cover-letter.patch | 44 +++++++++++++++++++++++++++
I guess it should not be added to the changeset.
Quoted 82 lines
lib/librte_ethdev/ethdev_private.c | 42 ++++++++++++++++++++++++- lib/librte_ethdev/rte_ethdev_driver.h | 22 ++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 0000-cover-letter.patch0000-cover-letter.patch new file +44
-0@@ -0,0 +1,44 @@ +From 4e1f8fc062fa6813e0b57f78ad72760601ca1d98 Mon Sep 17 00:00:00 2001 +From: Xueming Li <[email protected]> +Date: Fri, 18 Dec 2020 22:31:53 +0800 +Subject: [RFC 0/7] *** SUBJECT HERE *** +To: Viacheslav Ovsiienko <[email protected]>, + Thomas Monjalon <[email protected]>, + Ferruh Yigit <[email protected]>, + Andrew Rybchenko <[email protected]>, + Olivier Matz <[email protected]>, + Matan Azrad <[email protected]> +Cc: [email protected], + [email protected], + Asaf Penso <[email protected]> + +*** BLURB HERE *** + +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 + + 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 | 163 ++++++++++++++------- + 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 +++++++---- + 14 files changed, 306 insertions(+), 104 deletions(-) + +-- +2.25.1 +lib/librte_ethdev/ethdev_private.c +5
-1@@ -93,16 +93,20 @@ 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) {struct rte_eth_devargs *eth_da = data;int ret; +uint32_t c, p, f, i =0 ; eth_da->type =RTE_ETH_REPRESENTOR_NONE ;if (str[0 ] =='c' ) {
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 147
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +5
-0@@ -136,6 +140,42 @@ 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 ); +if (ret <0 ) + goto err; + +/* Set default values, expand and update representor ID. */ +if (!eth_da->nb_mh_controllers) {
DPDK coding style requires to compare vs 0 expliticly.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 151
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +4
-0+ eth_da->nb_mh_controllers =1 ; + eth_da->mh_controllers[0 ] =0 ; + } +if (!eth_da->nb_ports) {
DPDK coding style requires to compare vs 0 expliticly.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 155
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +4
-0+ eth_da->nb_ports =1 ; + eth_da->ports[0 ] =0 ; + } +if (!eth_da->nb_representor_ports) {
DPDK coding style requires to compare vs 0 expliticly.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 166
Quoted 11 lines
lib/librte_ethdev/ethdev_private.c +11
-0+ eth_da->nb_representor_ports =1 ; + eth_da->representor_ports[0 ] =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) { + i = c * eth_da->nb_ports * + eth_da->nb_representor_ports + + p * eth_da->nb_representor_ports + f; +if (i >=RTE_DIM (eth_da->representor_ports)) { + RTE_LOG(ERR, EAL, "too many representor specified: %s",
Missing \n
Quoted 49 lines
lib/librte_ethdev/ethdev_private.c +12
-0+ str); +return -EINVAL ; + } + eth_da->representor_ports[i] =RTE_ETH_REPR ( + eth_da->mh_controllers[c], + eth_da->ports[p], + eth_da->type ==RTE_ETH_REPRESENTOR_SF , + eth_da->representor_ports[f]); + } + } + } + eth_da->nb_representor_ports = i +1 ; err:if (ret <0 )RTE_LOG (ERR ,EAL ,"wrong representor format: %s" , str);lib/librte_ethdev/rte_ethdev_driver.h +22
-0@@ -1218,6 +1218,28 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* Encoding representor port 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 +*/ +#define RTE_ETH_REPR (c, pf, sf, port) \ + ((((c) & 3) << 14) | \ + (((pf) & 3) << 12) | \ + (!!(sf) << 11) | \ + ((port) & 0x7ff)) +/** Get 'pf' port id from representor ID */ +#define RTE_ETH_REPR_PF (repr) (((repr) >> 12) & 3) +/** Get 'vf' or 'sf' port from representor ID */ +#define RTE_ETH_REPR_PORT (repr) ((repr) & 0x7ff) +/** * PMD helper function to parse ethdev arguments *
Re: [dpdk-dev] [RFC 3/7] devarg: change reprsentor ID to bitmap
Hi Andrew,
Quoted 24 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, December 28, 2020 9:37 PM
To: Xueming(Steven) Li <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Asaf Penso <[email protected]>
Subject: Re: [RFC 3/7] devarg: change reprsentor ID to bitmapQuoted 1 line · Xueming Li
In eth representor comparer callback, ethdev was compared with devarg.
comparer -> comparator?
Quoted 9 lines
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.
Quoted 8 lines
Quoted 6 lines
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 idJust 2 bits for PF ID is definitely not future proof.
Yes, this is a valid concern, to keep ABI compatibility, need to wait next LTS to change it to u32 or u64.
Quoted 8 lines
Quoted 2 lines
LL controller(host) id
Same here.
In general, I'm not sure that such approch with bitmap makes sense. I think we need a new API which returns information about available functions which could be represented and IDs there could be used as representor IDs.
Agree, will introduce rte_eth_representor_id_encode() and rte_eth_representor_id_parse() in next vesion.
Quoted 184 lines
Quoted 5 lines
Signed-off-by Xueming Li <[email protected]>--- 0000-cover-letter.patch | 44 +++++++++++++++++++++++++++I guess it should not be added to the changeset.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char
Quoted 82 lines
lib/librte_ethdev/ethdev_private.c | 42 ++++++++++++++++++++++++- lib/librte_ethdev/rte_ethdev_driver.h | 22 ++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 1006440000-cover-letter.patch
0000-cover-letter.patch new renamed from 0000-cover-letter.patch +0
-0file mode 100644 index 0000000000..3f8ce2be72
0000-cover-letter.patch new file +45
-0@@ -0,0 +1,44 @@ +From 4e1f8fc062fa6813e0b57f78ad72760601ca1d98 Mon Sep 17 00:00:00 +2001 +From: Xueming Li <[email protected]> +Date: Fri, 18 Dec 2020 22:31:53 +0800 +Subject: [RFC 0/7] *** SUBJECT HERE *** +To: Viacheslav Ovsiienko <[email protected]>, + Thomas Monjalon <[email protected]>, + Ferruh Yigit <[email protected]>, + Andrew Rybchenko <[email protected]>, + Olivier Matz <[email protected]>, + Matan Azrad <[email protected]> +Cc: [email protected], + [email protected], + Asaf Penso <[email protected]> + +*** BLURB HERE *** + +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 + + 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 | 163 ++++++++++++++------- + 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 +++++++---- + 14 files changed, 306 insertions(+), 104 deletions(-) + +-- +2.25.1 +lib/librte_ethdev/ethdev_private.c +5
-1@@ -93,16 +93,20 @@ 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) {struct rte_eth_devargs *eth_da = data;int ret; +uint32_t c, p, f, i =0 ; eth_da->type =RTE_ETH_REPRESENTOR_NONE ;if (str[0 ] =='c' ) {@@ -136,6 +140,42 @@ rte_eth_devargs_parse_representor_ports(char*str, void *data)
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 147
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +5
-0} ret =rte_eth_devargs_process_list (str, eth_da->representor_ports, ð_da->nb_representor_ports,RTE_MAX_ETHPORTS ); +if (ret <0 ) + goto err; + +/* Set default values, expand and update representor ID. */ +if (!eth_da->nb_mh_controllers) {DPDK coding style requires to compare vs 0 expliticly.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 151
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +4
-0+ eth_da->nb_mh_controllers =1 ; + eth_da->mh_controllers[0 ] =0 ; + } +if (!eth_da->nb_ports) {DPDK coding style requires to compare vs 0 expliticly.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data) · line 155
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +4
-0+ eth_da->nb_ports =1 ; + eth_da->ports[0 ] =0 ; + } +if (!eth_da->nb_representor_ports) {DPDK coding style requires to compare vs 0 expliticly.
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data)
Quoted 10 lines
lib/librte_ethdev/ethdev_private.c +10
-0+ eth_da->nb_representor_ports =1 ; + eth_da->representor_ports[0 ] =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) { + i = c * eth_da->nb_ports * + eth_da->nb_representor_ports + + p * eth_da->nb_representor_ports + f; +if (i >=RTE_DIM (eth_da->representor_ports)){
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char · line 166
Quoted 1 line
lib/librte_ethdev/ethdev_private.c +1
-0+ RTE_LOG(ERR, EAL, "too manyrepresentor specified: %s",
Missing \n
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data)
Quoted 4 lines
lib/librte_ethdev/ethdev_private.c +4
-0+ str); +return -EINVAL ; + } + eth_da->representor_ports[i] =RTE_ETH_REPR(
lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data)
Quoted 3 lines
lib/librte_ethdev/ethdev_private.c +3
-0+ eth_da->mh_controllers[c], + eth_da->ports[p], + eth_da->type ==
RTE_ETH_REPRESENTOR_SF,lib/librte_ethdev/ethdev_private.c rte_eth_devargs_parse_representor_ports(char *str, void *data)
Quoted 8 lines
lib/librte_ethdev/ethdev_private.c +5
-0+ eth_da->representor_ports[f]); + } + } + } + eth_da->nb_representor_ports = i +1 ; err:if (ret <0 ) RTE_LOG(ERR, EAL, "wrong representor format: %s", str); diff --git
Quoted 34 lines
a/lib/librte_ethdev/rte_ethdev_driver.hb/lib/librte_ethdev/rte_ethdev_driver.h
indexa7969c9408..dbad55c704100644lib/librte_ethdev/rte_ethdev_driver.h +22
-0@@ -1218,6 +1218,28 @@ struct rte_eth_devargs {enum rte_eth_representor_type type;/* type of representor */ }; +/** +* Encoding representor port 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 +*/ +#define RTE_ETH_REPR (c, pf, sf, port) \ + ((((c) & 3) << 14) | \ + (((pf) & 3) << 12) | \ + (!!(sf) << 11) | \ + ((port) & 0x7ff)) +/** Get 'pf' port id from representor ID */ #define +RTE_ETH_REPR_PF (repr) (((repr) >> 12) & 3) +/** Get 'vf' or 'sf' port from representor ID */ #define +RTE_ETH_REPR_PORT (repr) ((repr) & 0x7ff) +/** * PMD helper function to parse ethdev arguments *
RFC 4/7 ethdev: capability for new representor syntax
In reply to Xueming LiThis patch introduces new eth device capability to support 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
Re: [dpdk-dev] [RFC 4/7] ethdev: capability for new representor syntax
Quoted 4 lines · Xueming Li
This patch introduces new eth device capability to support SubFunction representor device.
Signed-off-by Xueming Li <[email protected]>
Motivation why the flag is required is missing.
RFC 5/7 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 | 82 +++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 26 deletions(-)
lib/librte_kvargs/rte_kvargs.c +56 -26
@@ -13,15 +13,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; +int in_list =0 , end_k =0 , end_v =0 ;/* Copy the const char *params to a modifiable string * to pass to rte_strsplit
@@ -32,36 +36,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 =1 ; +break ; +case ',' : +/* End of value, skip comma in middle of range */ +if (!in_list) + end_v =1 ; +break ; +case '[' :/* Start of list. */ + in_list++; +break ; +case ']' :/* End of list. */ +if (in_list) + in_list--; +break ; +case 0 :/* End of string */ + end_v =1 ; +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 =0 ; + }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 =0 ; } - kvlist->count++; - str =NULL ; +if (!*str)/* End of string. */ +break ; + *str =0 ; + str++; + start = str; }return 0 ;
Signature · 1 line
2.25.1
Re: [dpdk-dev] [RFC 5/7] kvargs: update parser for new representor syntax
Quoted 57 lines · Xueming Li
This patch updates kvargs parser to allow comma in list value:
k1=a[1,2]b[3-5]Signed-off-by Xueming Li <[email protected]>--- lib/librte_kvargs/rte_kvargs.c | 82 +++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 26 deletions(-)lib/librte_kvargs/rte_kvargs.c +24
-5@@ -13,15 +13,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; +int in_list =0 , end_k =0 , end_v =0 ;/* Copy the const char *params to a modifiable string * to pass to rte_strsplit @@ -32,36 +36,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 =1 ; +break ; +case ',' : +/* End of value, skip comma in middle of range */ +if (!in_list) + end_v =1 ; +break ; +case '[' :/* Start of list. */ + in_list++; +break ; +case ']' :/* End of list. */ +if (in_list)
lib/librte_kvargs/rte_kvargs.c rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params) · line 64
Quoted 10 lines
lib/librte_kvargs/rte_kvargs.c +10
-0+ in_list--; +break ; +case 0 :/* End of string */ + end_v =1 ; +break ; +default : +break ; + } + +if (!end_k && !end_v) {
DPDK coding style requires to compare integers vs 0 explicitly. Otherwise you can define it as bool and use as bool this way.
Quoted 22 lines
lib/librte_kvargs/rte_kvargs.c +4
-13+/* 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' )
lib/librte_kvargs/rte_kvargs.c rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params) · line 77
Quoted 10 lines
lib/librte_kvargs/rte_kvargs.c +4
-6-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) {
same
lib/librte_kvargs/rte_kvargs.c rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params) · line 81
Quoted 4 lines
lib/librte_kvargs/rte_kvargs.c +4
-0+/* Key parsed. */ + kvlist->pairs[i].key = start; + end_k =0 ; + }else if (end_v) {
same
lib/librte_kvargs/rte_kvargs.c rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params) · line 90
Quoted 11 lines
lib/librte_kvargs/rte_kvargs.c +6
-2+/* Allow single key or single value. */ +if (kvlist->pairs[i].key || start) { + kvlist->pairs[i].value = start; + kvlist->count++; } + end_v =0 ; } - kvlist->count++; - str =NULL ; +if (!*str)/* End of string. */
Compare with '\0'.
Quoted 7 lines
lib/librte_kvargs/rte_kvargs.c +4
-0+break ; + *str =0 ; + str++; + start = str; }return 0 ;
RFC 6/7 common/mlx5: update representor name parsing
In reply to Xueming LiThis 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
RFC 7/7 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]
--- drivers/net/mlx5/linux/mlx5_ethdev_os.c | 2 + drivers/net/mlx5/linux/mlx5_os.c | 69 ++++++++++++++++++++++--- drivers/net/mlx5/mlx5_ethdev.c | 2 + 3 files changed, 67 insertions(+), 6 deletions(-)
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 +63 -6
106 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
Quoted 15 lines · Xueming Li
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.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 flexibility, this patch also introduces new netdev capability to indicate the capability to support new representor types.
Many thanks for sharing the patchset. Looks very interesting. I've already sent my comments and questions for individual patches.
Quoted 2 lines
[snip]
Hi Andrew,
Quoted 27 lines
-----Original Message-----
From: Andrew Rybchenko <[email protected]>
Sent: Monday, December 28, 2020 9:45 PM
To: Xueming(Steven) Li <[email protected]>; Slava Ovsiienko <[email protected]>; NBU-Contact-Thomas Monjalon <[email protected]>; Ferruh Yigit <[email protected]>; Olivier Matz <[email protected]>; Matan Azrad <[email protected]>
Cc: [email protected]; Asaf Penso <[email protected]>
Subject: Re: [RFC 0/7] support SubFunction representorQuoted 4 lines · Xueming Li
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 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 8 lines
Quoted 5 lines
"#" 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.
Many thanks for sharing the patchset. Looks very interesting. I've already sent my comments and questions for individual patches.
Appreciate for the wonderful review, will address them next week.
Quoted 5 lines
Quoted 3 lines
[snip]
30/12/2020 09:54, Xueming(Steven) Li:
Quoted 23 lines
Hi Andrew,
From: Andrew Rybchenko <[email protected]>
Quoted 20 lines · Xueming Li
Quoted 4 lines
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 PCIfunction.
Quoted 14 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
"#" is number instance, list or range, valid examples:
1, [1,3,5], [0-3], [0,2-4,6]
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
For flexibility, this patch also introduces new netdev capability to indicate the capability to support new representor types.
Many thanks for sharing the patchset. Looks very interesting. I've already sent my comments and questions for individual patches.
Appreciate for the wonderful review, will address them next week.
I agree, good review, thanks.
I am waiting for a v2.