From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50065.outbound.protection.outlook.com [40.107.5.65]) by dpdk.org (Postfix) with ESMTP id 3F6DF1B764 for ; Mon, 9 Apr 2018 09:58:09 +0200 (CEST) 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=h8j6KbXvXve7jleYJrRzinOjxyyrj5Mf5b8wObdDA2w=; b=hq3ViaK1ErKZMI+zcqpCUA8ZFYugtq5EsTosJR237FUJ7a3Z2pt9KJm7aMx0CWLWLLqjYoQ0sA9701k5NGrmhBayslifMsuzyEVGszfLnbnFHM6y08+JE5YEupQqQ+ESMceSS85560U+XX3JHdp+DtcRkyaY70IKIJULaZCBpw0= Received: from AM4PR0501MB2657.eurprd05.prod.outlook.com (10.172.215.19) by AM4PR0501MB2786.eurprd05.prod.outlook.com (10.172.216.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.653.12; Mon, 9 Apr 2018 07:58:08 +0000 Received: from AM4PR0501MB2657.eurprd05.prod.outlook.com ([fe80::6885:c169:afcb:37e6]) by AM4PR0501MB2657.eurprd05.prod.outlook.com ([fe80::6885:c169:afcb:37e6%7]) with mapi id 15.20.0653.015; Mon, 9 Apr 2018 07:58:08 +0000 From: Matan Azrad To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v4 18/20] ethdev: register ether layer as a class Thread-Index: AQHTx6TZhRM1GUl2xUqbe/59GM6SN6P4GxAAgAADjoCAAAD/EA== Date: Mon, 9 Apr 2018 07:58:08 +0000 Message-ID: References: <06ec9fd8f884c6d3cffb8a24c0d9ac71d589812d.1522358422.git.gaetan.rivet@6wind.com> <20180409074705.p4y56y43ef2fszso@bidouze.vm.6wind.com> In-Reply-To: <20180409074705.p4y56y43ef2fszso@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; AM4PR0501MB2786; 7:xnC7O4uqSwJIDsHEZCnR0z6YzniBxQ6S4Qe1JNffUHxZeIzORIApwWaKfV5iOM2p7WllIDvSS/otPHAVo1Phf0ytO45lpN+G6ydRgxkS7gbvY8cCScMUAd/QBSSXB1f66filbC4NODbsdHbnqto10asorcQ2omUm7yLtRWgCIjlSmJ26s130FtYXjcNkUY8jvkmzNIEv3DWOAJk5ywrZzT+/SClrdVYXTUsfmJGIV2W09NceDwb3K0xAB5cskFte x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: f400d033-5641-49ea-289a-08d59defa1e4 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:AM4PR0501MB2786; x-ms-traffictypediagnostic: AM4PR0501MB2786: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(278428928389397); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231221)(944501327)(52105095)(93006095)(93001095)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123558120)(20161123564045)(6072148)(201708071742011); SRVR:AM4PR0501MB2786; BCL:0; PCL:0; RULEID:; SRVR:AM4PR0501MB2786; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39380400002)(396003)(39860400002)(366004)(376002)(346002)(199004)(189003)(6436002)(2906002)(3846002)(3660700001)(316002)(68736007)(55016002)(478600001)(33656002)(3280700002)(14454004)(305945005)(7696005)(476003)(74316002)(7736002)(446003)(11346002)(102836004)(76176011)(6506007)(186003)(26005)(4326008)(25786009)(105586002)(5660300001)(99286004)(66066001)(5250100002)(6116002)(106356001)(9686003)(229853002)(2900100001)(81166006)(81156014)(53936002)(86362001)(6916009)(486006)(8676002)(6246003)(8936002)(97736004)(93886005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM4PR0501MB2786; H:AM4PR0501MB2657.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: JhJ8rkKU3tt5qpkSF8dgZqionMZnMMs/WRFl7cPK6P/XNuJWIiPVnRVyb5++9lsL7D4A7ymyyviVlQ10yHPlUWL0JcxQdS4IBpxiJ1oIl19nEyAgxN4ZGzlaiThhEZcYngAG0jBrLSYwAHHCz9F9bAkA7ENw2s2noQTMLF6SXSY5g7l+ODmStfK1NYoTnrXw1+IEYad+1gXj5urd26303qV6Rf3AUTui98KO5wHAGoKyKg2RmnCbW5hMq7ZxklSXdHD/G+qJOfTYnLXSTrHFsEbxrih8CsIbszetNANi1SptZcuNudRTz2IRuYbB8cHPO8+QfkDGHBa57p7l8timAANsJ9mz/3PVhELwiHgT1vel4GIsMMdco2Rmj0m63y7kKewR56NfuVhyGNgV8luzOTNUlIivNrYiywc9cBX8ANQ= 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: f400d033-5641-49ea-289a-08d59defa1e4 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 07:58:08.0840 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM4PR0501MB2786 Subject: Re: [dpdk-dev] [PATCH v4 18/20] ethdev: register ether layer as a class 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: Mon, 09 Apr 2018 07:58:09 -0000 Hi Gaetan From: Ga=EBtan Rivet, Monday, April 9, 2018 10:47 AM > Hi Matan, >=20 > On Mon, Apr 09, 2018 at 07:41:58AM +0000, Matan Azrad wrote: > > Hi Gaetan > > > > From: Gaetan Rivet, Friday, March 30, 2018 12:24 AM > > > Signed-off-by: Gaetan Rivet > > > --- > > > lib/Makefile | 2 +- > > > lib/librte_ether/Makefile | 3 +- > > > lib/librte_ether/rte_class_eth.c | 73 > > > ++++++++++++++++++++++++++++++++++++++++ > > > 3 files changed, 76 insertions(+), 2 deletions(-) create mode > > > 100644 lib/librte_ether/rte_class_eth.c > > > > > > diff --git a/lib/Makefile b/lib/Makefile index 4206485d3..47513f03f > > > 100644 > > > --- a/lib/Makefile > > > +++ b/lib/Makefile > > > @@ -23,7 +23,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) +=3D > > > librte_cmdline DEPDIRS-librte_cmdline :=3D librte_eal > > > DIRS-$(CONFIG_RTE_LIBRTE_ETHER) +=3D librte_ether > > > DEPDIRS-librte_ether :=3D librte_net librte_eal librte_mempool > > > librte_ring -DEPDIRS-librte_ether +=3D librte_mbuf > > > +DEPDIRS-librte_ether +=3D librte_mbuf librte_kvargs > > > DIRS-$(CONFIG_RTE_LIBRTE_BBDEV) +=3D librte_bbdev DEPDIRS- > > > librte_bbdev :=3D librte_eal librte_mempool librte_mbuf > > > DIRS-$(CONFIG_RTE_LIBRTE_CRYPTODEV) +=3D librte_cryptodev diff --git > > > a/lib/librte_ether/Makefile b/lib/librte_ether/Makefile index > > > 3ca5782bb..a1a0393de 100644 > > > --- a/lib/librte_ether/Makefile > > > +++ b/lib/librte_ether/Makefile > > > @@ -12,13 +12,14 @@ CFLAGS +=3D -DALLOW_EXPERIMENTAL_API > CFLAGS > > > +=3D -O3 CFLAGS +=3D $(WERROR_FLAGS) LDLIBS +=3D -lrte_net -lrte_ea= l - > > > lrte_mempool -lrte_ring -LDLIBS +=3D -lrte_mbuf > > > +LDLIBS +=3D -lrte_mbuf -lrte_kvargs > > > > > > EXPORT_MAP :=3D rte_ethdev_version.map > > > > > > LIBABIVER :=3D 8 > > > > > > SRCS-y +=3D rte_ethdev.c > > > +SRCS-y +=3D rte_class_eth.c > > > SRCS-y +=3D rte_flow.c > > > SRCS-y +=3D rte_tm.c > > > SRCS-y +=3D rte_mtr.c > > > diff --git a/lib/librte_ether/rte_class_eth.c > > > b/lib/librte_ether/rte_class_eth.c > > > new file mode 100644 > > > index 000000000..97d24781d > > > --- /dev/null > > > +++ b/lib/librte_ether/rte_class_eth.c > > > @@ -0,0 +1,73 @@ > > > +/* SPDX-License-Identifier: BSD-3-Clause > > > + * Copyright(c) 2018 Ga=EBtan Rivet > > > + */ > > > + > > > +#include > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include "rte_ethdev.h" > > > +#include "rte_ethdev_core.h" > > > + > > > +enum eth_params { > > > + RTE_ETH_PARAMS_MAX, > > > +}; > > > + > > > +static const char *eth_params_keys[] =3D { > > > + [RTE_ETH_PARAMS_MAX] =3D NULL, > > > +}; > > > + > > > +static int > > > +eth_dev_match(struct rte_eth_dev *edev, > > > + struct rte_kvargs *kvlist) > > > +{ > > > + (void) kvlist; > > > + (void) edev; > > > + return 0; > > > +} > > > + > > > +static void * > > > +eth_dev_iterate(const void *_start, > > > + const char *str, > > > + const struct rte_dev_iterator *it) { > > > + const struct rte_eth_dev *start =3D _start; > > > + struct rte_device *dev =3D it->device; > > > + struct rte_kvargs *kvargs =3D NULL; > > > + struct rte_eth_dev *edev =3D NULL; > > > + uint16_t p =3D 0; > > > + > > > + if (str !=3D NULL) { > > > + kvargs =3D rte_kvargs_parse(str, eth_params_keys); > > > + if (kvargs =3D=3D NULL) { > > > + RTE_LOG(ERR, EAL, "cannot parse argument list\n"); > > > + rte_errno =3D EINVAL; > > > + return NULL; > > > + } > > > + } > > > + if (start) > > > + p =3D start->data->port_id + 1; > > > + for (p =3D rte_eth_find_next(p); > > > + p < RTE_MAX_ETHPORTS; > > > + p =3D rte_eth_find_next(p + 1)) { > > > > What are about differed\owned\bonded devices? > > What is actually the use cases of this iterator? > > DPDK internal management or applications? > > >=20 > This API is public, so anyone can use it. > It should be primarily used by internal systems however. > I do not think Applications would be interested in calling the dev_iterat= e ops. >=20 > The EAL would provide a way to list interfaces from each layers. Then DPD= K > libraries (such as librte_ether) would translate this following their int= ernal > rules. librte_ether would thus for example here translate an rte_eth_dev > handle to a port_id, that an application could use. If there was a need t= o filter > by owner_id, then it would be the job of librte_ether. >=20 > The EAL cannot keep track of layers specifics, it can only provide generi= c APIs. This is exactly what I'm asking, what is the right behavior here? Now, The code is skipping DEFFERED devices but iterating over owned\bonded = devices. Looks like any USED port should be iterated... Moreover, looks like there is chance to iterate over EAL device more than 1= time for loop, Is it OK? > > > + edev =3D &rte_eth_devices[p]; > > > + if (dev !=3D edev->device) > > > + goto next_ethdev; > > > + if (eth_dev_match(edev, kvargs) =3D=3D 0) > > > + break; > > > +next_ethdev: > > > + edev =3D NULL; > > > + } > > > + rte_kvargs_free(kvargs); > > > + return edev; > > > +} > > > + > > > +struct rte_class rte_class_eth =3D { > > > + .dev_iterate =3D eth_dev_iterate, > > > +}; > > > + > > > +RTE_REGISTER_CLASS(eth, rte_class_eth); > > > -- > > > 2.11.0 > > >=20 > -- > Ga=EBtan Rivet > 6WIND