From mboxrd@z Thu Jan 1 00:00:00 1970 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 42C1512009 for ; Tue, 16 Jan 2018 12:09:34 +0100 (CET) Received: by mail-wm0-f66.google.com with SMTP id 141so7709194wme.3 for ; Tue, 16 Jan 2018 03:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=cOFxYoKLL/B+5A51SJCoxhggs8mRf42ovgpW35WM5GQ=; b=dtoIMiqtyt2jPv0B5tIqcMeMFew9srGL8q341CNe8/oC97ZfPritvFrVPVYB605PJ1 5HwRg/L45E3pZWWSxRrB3CMgrME4i5FhtzB5sfL16nJJgL3hj0ONomzNJVe9AWomG/Ry o7bNeNMIKN1sbxbTm+CUomixFSJEykx4IUxi3BrnAWsBj3Lcj71I8NYg8Lx7ozMSzGST J9c+uv0ZrQVugq1HLFS/CFfJCiAhjjq9rsDOjLtYVyxhh6RN30tB0CWiJpVERD09X16s SO75Ob7VNY963rz1wkw9GZkEKG881+Nh+9bT6ylHOFzqVzwJkNG03ptO1uhXomVnRtNu TY9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=cOFxYoKLL/B+5A51SJCoxhggs8mRf42ovgpW35WM5GQ=; b=P1Lau9DjMomNwK51pLZ+EDC79Pin6lJJQWpQ9zPcySEk7BLyDnBxWwPyDkk5bsoMpb Egw7r2eQRbfrDXhvohouonxFkXCuUX57zKVw8FDBw5qroF2ied5RxCOT2GQnBt3V8qH6 yDh3hvgU+mlxy24000Dto7i0DT99JPl480zxk5fxB5kxcikWO88QPFtARlCRIIlBxqAB gnHxpLAy4+x1UMJyGUnY4kCY9nPTNaSEnuDdytL+0wVNQu66AksgMFEPBu+LJMnp89hT EEZoJ+L0hS9RJIclNfuhz8eh9fwKRe1XAWqD0oAplE0nv1nL1m/ATXWAtAtygcdjGprQ Vafw== X-Gm-Message-State: AKwxytcmTe2ga2hfrYaTKvL3pxJ6aU31htBWnP7BABemR31EibQ6hrVd WBuGICOtTwVy+xqL5jF7vF26Sw== X-Google-Smtp-Source: ACJfBosizaukh3fvHM/fuBgwAClQJwaQuV2UASoQ0qiTTHSTP15FwgEiQ0qNqKQns9+J0UQjkv/zwA== X-Received: by 10.80.230.12 with SMTP id y12mr2667036edm.203.1516100973680; Tue, 16 Jan 2018 03:09:33 -0800 (PST) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id t19sm1301183edh.49.2018.01.16.03.09.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 16 Jan 2018 03:09:32 -0800 (PST) Date: Tue, 16 Jan 2018 12:09:20 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Matan Azrad Cc: Ferruh Yigit , Thomas Monjalon , dev@dpdk.org, stephen@networkplumber.org Message-ID: <20180116110920.vqp3bqjroudsdjm4@bidouze.vm.6wind.com> References: <20171222173846.20731-1-adrien.mazarguil@6wind.com> <1515509253-17834-1-git-send-email-matan@mellanox.com> <1515509253-17834-4-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1515509253-17834-4-git-send-email-matan@mellanox.com> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [dpdk-dev] [PATCH v3 3/8] net/failsafe: support probed sub-devices getting X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Jan 2018 11:09:34 -0000 Hi Matan, I'n not fond of the commit title, how about: [PATCH v3 3/8] net/failsafe: add probed etherdev capture ? On Tue, Jan 09, 2018 at 02:47:28PM +0000, Matan Azrad wrote: > Previous fail-safe code didn't support getting probed sub-devices and > failed when it tried to probe them. > > Skip fail-safe sub-device probing when it already was probed. > > Signed-off-by: Matan Azrad > Cc: Gaetan Rivet > --- > doc/guides/nics/fail_safe.rst | 5 ++++ > drivers/net/failsafe/failsafe_eal.c | 60 ++++++++++++++++++++++++------------- > 2 files changed, 45 insertions(+), 20 deletions(-) > > diff --git a/doc/guides/nics/fail_safe.rst b/doc/guides/nics/fail_safe.rst > index 5b1b47e..b89e53b 100644 > --- a/doc/guides/nics/fail_safe.rst > +++ b/doc/guides/nics/fail_safe.rst > @@ -115,6 +115,11 @@ Fail-safe command line parameters > order to take only the last line into account (unlike ``exec()``) at every > probe attempt. > > +.. note:: > + > + In case of whitelist sub-device probed by EAL, fail-safe PMD will take the device > + as is, which means that EAL device options are taken in this case. > + > - **mac** parameter [MAC address] > > This parameter allows the user to set a default MAC address to the fail-safe > diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c > index 19d26f5..7bc7453 100644 > --- a/drivers/net/failsafe/failsafe_eal.c > +++ b/drivers/net/failsafe/failsafe_eal.c > @@ -36,39 +36,59 @@ > #include "failsafe_private.h" > > static int > +fs_get_port_by_device_name(const char *name, uint16_t *port_id) The naming convention for the failsafe driver is namespace_object_sub-object_action() With an ordering of objects by their scope (std, rte, failsafe, file). Also, "get" as an action is not descriptive enough. static int fs_ethdev_capture(const char *name, uint16_t *port_id); > +{ > + uint16_t pid; > + size_t len; > + > + if (name == NULL) { > + DEBUG("Null pointer is specified\n"); > + return -EINVAL; > + } > + len = strlen(name); > + RTE_ETH_FOREACH_DEV(pid) { > + if (!strncmp(name, rte_eth_devices[pid].device->name, len)) { > + *port_id = pid; > + return 0; > + } > + } > + return -ENODEV; > +} > + > +static int > fs_bus_init(struct rte_eth_dev *dev) > { > struct sub_device *sdev; > struct rte_devargs *da; > uint8_t i; > - uint16_t j; > + uint16_t pid; > int ret; > > FOREACH_SUBDEV(sdev, i, dev) { > if (sdev->state != DEV_PARSED) > continue; > da = &sdev->devargs; > - ret = rte_eal_hotplug_add(da->bus->name, > - da->name, > - da->args); > - if (ret) { > - ERROR("sub_device %d probe failed %s%s%s", i, > - rte_errno ? "(" : "", > - rte_errno ? strerror(rte_errno) : "", > - rte_errno ? ")" : ""); > - continue; > - } > - RTE_ETH_FOREACH_DEV(j) { > - if (strcmp(rte_eth_devices[j].device->name, > - da->name) == 0) { > - ETH(sdev) = &rte_eth_devices[j]; > - break; > + if (fs_get_port_by_device_name(da->name, &pid) != 0) { > + ret = rte_eal_hotplug_add(da->bus->name, > + da->name, > + da->args); > + if (ret) { > + ERROR("sub_device %d probe failed %s%s%s", i, > + rte_errno ? "(" : "", > + rte_errno ? strerror(rte_errno) : "", > + rte_errno ? ")" : ""); > + continue; > } > + if (fs_get_port_by_device_name(da->name, &pid) != 0) { > + ERROR("sub_device %d init went wrong", i); > + return -ENODEV; > + } > + } else { > + /* Take control of device probed by EAL options. */ > + DEBUG("Taking control of a probed sub device" > + " %d named %s", i, da->name); In this case, the devargs of the probed device must be copied within the sub-device definition and removed from the EAL using the proper rte_devargs API. Note that there is no rte_devargs copy function. You can use rte_devargs_parse instead, "parsing" again the original devargs into the sub-device one. It is necessary for complying with internal rte_devargs requirements (da->args being malloc-ed, at the moment, but may evolve). The rte_eal_devargs_parse function is not easy enough to use right now, you will have to build a devargs string (using snprintf) and submit it. I proposed a change this release for it but it will not make it for 18.02, that would have simplified your implementation. -- Gaëtan Rivet 6WIND