diff mbox series

[v6,4/9] ethdev: support sub function representor

Message ID 1613272907-22563-5-git-send-email-xuemingl@nvidia.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers show
Series ethdev: support SubFunction representor | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Xueming Li Feb. 14, 2021, 3:21 a.m. UTC
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       |  4 +++
 .../prog_guide/switch_representation.rst      | 35 +++++++++++++------
 lib/librte_ethdev/ethdev_private.c            | 11 ++++--
 lib/librte_ethdev/rte_ethdev.h                |  1 +
 4 files changed, 39 insertions(+), 12 deletions(-)

Comments

Andrew Rybchenko Feb. 15, 2021, 8:25 a.m. UTC | #1
Hi,

On 2/14/21 6:21 AM, Xueming Li wrote:
> 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>

What happens if I try to mix different types of representors:
A: -a DBDF,representor=sf0,representor=vf1
B: -a DBDF,representor=sf0 -a DBDF,representor=vf1
(DBDF is the same in args B in both cases).

I'm not trying to say that it must work, since most likely
hotplug will be used to add representors. But behaviour
must be consistent (error?).

The question is raised here, since it is the first patch
where the second type of representor appears.

Andrew.
Xueming Li Feb. 16, 2021, 9 a.m. UTC | #2
>-----Original Message-----
>From: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
>Sent: Monday, February 15, 2021 4:26 PM
>To: Xueming(Steven) Li <xuemingl@nvidia.com>
>Cc: dev@dpdk.org; Slava Ovsiienko <viacheslavo@nvidia.com>; Asaf Penso <asafp@nvidia.com>; NBU-Contact-Thomas Monjalon
><thomas@monjalon.net>; Ferruh Yigit <ferruh.yigit@intel.com>
>Subject: Re: [PATCH v6 4/9] ethdev: support sub function representor
>
>Hi,
>
>On 2/14/21 6:21 AM, Xueming Li wrote:
>> 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>
>
>What happens if I try to mix different types of representors:
>A: -a DBDF,representor=sf0,representor=vf1

Currently, the next representor will overwrite type of first, but append to representor ports.

>B: -a DBDF,representor=sf0 -a DBDF,representor=vf1 (DBDF is the same in args B in both cases).

This is a behavior of EAL, if DBDF are same, only the first get probed, even if the second is "sf1"

>
>I'm not trying to say that it must work, since most likely hotplug will be used to add representors. But behaviour must be consistent
>(error?).

Good catch, agree with error, will add check.

>
>The question is raised here, since it is the first patch where the second type of representor appears.
>
>Andrew.
diff mbox series

Patch

diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst
index 0117c2af07..86e5867f1b 100644
--- a/doc/guides/prog_guide/poll_mode_drv.rst
+++ b/doc/guides/prog_guide/poll_mode_drv.rst
@@ -378,6 +378,10 @@  parameters to those ports.
    -a DBDF,representor=vf[0,4,6,9]
    -a DBDF,representor=vf[0-31]
    -a DBDF,representor=vf[0,2-4,7,9-11]
+   -a DBDF,representor=sf0
+   -a DBDF,representor=sf[1,3,5]
+   -a DBDF,representor=sf[0-1023]
+   -a DBDF,representor=sf[0,2-4,7,9-11]
 
 Note: PMDs are not required to support the standard device arguments and users
 should consult the relevant PMD documentation to see support devargs.
diff --git a/doc/guides/prog_guide/switch_representation.rst b/doc/guides/prog_guide/switch_representation.rst
index 07ba12bea6..ff6aa91c80 100644
--- a/doc/guides/prog_guide/switch_representation.rst
+++ b/doc/guides/prog_guide/switch_representation.rst
@@ -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).
diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c
index 4bb3879859..13c191192e 100644
--- a/lib/librte_ethdev/ethdev_private.c
+++ b/lib/librte_ethdev/ethdev_private.c
@@ -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));
diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h
index 1f378958ca..26b5e109c3 100644
--- a/lib/librte_ethdev/rte_ethdev.h
+++ b/lib/librte_ethdev/rte_ethdev.h
@@ -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. */
 };
 
 /**