]> git.droids-corp.org - dpdk.git/commitdiff
ethdev: support sub-function representor
authorXueming Li <xuemingl@nvidia.com>
Thu, 11 Mar 2021 13:13:27 +0000 (13:13 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Mar 2021 19:15:29 +0000 (20:15 +0100)
SubFunction is a portion of the PCI device, created on demand, a SF
netdev has its own dedicated queues(txq, rxq). A SF netdev supports
eswitch representation offload similar to existing PF and VF
representors.

To support SF representor, this patch introduces new devargs syntax,
examples:
 representor=sf0               - single SubFunction representor
 representor=sf[1,3,5]         - single list
 representor=sf[0-3],          - single range
 representor=sf[0,2-6,8,10-12] - list with singles and ranges

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

index 0117c2af076865346af3c98e9857ef0a422828bb..063a4680dffeea23daf66b725ecd7da20ccdbd89 100644 (file)
@@ -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.
index 07ba12bea67e849eb1b5b860f10dc9906789aaad..ff6aa91c80663bdf0b06b70122fd54af35c3c007 100644 (file)
@@ -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).
index ff96ad8f9b9be943db2d64aafef8ab1a0b6ca771..88dd20c4dda8413972c4621c31898c235dd43fa2 100644 (file)
@@ -57,10 +57,11 @@ New Features
 
 * **Enhanced ethdev representor syntax.**
 
-  * Introduced representor type of VF.
-  * Supported representor syntax::
+  * Introduced representor type of VF, SF.
+  * Supported sub-function in representor syntax::
 
       representor=#            [0,2-4]      /* Legacy VF compatible.         */
+      representor=sf#          sf[0,2-1023] /* 1023 SFs.                     */
 
 * **Updated Broadcom bnxt driver.**
 
index 4bb38798597734a68ba62f5f1f85cc75a7a0f0ac..13c191192edf215a3ad0e4ff99a029acd98d6efb 100644 (file)
@@ -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,
                &eth_da->nb_representor_ports,
                RTE_DIM(eth_da->representor_ports));
index fe9466a03eaf0358ef91d6eb7d63dfb7a6e5edf2..60889a866323c6b7bad2e1b4fa9294dd94ca8672 100644 (file)
@@ -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)
index 1f378958caae9003660bb894a277e62da72fdc50..26b5e109c3a1eef084ce09bcf6ca8074f38b5b95 100644 (file)
@@ -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. */
 };
 
 /**