From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60057.outbound.protection.outlook.com [40.107.6.57]) by dpdk.org (Postfix) with ESMTP id ABFFD199AC for ; Tue, 16 Jan 2018 13:27:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=yZS543nmdx47KL2t1oHRZvYiKKp+4ET/nwiLMxi7FSY=; b=QvcQKm1+2kJocG57B2uL5EViqY7LAvCvdtGQcdcTL39BeElXWuACbBkP53YmBd4xjd4LQIQyTNxdcZ/Wn8ddhS4DTZxhfUUjKC6PyRhVQX0NqOoFYq2iGnjmiVI0Oa+gr7tI1OIqMAzPp8SFiNmIOM/n4BJri5fUasMUp0feM28= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.21.26) by AM6PR0502MB3959.eurprd05.prod.outlook.com (52.133.30.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Tue, 16 Jan 2018 12:27:57 +0000 Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::6c28:c6b3:de94:a733]) by AM6PR0502MB3797.eurprd05.prod.outlook.com ([fe80::6c28:c6b3:de94:a733%13]) with mapi id 15.20.0407.012; Tue, 16 Jan 2018 12:27:57 +0000 From: Matan Azrad To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: Ferruh Yigit , Thomas Monjalon , "dev@dpdk.org" , "stephen@networkplumber.org" Thread-Topic: [PATCH v3 3/8] net/failsafe: support probed sub-devices getting Thread-Index: AQHTjrp/VHV3LzKwTE6Nrr2gSXYAm6N2Z8DQ Date: Tue, 16 Jan 2018 12:27:57 +0000 Message-ID: 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> <20180116110920.vqp3bqjroudsdjm4@bidouze.vm.6wind.com> In-Reply-To: <20180116110920.vqp3bqjroudsdjm4@bidouze.vm.6wind.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-originating-ip: [193.47.165.251] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0502MB3959; 7:aSwn8KIHwgIpc/JYVbTuVl77Ovx8AfzeFz8uABEGrU2YdQ6mmIrusrfcBwImY6N/D9UEIdLJiuCwV3QPli21sTVjj7CoX/YmiaKremaIv++HJCOo51worjImfKQCWKCs3UGxUObvwmFSC5ZVwwr/6evfS6QXUiDFGeVGvBibitofhRNACzdNWZvmnaUE6wLk8LTPOUZGyyodqcD+UpllC0UDR+3HpoKBDQocQMAOiLTsD97ZBOIk0e3sM8hY2U2I x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: d2931238-f00a-40c7-84f0-08d55cdc9300 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3959; x-ms-traffictypediagnostic: AM6PR0502MB3959: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231023)(944501161)(10201501046)(6055026)(6041268)(20161123558120)(20161123560045)(20161123564045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:AM6PR0502MB3959; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3959; x-forefront-prvs: 0554B1F54F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(39380400002)(376002)(366004)(346002)(76104003)(24454002)(189003)(199004)(106356001)(81156014)(3660700001)(93886005)(5660300001)(33656002)(68736007)(478600001)(229853002)(2950100002)(3280700002)(86362001)(97736004)(7736002)(14454004)(6916009)(26005)(8936002)(54906003)(316002)(81166006)(8676002)(53936002)(66066001)(99286004)(55016002)(3846002)(76176011)(7696005)(59450400001)(102836004)(6436002)(9686003)(2900100001)(74316002)(305945005)(6116002)(6506007)(2906002)(4326008)(105586002)(25786009)(6246003)(5250100002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3959; H:AM6PR0502MB3797.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: WKHoS1dmzyvY+TxtPhyzk6EfvFuskprCQo5Z4Vpo4gRTGqovMxHRkONFu0yDgEBBfLPjSenToqRHm7JquRDS1g== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2931238-f00a-40c7-84f0-08d55cdc9300 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jan 2018 12:27:57.1013 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3959 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 12:27:58 -0000 Hi Gaetan From: Ga=EBtan Rivet, Tuesday, January 16, 2018 1:09 PM > Hi Matan, >=20 > I'n not fond of the commit title, how about: >=20 > [PATCH v3 3/8] net/failsafe: add probed etherdev capture >=20 > ? >=20 OK, no problem. > 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 t= ake 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) >=20 > The naming convention for the failsafe driver is >=20 > namespace_object_sub-object_action() >=20 OK. > With an ordering of objects by their scope (std, rte, failsafe, file). > Also, "get" as an action is not descriptive enough. >=20 Isn't "get by device name" descriptive?=20 > static int > fs_ethdev_capture(const char *name, uint16_t *port_id); >=20 You miss here the main reason why we need this function instead of using rt= e_eth_dev_get_port_by_name. The reason we need this function is because we want to find the device by t= he device name and not ethdev name. What's about fs_port_capture_by_device_name? Maybe comparing it to device->devargs->name is better, What do you think? > > +{ > > + uint16_t pid; > > + size_t len; > > + > > + if (name =3D=3D NULL) { > > + DEBUG("Null pointer is specified\n"); > > + return -EINVAL; > > + } > > + len =3D strlen(name); > > + RTE_ETH_FOREACH_DEV(pid) { > > + if (!strncmp(name, rte_eth_devices[pid].device->name, > len)) { > > + *port_id =3D 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 !=3D DEV_PARSED) > > continue; > > da =3D &sdev->devargs; > > - ret =3D 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) =3D=3D 0) { > > - ETH(sdev) =3D &rte_eth_devices[j]; > > - break; > > + if (fs_get_port_by_device_name(da->name, &pid) !=3D 0) { > > + ret =3D 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) > !=3D 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); >=20 > 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. >=20 > 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). >=20 > 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. >=20 Got you. You right we need to remove the created devargs in fail-safe parse= level. What do you think about checking it in the parse level and avoid the new de= vargs creation? Also to do the copy in parse level(same method as we are doing in probe lev= el)? > -- > Ga=EBtan Rivet > 6WIND