ethdev: support multi-host in representor
authorXueming Li <xuemingl@nvidia.com>
Thu, 11 Mar 2021 13:13:30 +0000 (13:13 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Mar 2021 19:15:29 +0000 (20:15 +0100)
The NIC can have multiple PCIe links and can be attached to the multiple
hosts, for example the same single NIC can be shared for multiple server
units in the rack. On each PCIe link NIC can provide multiple PFs and
VFs/SFs based on these ones. To provide the unambiguous identification
of the PCIe function the controller index is added. The full representor
identifier consists of three indices - controller index, PF index, and
VF or SF index (if any).

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

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

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

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

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
config/rte_config.h
doc/guides/rel_notes/release_21_05.rst
lib/librte_ethdev/ethdev_driver.h
lib/librte_ethdev/ethdev_private.c

index 55a2fc5..904a40b 100644 (file)
@@ -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
index e4965e4..8e686cc 100644 (file)
@@ -58,12 +58,12 @@ New Features
 * **Enhanced ethdev representor syntax.**
 
   * Introduced representor type of VF, SF and PF.
-  * Supported sub-function in representor syntax::
+  * Supported sub-function and multi-host in representor syntax::
 
       representor=#            [0,2-4]      /* Legacy VF compatible.         */
-      representor=[pf#]vf#     pf2vf3       /* VF 3 on PF 2.                 */
-      representor=[pf#]sf#     sf[0,2-1023] /* 1023 SFs.                     */
-      representor=pf#          pf[0,1]      /* 2 PFs.                        */
+      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.        */
 
 * **Updated Broadcom bnxt driver.**
 
index d68b840..06ff352 100644 (file)
@@ -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;
index 35a57c5..012cf73 100644 (file)
@@ -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,
+                               &eth_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)
                                &eth_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;