From patchwork Wed Jan 13 13:44:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 86464 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 22471A04B5; Wed, 13 Jan 2021 14:45:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C11F6140D2A; Wed, 13 Jan 2021 14:45:12 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id F304D140D2A for ; Wed, 13 Jan 2021 14:45:09 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@nvidia.com) with SMTP; 13 Jan 2021 15:45:05 +0200 Received: from nvidia.com ([172.27.8.145]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 10DDinBB024044; Wed, 13 Jan 2021 15:45:02 +0200 From: Xueming Li To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Olivier Matz Cc: dev@dpdk.org, Viacheslav Ovsiienko , xuemingl@nvidia.com, Asaf Penso Date: Wed, 13 Jan 2021 21:44:18 +0800 Message-Id: <20210113134422.15723-6-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <1608303356-13089-2-git-send-email-xuemingl@nvidia.com> References: <1608303356-13089-2-git-send-email-xuemingl@nvidia.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 5/9] ethdev: support multi-host representor X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch introduces multi-host controller for 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. It is mostly for SmartNIC attached to multiple hosts in the same rack to allow routing the packets between PF/SF/VF running on these hosts. Controller ID is physical host ID in multi-host, for end-user (e.g. OVS) it is transparent as part of representor syntax, sam as representor ID, interpreted by PMD. Signed-off-by: Xueming Li --- config/rte_config.h | 1 + lib/librte_ethdev/ethdev_private.c | 14 ++++++++++++-- lib/librte_ethdev/rte_ethdev_driver.h | 4 ++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index a0b5160ff2..23d02d51ef 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -58,6 +58,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 diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c index ccc638ec49..95f1ab847a 100644 --- a/lib/librte_ethdev/ethdev_private.c +++ b/lib/librte_ethdev/ethdev_private.c @@ -95,8 +95,8 @@ 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 + * [[c#]pf#]vf#: VF port representor/s + * [[c#]pf#]sf#: SF port representor/s */ int rte_eth_devargs_parse_representor_ports(char *str, void *data) @@ -105,6 +105,16 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) int ret; eth_da->type = RTE_ETH_REPRESENTOR_NONE; + /* Parse c# */ + if (str[0] == 'c') { + str += 1; + ret = rte_eth_devargs_process_list(str, eth_da->mh_controllers, + ð_da->nb_mh_controllers, + RTE_DIM(eth_da->mh_controllers)); + if (ret < 0) + goto err; + str += ret; + } /* Parse pf# */ if (str[0] == 'p' && str[1] == 'f') { eth_da->type = RTE_ETH_REPRESENTOR_PF; diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h index edb000cbd4..b9e4a0b9ba 100644 --- a/lib/librte_ethdev/rte_ethdev_driver.h +++ b/lib/librte_ethdev/rte_ethdev_driver.h @@ -1203,6 +1203,10 @@ enum rte_eth_representor_type { /** Generic Ethernet device arguments */ 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;