From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 00547A09FF;
	Wed,  6 Jan 2021 17:18:52 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 2A2DD140E31;
	Wed,  6 Jan 2021 17:18:14 +0100 (CET)
Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])
 by mails.dpdk.org (Postfix) with ESMTP id 68EE9140E07
 for <dev@dpdk.org>; Wed,  6 Jan 2021 17:18:05 +0100 (CET)
Received: from Internal Mail-Server by MTLPINE1 (envelope-from
 xuemingl@nvidia.com) with SMTP; 6 Jan 2021 18:18:00 +0200
Received: from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100])
 by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 106GI0Mi017451;
 Wed, 6 Jan 2021 18:18:00 +0200
From: Xueming Li <xuemingl@nvidia.com>
To: Thomas Monjalon <thomas@monjalon.net>,
 Ferruh Yigit <ferruh.yigit@intel.com>,
 Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
 Olivier Matz <olivier.matz@6wind.com>,
 Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Cc: dev@dpdk.org, xuemingl@nvidia.com, Asaf Penso <asafp@nvidia.com>
Date: Wed,  6 Jan 2021 16:17:29 +0000
Message-Id: <1609949855-23817-4-git-send-email-xuemingl@nvidia.com>
X-Mailer: git-send-email 1.8.3.1
In-Reply-To: <1609949855-23817-1-git-send-email-xuemingl@nvidia.com>
References: <1609949855-23817-1-git-send-email-xuemingl@nvidia.com>
In-Reply-To: <1608303356-13089-2-git-send-email-xuemingl@nvidia.com>
References: <1608303356-13089-2-git-send-email-xuemingl@nvidia.com>
Subject: [dpdk-dev] [PATCH v2 3/9] ethdev: support sub function representor
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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:

sf#: new SF port representor/s, example: sf[0-3], sf2

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 doc/guides/prog_guide/poll_mode_drv.rst |  1 +
 lib/librte_ethdev/ethdev_private.c      | 14 +++++++++++---
 lib/librte_ethdev/rte_ethdev_driver.h   |  1 +
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/doc/guides/prog_guide/poll_mode_drv.rst b/doc/guides/prog_guide/poll_mode_drv.rst
index 979a2bab9d..831d620c8d 100644
--- a/doc/guides/prog_guide/poll_mode_drv.rst
+++ b/doc/guides/prog_guide/poll_mode_drv.rst
@@ -377,6 +377,7 @@ parameters to those ports.
    -a DBDF,representor=vf0
    -a DBDF,representor=vf[0,4,6,9]
    -a DBDF,representor=vf[0-31]
+   -a DBDF,representor=sf[0-1023]
 
 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/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c
index 54f565ca37..551a43738a 100644
--- a/lib/librte_ethdev/ethdev_private.c
+++ b/lib/librte_ethdev/ethdev_private.c
@@ -96,6 +96,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
  */
 int
 rte_eth_devargs_parse_representor_ports(char *str, void *data)
@@ -103,10 +104,17 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data)
 	struct rte_eth_devargs *eth_da = data;
 	int ret;
 
-	/* Parse vf# or number # alone implies VF */
-	eth_da->type = RTE_ETH_REPRESENTOR_VF;
-	if (str[0] == 'v'  && str[1] == 'f')
+	eth_da->type = RTE_ETH_REPRESENTOR_NONE;
+	/* Parse vf# and sf#, number # alone implies VF */
+	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;
+	}
 	ret = rte_eth_devargs_process_list(str, eth_da->representor_ports,
 		&eth_da->nb_representor_ports, RTE_MAX_ETHPORTS);
 	if (ret < 0)
diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h
index b66a955b18..086d64223a 100644
--- a/lib/librte_ethdev/rte_ethdev_driver.h
+++ b/lib/librte_ethdev/rte_ethdev_driver.h
@@ -1197,6 +1197,7 @@ rte_eth_switch_domain_free(uint16_t domain_id);
 enum rte_eth_representor_type {
 	RTE_ETH_REPRESENTOR_NONE, /* not a representor */
 	RTE_ETH_REPRESENTOR_VF,   /* representor of VF */
+	RTE_ETH_REPRESENTOR_SF,   /* representor of SF */
 };
 
 /** Generic Ethernet device arguments  */
-- 
2.25.1