From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2543DA0A03; Mon, 18 Jan 2021 16:44:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E1421140FA3; Mon, 18 Jan 2021 16:44:24 +0100 (CET) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by mails.dpdk.org (Postfix) with ESMTP id 2745B140F90 for ; Mon, 18 Jan 2021 16:44:24 +0100 (CET) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.west.internal (Postfix) with ESMTP id 1A0E617EA; Mon, 18 Jan 2021 10:44:22 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 18 Jan 2021 10:44:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm3; bh= N495U9uNQ8EpSHnC7xL3BHsBuVvW0UGYCWqZEJ4z1sk=; b=tDKXnXGoRGysPBiz wtuNlkehkHC82ge2wcbatrOJ9oXylpHAwV1RUZc6ekcbZtFIw8LvqYHskHsVy2vZ mAFaKMmeGn7+pWaWCbAZekAK74DF8XUGcL5l8lqad1jpYUMws6iR6Bc3DPsQnw4M mmjeQMQ95NRuBnHL2yKFoNvNW0woG3v/L9vRyJoPiX4DmeoXRPOpBJH6Sx2fsVul aR5WhTQubAI0S/yK6wUjKUrmEDlJNnfO2Rpo4KxjAYS2wWwL67/6WS+Ee47Fc31Z Zotk/0OPixOxc5eFk7KY0+g+MhaVb7/KYQ4rI4rF1uFx4sgs3Z1P8kU2ZvuXPAav iC9zfw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=N495U9uNQ8EpSHnC7xL3BHsBuVvW0UGYCWqZEJ4z1 sk=; b=Iv/MgBJCZoItfJDqSjZRRPv4mOSPFt89mEczhpvZGcQ8NtP9MkMeYsYzy steJ4elpa8JzoQRp/yAbc4+yd7OjM54KvGQTQl0hHf43eW0zLYOEMavfGE9vbu0J xQ7CNeO2MxPshHpPAaTatPbesYxZ+L6hxW0uhh6jvHtBRU+BNFJmhKI2dD9QjyL8 adbyEHtkzE4gpdAoxRM4XSJcZOFxb76sXibua50yleeQPh5u9MV9ivlIx0dWTnOl VgpjmYnoLoe0nQ+HSgyxrj8iAaJ3QgLtJHHsZBFEMf+FyMZyL4YgCN2vqapcO4vi HXfsvLPv1aq1Qn+xnX3VVn+af1Qlw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrtdekgdekudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 2E16E24005D; Mon, 18 Jan 2021 10:44:19 -0500 (EST) From: Thomas Monjalon To: Xueming Li Cc: Ferruh Yigit , Andrew Rybchenko , Olivier Matz , dev@dpdk.org, Viacheslav Ovsiienko , Asaf Penso , Somnath Kotur , Ajit Khaparde , John Daley , Hyong Youb Kim , Beilei Xing , Jeff Guo , Haiyue Wang Date: Mon, 18 Jan 2021 16:44:17 +0100 Message-ID: <5771161.h7pXTAYHk9@thomas> In-Reply-To: <1610968623-31345-2-git-send-email-xuemingl@nvidia.com> References: <1610968623-31345-1-git-send-email-xuemingl@nvidia.com> <1610968623-31345-2-git-send-email-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v4 1/9] ethdev: introduce representor type 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" +Cc more maintainers 18/01/2021 12:16, Xueming Li: > To support more representor type, this patch introduces representor type > enum. The enum is subject to extend for new types upcoming. > > Signed-off-by: Xueming Li > Acked-by: Viacheslav Ovsiienko > --- > drivers/net/bnxt/bnxt_ethdev.c | 7 +++++++ > drivers/net/enic/enic_ethdev.c | 7 +++++++ > drivers/net/i40e/i40e_ethdev.c | 8 ++++++++ > drivers/net/ixgbe/ixgbe_ethdev.c | 8 ++++++++ > drivers/net/mlx5/linux/mlx5_os.c | 11 +++++++++++ > lib/librte_ethdev/ethdev_private.c | 5 +++++ > lib/librte_ethdev/rte_ethdev_driver.h | 9 +++++++++ > 7 files changed, 55 insertions(+) > > diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c > index 74b0f3d1dc..d7c8b3ec07 100644 > --- a/drivers/net/bnxt/bnxt_ethdev.c > +++ b/drivers/net/bnxt/bnxt_ethdev.c > @@ -5586,6 +5586,13 @@ static int bnxt_rep_port_probe(struct rte_pci_device *pci_dev, > int i, ret = 0; > struct rte_kvargs *kvlist = NULL; > > + if (eth_da->type == RTE_ETH_REPRESENTOR_NONE) > + return 0; > + if (eth_da->type != RTE_ETH_REPRESENTOR_VF) { > + PMD_DRV_LOG(ERR, "unsupported representor type %d\n", > + eth_da->type); > + return -ENOTSUP; > + } > num_rep = eth_da->nb_representor_ports; > if (num_rep > BNXT_MAX_VF_REPS) { > PMD_DRV_LOG(ERR, "nb_representor_ports = %d > %d MAX VF REPS\n", > diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c > index d041a6bee9..dd085caa93 100644 > --- a/drivers/net/enic/enic_ethdev.c > +++ b/drivers/net/enic/enic_ethdev.c > @@ -1303,6 +1303,13 @@ static int eth_enic_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > if (retval) > return retval; > } > + if (eth_da.type == RTE_ETH_REPRESENTOR_NONE) > + return 0; > + if (eth_da.type != RTE_ETH_REPRESENTOR_VF) { > + ENICPMD_LOG(ERR, "unsupported representor type: %s\n", > + pci_dev->device.devargs->args); > + return -ENOTSUP; > + } > retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, > sizeof(struct enic), > eth_dev_pci_specific_init, pci_dev, > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c > index c1c2327b3f..3cea6de2bd 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -638,6 +638,14 @@ eth_i40e_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > return retval; > } > > + if (eth_da.type == RTE_ETH_REPRESENTOR_NONE) > + return 0; > + if (eth_da.type != RTE_ETH_REPRESENTOR_VF) { > + PMD_DRV_LOG(ERR, "unsupported representor type: %s\n", > + pci_dev->device.devargs->args); > + return -ENOTSUP; > + } > + > retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, > sizeof(struct i40e_adapter), > eth_dev_pci_specific_init, pci_dev, > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c > index d7a1806ab8..eb2c4929e2 100644 > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > @@ -1717,6 +1717,14 @@ eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, > } else > memset(ð_da, 0, sizeof(eth_da)); > > + if (eth_da.type == RTE_ETH_REPRESENTOR_NONE) > + return 0; > + if (eth_da.type != RTE_ETH_REPRESENTOR_VF) { > + PMD_DRV_LOG(ERR, "unsupported representor type: %s\n", > + pci_dev->device.devargs->args); > + return -ENOTSUP; > + } > + > retval = rte_eth_dev_create(&pci_dev->device, pci_dev->device.name, > sizeof(struct ixgbe_adapter), > eth_dev_pci_specific_init, pci_dev, > diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c > index 9ac1d46b1b..caead107b0 100644 > --- a/drivers/net/mlx5/linux/mlx5_os.c > +++ b/drivers/net/mlx5/linux/mlx5_os.c > @@ -705,6 +705,17 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, > strerror(rte_errno)); > return NULL; > } > + if (eth_da.type != RTE_ETH_REPRESENTOR_NONE) { > + /* Representor not specified. */ > + rte_errno = EBUSY; > + return NULL; > + } > + if (eth_da.type != RTE_ETH_REPRESENTOR_VF) { > + rte_errno = ENOTSUP; > + DRV_LOG(ERR, "unsupported representor type: %s", > + dpdk_dev->devargs->args); > + return NULL; > + } > for (i = 0; i < eth_da.nb_representor_ports; ++i) > if (eth_da.representor_ports[i] == > (uint16_t)switch_info->port_name) > diff --git a/lib/librte_ethdev/ethdev_private.c b/lib/librte_ethdev/ethdev_private.c > index 162a502fe7..c1a411dba4 100644 > --- a/lib/librte_ethdev/ethdev_private.c > +++ b/lib/librte_ethdev/ethdev_private.c > @@ -111,11 +111,16 @@ rte_eth_devargs_process_range(char *str, uint16_t *list, uint16_t *len_list, > return 0; > } > > +/* > + * representor format: > + * #: range or single number of VF representor > + */ > int > rte_eth_devargs_parse_representor_ports(char *str, void *data) > { > struct rte_eth_devargs *eth_da = data; > > + eth_da->type = RTE_ETH_REPRESENTOR_VF; > return rte_eth_devargs_process_range(str, eth_da->representor_ports, > ð_da->nb_representor_ports, RTE_MAX_ETHPORTS); > } > diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h > index 0eacfd8425..3bc5c5bbbb 100644 > --- a/lib/librte_ethdev/rte_ethdev_driver.h > +++ b/lib/librte_ethdev/rte_ethdev_driver.h > @@ -1193,6 +1193,14 @@ __rte_internal > int > rte_eth_switch_domain_free(uint16_t domain_id); > > +/** Ethernet device representor type */ > +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. */ > + RTE_ETH_REPRESENTOR_PF, /**< representor of host PF. */ > +}; > + > /** Generic Ethernet device arguments */ > struct rte_eth_devargs { > uint16_t ports[RTE_MAX_ETHPORTS]; > @@ -1203,6 +1211,7 @@ struct rte_eth_devargs { > /** representor port/s identifier to enable on device */ > uint16_t nb_representor_ports; > /** number of ports in representor port field */ > + enum rte_eth_representor_type type; /* type of representor */ > };