From patchwork Sun Feb 14 03:21:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xueming Li X-Patchwork-Id: 87914 X-Patchwork-Delegate: ferruh.yigit@amd.com 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 8F0F3A0546; Sun, 14 Feb 2021 04:23:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7647422A257; Sun, 14 Feb 2021 04:23:39 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 64F7022A24C for ; Sun, 14 Feb 2021 04:23:38 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@nvidia.com) with SMTP; 14 Feb 2021 05:23:34 +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 11E3MYvS008525; Sun, 14 Feb 2021 05:23:33 +0200 From: Xueming Li To: Cc: dev@dpdk.org, Viacheslav Ovsiienko , xuemingl@nvidia.com, Asaf Penso , Bruce Richardson , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko Date: Sun, 14 Feb 2021 03:21:36 +0000 Message-Id: <1613272907-22563-7-git-send-email-xuemingl@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1613272907-22563-1-git-send-email-xuemingl@nvidia.com> References: <1613272907-22563-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 v6 6/9] ethdev: support multi-host in 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" The NIC can have multiple PCIe links and can be attached to the multiple hosts, for example the same single NIC can be shared for multiple server units in the rack. On each PCIe link NIC can provide multiple PFs and VFs/SFs based on these ones. To provide the unambiguous identification of the PCIe function the controller index is added. The full representor identifier consists of three indices - controller index, PF index, and VF or SF index (if any). This patch introduces controller index to 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. For user application (e.g. OVS), PMD is responsible to interpret and locate representor device based on controller ID, PF ID and VF/SF ID in representor syntax. Signed-off-by: Xueming Li Acked-by: Viacheslav Ovsiienko Acked-by: Thomas Monjalon Acked-by: Andrew Rybchenko --- config/rte_config.h | 1 + lib/librte_ethdev/ethdev_driver.h | 4 ++++ lib/librte_ethdev/ethdev_private.c | 25 +++++++++++++++++++++---- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/config/rte_config.h b/config/rte_config.h index 55a2fc50ed..904a40b3c1 100644 --- a/config/rte_config.h +++ b/config/rte_config.h @@ -57,6 +57,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_driver.h b/lib/librte_ethdev/ethdev_driver.h index d68b8401e7..06ff35266f 100644 --- a/lib/librte_ethdev/ethdev_driver.h +++ b/lib/librte_ethdev/ethdev_driver.h @@ -1222,6 +1222,10 @@ rte_eth_switch_domain_free(uint16_t domain_id); * One type of representor each structure. */ 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; diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c index eea0686020..5cd62de6f8 100644 --- a/lib/librte_ethdev/ethdev_private.c +++ b/lib/librte_ethdev/ethdev_private.c @@ -118,8 +118,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 * * Examples of #: * 2 - single @@ -131,6 +131,14 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) { struct rte_eth_devargs *eth_da = data; + if (str[0] == 'c') { + str += 1; + str = rte_eth_devargs_process_list(str, eth_da->mh_controllers, + ð_da->nb_mh_controllers, + RTE_DIM(eth_da->mh_controllers)); + if (str == NULL) + goto err; + } if (str[0] == 'p' && str[1] == 'f') { eth_da->type = RTE_ETH_REPRESENTOR_PF; str += 2; @@ -146,8 +154,9 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) eth_da->type = RTE_ETH_REPRESENTOR_SF; str += 2; } else { - /* Don't mix legacy syntax with 'pf' section. */ - if (eth_da->type == RTE_ETH_REPRESENTOR_PF) { + /* Don't mix legacy syntax with 'pf' and 'c' section. */ + if (eth_da->type == RTE_ETH_REPRESENTOR_PF || + eth_da->nb_mh_controllers > 0) { str = NULL; goto err; } @@ -156,6 +165,14 @@ rte_eth_devargs_parse_representor_ports(char *str, void *data) str = rte_eth_devargs_process_list(str, eth_da->representor_ports, ð_da->nb_representor_ports, RTE_DIM(eth_da->representor_ports)); + if (str == NULL) + goto err; + /* "pf" must sit in middle of "c" and "vf"/"sf". */ + if (eth_da->nb_representor_ports > 0 && eth_da->nb_mh_controllers > 0 && + eth_da->nb_ports == 0) { + RTE_LOG(ERR, EAL, "'pf' section missing: %s\n", str); + return -1; + } err: if (str == NULL) RTE_LOG(ERR, EAL, "wrong representor format: %s\n", str);