ethdev: support PF index in representor
authorXueming Li <xuemingl@nvidia.com>
Thu, 11 Mar 2021 13:13:29 +0000 (13:13 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Mar 2021 19:15:29 +0000 (20:15 +0100)
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

PF type representor is supported by using standalone 'pf' section:
 representor=pf1                - PF representor

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>
doc/guides/prog_guide/poll_mode_drv.rst
doc/guides/rel_notes/release_21_05.rst
lib/librte_ethdev/ethdev_private.c
lib/librte_ethdev/rte_ethdev.h

index 063a468..0d4ac77 100644 (file)
@@ -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.
index 88dd20c..e4965e4 100644 (file)
@@ -57,11 +57,13 @@ New Features
 
 * **Enhanced ethdev representor syntax.**
 
-  * Introduced representor type of VF, SF.
+  * Introduced representor type of VF, SF and PF.
   * Supported sub-function in representor syntax::
 
       representor=#            [0,2-4]      /* Legacy VF compatible.         */
-      representor=sf#          sf[0,2-1023] /* 1023 SFs.                     */
+      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.                        */
 
 * **Updated Broadcom bnxt driver.**
 
index 13c1911..35a57c5 100644 (file)
@@ -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,
+                               &eth_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,
                &eth_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;
index 26b5e10..9cd519b 100644 (file)
@@ -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. */
 };
 
 /**