From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adrien Mazarguil Subject: Re: [PATCH v4 09/10] net/mlx5: add parameter for port representors Date: Tue, 10 Jul 2018 12:58:23 +0200 Message-ID: <20180710105823.GM5211@6wind.com> References: <20180704172322.22571-1-adrien.mazarguil@6wind.com> <20180705083934.5535-1-adrien.mazarguil@6wind.com> <20180705083934.5535-10-adrien.mazarguil@6wind.com> <20180710093723.GI5211@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "dev@dpdk.org" To: Shahaf Shuler Return-path: Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by dpdk.org (Postfix) with ESMTP id CE9191B009 for ; Tue, 10 Jul 2018 12:58:39 +0200 (CEST) Received: by mail-wm0-f66.google.com with SMTP id 69-v6so23710545wmf.3 for ; Tue, 10 Jul 2018 03:58:39 -0700 (PDT) Content-Disposition: inline In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, Jul 10, 2018 at 10:16:03AM +0000, Shahaf Shuler wrote: > Tuesday, July 10, 2018 12:37 PM, Adrien Mazarguil: > > Subject: Re: [PATCH v4 09/10] net/mlx5: add parameter for port > > representors > > > > On Mon, Jul 09, 2018 at 11:57:37AM +0000, Shahaf Shuler wrote: > > > Thursday, July 5, 2018 11:46 AM, Adrien Mazarguil: > > > > Subject: [PATCH v4 09/10] net/mlx5: add parameter for port > > > > representors > > > > > > > > Prior to this patch, all port representors detected on a given > > > > device were probed and Ethernet devices instantiated for each of them. > > > > > > > > This patch adds support for the standard "representor" parameter, > > > > which implies that port representors are not probed by default > > > > anymore, except for the list provided through device arguments. > > > > > > > > (Patch based on prior work from Yuanhan Liu) > > > > > > > > Signed-off-by: Adrien Mazarguil > > > > Reviewed-by: Xueming Li > > > > -- > > > > v3 changes: > > > > > > > > - Adapted representor detection to the reworked mlx5_dev_spawn(). > > > > > > @@ -672,7 +679,9 @@ mlx5_uar_init_secondary(struct rte_eth_dev > > *dev) > > > > * > > > > * @return > > > > * A valid Ethernet device object on success, NULL otherwise and > > rte_errno > > > > - * is set. > > > > + * is set. The following error is defined: > > > > + * > > > > + * EBUSY: device is not supposed to be spawned. > > > > */ > > > > static struct rte_eth_dev * > > > > mlx5_dev_spawn(struct rte_device *dpdk_dev, @@ -723,6 +732,26 @@ > > > > mlx5_dev_spawn(struct rte_device *dpdk_dev, > > > > int own_domain_id = 0; > > > > unsigned int i; > > > > > > > > + /* Determine if this port representor is supposed to be spawned. */ > > > > + if (switch_info->representor && dpdk_dev->devargs) { > > > > + struct rte_eth_devargs eth_da; > > > > + > > > > + err = rte_eth_devargs_parse(dpdk_dev->devargs->args, > > > > ð_da); > > > > + if (err) { > > > > + rte_errno = -err; > > > > + DRV_LOG(ERR, "failed to process device arguments: > > > > %s", > > > > + strerror(rte_errno)); > > > > + return NULL; > > > > + } > > > > + for (i = 0; i < eth_da.nb_representor_ports; ++i) > > > > + if (eth_da.representor_ports[i] == > > > > + (uint16_t)switch_info->port_name) > > > > + break; > > > > + if (i == eth_da.nb_representor_ports) { > > > > + rte_errno = EBUSY; > > > > > > Why EBUSY is the correct errno? Will another attempts to probe the device > > can be successful? > > > > That's the definition of EAGAIN :) > > > > I thought EBUSY in the sense of "don't disturb" would be appropriate. This > > value was also chosen because it is not likely to be returned by any > > intermediate function calls. I've defined EBUSY along with the return value of > > this function for clarity (see above). Any suggestion? > > How about ENODEV ? Already used by many internal functions, typically returned if the associated netdevice doesn't exist (e.g. sent to another netns; a fatal error when probing representors). We need a unique error code that says "OK, no problem, just not this one". -- Adrien Mazarguil 6WIND