From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <matan@mellanox.com>
Received: from EUR03-AM5-obe.outbound.protection.outlook.com
 (mail-eopbgr30080.outbound.protection.outlook.com [40.107.3.80])
 by dpdk.org (Postfix) with ESMTP id 21BB62BF5
 for <dev@dpdk.org>; Mon,  8 Jan 2018 15:42:39 +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=GbX78ICbb04deQ4hoXxib1UNAhKzOlRr4ki4HumnlHo=;
 b=Tl9kBlPpsV024Lb54IZRSZAOq3fSzl8LA4R1YnsIy93z8pq8/EdOH6LYiodfonD4XllarLeZuo9GHnnU+BQah6oTwtvg2Qw8u+9jItiLfxCoOCY3m2lGVb9Bdqgzz0y8Xp4Q0zF1Ynmzu8Xo/neY9bnftOsVOX6xCgy84oopnzo=
Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.21.26) by
 AM6PR0502MB3799.eurprd05.prod.outlook.com (52.133.21.28) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id
 15.20.386.5; Mon, 8 Jan 2018 14:42:31 +0000
Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com
 ([fe80::b4b4:7de8:cf70:aa3a]) by AM6PR0502MB3797.eurprd05.prod.outlook.com
 ([fe80::b4b4:7de8:cf70:aa3a%13]) with mapi id 15.20.0386.006; Mon, 8 Jan 2018
 14:42:31 +0000
From: Matan Azrad <matan@mellanox.com>
To: =?iso-8859-1?Q?Ga=EBtan_Rivet?= <gaetan.rivet@6wind.com>
CC: Thomas Monjalon <thomas@monjalon.net>, Jingjing Wu
 <jingjing.wu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>, Neil Horman
 <nhorman@tuxdriver.com>, Bruce Richardson <bruce.richardson@intel.com>,
 Konstantin Ananyev <konstantin.ananyev@intel.com>
Thread-Topic: [PATCH v2 6/6] app/testpmd: adjust ethdev port ownership
Thread-Index: AQHTiHVt5VPixrMnKUK3vfdVuXmfmKNp4uPQgAAV1ICAAAEJkIAADViAgAACDGA=
Date: Mon, 8 Jan 2018 14:42:31 +0000
Message-ID: <AM6PR0502MB37977808A51AE0C6CF9A9A80D2130@AM6PR0502MB3797.eurprd05.prod.outlook.com>
References: <1511870281-15282-1-git-send-email-matan@mellanox.com>
 <1515318351-4756-1-git-send-email-matan@mellanox.com>
 <1515318351-4756-7-git-send-email-matan@mellanox.com>
 <20180108113946.hcgxvulamjsiepre@bidouze.vm.6wind.com>
 <AM6PR0502MB3797EFC9EC2B126565450826D2130@AM6PR0502MB3797.eurprd05.prod.outlook.com>
 <20180108133015.an547uygefjz5gj4@bidouze.vm.6wind.com>
 <AM6PR0502MB3797EF9DFEAFEFBD15F6BE89D2130@AM6PR0502MB3797.eurprd05.prod.outlook.com>
 <20180108142143.nk6c6l64nqnurfhz@bidouze.vm.6wind.com>
In-Reply-To: <20180108142143.nk6c6l64nqnurfhz@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; AM6PR0502MB3799;
 7:kEgJM2VF7ORg9Db5Mu2DhiKrMXPj8YsmaJypCcZ3tItrLS9mVh5SzdoZfVDhsdh7YM5k67p+pbkzgnMbLXap1mpY4GmJWUTLdf9bdaIWKOci+fxFM+PZpyM8S4Ijtc9Mo50ZYtiAshopwLCoL5Vppi3Q1MdrpcoJpp2GD4pMnlRHTe++XissoilRd7CwFMDJqCQaWqt4zpLKVaCUxRalGFfev2eDJvWIomZUo3uCfF3T6sLurb64fxG8BcBcxoL4
x-ms-exchange-antispam-srfa-diagnostics: SSOS;
x-ms-office365-filtering-ht: Tenant
x-ms-office365-filtering-correlation-id: e6755002-0359-4563-c48d-08d556a60c2f
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020);
 SRVR:AM6PR0502MB3799; 
x-ms-traffictypediagnostic: AM6PR0502MB3799:
x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr
x-microsoft-antispam-prvs: <AM6PR0502MB3799DC1F433A338383DBD0A2D2130@AM6PR0502MB3799.eurprd05.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(60795455431006)(278428928389397);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011);
 SRVR:AM6PR0502MB3799; BCL:0; PCL:0; RULEID:(100000803101)(100110400095);
 SRVR:AM6PR0502MB3799; 
x-forefront-prvs: 054642504A
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(979002)(376002)(39380400002)(39860400002)(366004)(396003)(346002)(24454002)(189003)(199004)(5250100002)(316002)(8936002)(102836004)(54906003)(3846002)(86362001)(97736004)(55016002)(229853002)(6116002)(9686003)(6506007)(81166006)(81156014)(6436002)(93886005)(561944003)(8676002)(4326008)(76176011)(2950100002)(33656002)(53936002)(59450400001)(6246003)(6916009)(3280700002)(3660700001)(14454004)(7696005)(105586002)(25786009)(68736007)(5660300001)(305945005)(99286004)(7736002)(2900100001)(106356001)(478600001)(74316002)(2906002)(66066001)(969003)(989001)(999001)(1009001)(1019001);
 DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3799;
 H:AM6PR0502MB3797.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords;
 MX:3; A:3; LANG:en; 
received-spf: None (protection.outlook.com: mellanox.com does not designate
 permitted sender hosts)
x-microsoft-antispam-message-info: nfdQOfQNv/Ss+ZRD80+e14ZDdZyGlnMKpJBPpsnNdJJiFYOYxctQ2dTcvVbxE/JyZTeOda8EYRfFEF0rruJxxA==
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: e6755002-0359-4563-c48d-08d556a60c2f
X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jan 2018 14:42:31.1028 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3799
Subject: Re: [dpdk-dev] [PATCH v2 6/6] app/testpmd: adjust ethdev port
	ownership
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 08 Jan 2018 14:42:40 -0000



From: Ga=EBtan Rivet, Monday, January 8, 2018 4:22 PM
> On Mon, Jan 08, 2018 at 01:55:52PM +0000, Matan Azrad wrote:
> > Hi Gaetan
> >
> > From: Ga=EBtan Rivet, Monday, January 8, 2018 3:30 PM
> > > On Mon, Jan 08, 2018 at 12:30:19PM +0000, Matan Azrad wrote:
> > > >
> > > >
> > > > From: Ga=EBtan Rivet, Monday, January 8, 2018 1:40 PM
> > > > > Hi Matan,
> > > > >
> > > > > On Sun, Jan 07, 2018 at 09:45:51AM +0000, Matan Azrad wrote:
> > > > > > Testpmd should not use ethdev ports which are managed by other
> > > > > > DPDK entities.
> > > > > >
> > > > > > Set Testpmd ownership to each port which is not used by other
> > > > > > entity and prevent any usage of ethdev ports which are not
> > > > > > owned by
> > > Testpmd.
> > > > > >
> > > > >
> > > > > This patch should not be necessary.
> > > > >
> > > > > Ideally, your API evolution should not impact the default case.
> > > > > As such, the default iterator RTE_ETH_FOREACH_DEV should still
> > > > > be used in
> > > testpmd.
> > > > >
> > > > Why? We want to adjust testpmd to the port ownership.
> > > >
> > >
> > > This adjustment should be seamless for existing application.
> > >
> > > > > RTE_ETH_FOREACH_DEV should call
> > > RTE_ETH_FOREACH_DEV_OWNED_BY, with
> > > > > the default owner (meaning that it would thus iterate on the
> > > > > application-owned set of device).
> > > > >
> > > >
> > > > It will break the API (we already talked about it).
> > > > There is not any default owner:
> > > > Any DPDK entity includes applications must to allocate an owner ID
> > > > and use
> > > it to own the ports they wants to use.
> > > > The application can include more than 1 owner depends on the user
> needs.
> > > > Each DPDK entity which can synchronize all its port usage can be a
> > > > valid
> > > DPDK entity for the ownership mechanism.
> > > >
> > >
> > > That's the point of my remark: you did not include a default owner.
> > > I think there should be one, and that all ports should pertain to
> > > this default owner by default when created.
> > >
> > > This would not prevent a user or application from adding new owners
> > > specific to their use and specialize ports if need be.
> > >
> > > However, for other applications that do not care for this
> > > specialization, they should run with the current API and avoid the
> > > ports that are configured by other third parties.
> > >
> >
> > RTE_ETH_FOREACH_DEV means iterate over all devices and should stay as
> is in my opinion.
> > I understand your concern about changes in current application, But
> > your "default" suggestion will cause to "non-default" applications to r=
eset
> all the default owners and will complicate them and hurt semantics.
>=20
> Why should an application be able to iterate over all ports? Leave this
> capability to the EAL (or ethdev layer) alone, while other components sho=
uld
> be restricted to their specific set.
>=20

Yes, you right.

> And if a need for this general iterator appears, solutions could be found=
 very
> easily.
>=20
> RTE_ETH_FOREACH_DEV currently does not iterate over deferred ports, it
> iterates over the base set of ports available. Changing this behavior is =
not
> necessary, you could introduce your API while keeping it.
>=20
Right.

> >
> > > I'm thinking about applications already written that would be used
> > > with fail- safe ports: they would use RTE_ETH_FOREACH_DEV, and would
> > > thus iterate over every ports, including those owned by the
> > > fail-safe, unless they start following the new API.
> > >
> >
> > They should start, it is really not complicated.
>=20
> The point is not whether developpers downstream would be able to grasp
> such complexity, but whether a project like DPDK should foster an unstabl=
e
> environment for its currently still limited ecosystem.
>=20
> > What's about application which use count=3Drte_eth_dev_count and iterat=
e
> over all ports from 0 to count-1?
> > We cannot save all the wrong application options.
> >
> > > This is unnecessary: adding a default owner for all created ports
> > > and redefining RTE_ETH_FOREACH_DEV as follow
> > >
> > > #define RTE_ETH_FOREACH_DEV(i)
> > >         RTE_ETH_FOREACH_DEV_OWNED_BY(i, RTE_ETH_DEFAULT_OWNER)
> > >
> > > Is simple enough and will simplify the work of DPDK users. Moreover,
> > > it would make fail-safe compatible with all applications using
> > > RTE_ETH_FOREACH_DEV without additional evolution. It would actually
> > > make any code using your API supported by those same applications,
> > > which I think would help its adoption.
> > >
> >
> > Will break API, will hurt semantic of FOREACH , and will complicate
> ownership care applications as I wrote above.
>=20
> Well, breaking an API is best before such API is integrated anyway.
>=20
> I disagree regarding the added complexity for applications that would use
> ownership. With your proposal, most applications will only add a single u=
ser
> and register all their ports with this user, then be forced to iterate up=
on their
> registered user.
>=20
> You can save all of them the hassle of adding this code, by taking care o=
f the
> most common case, avoiding redundant code downstream and simplifying
> possible future update to this default case.
>=20
> So if anything, this would greatly simplify ownership for the vast majori=
ty of
> applications.
>

OK, got you.
I will just document the API with the new semantic and will use the NO_OWNE=
R for the old API.
But actually I think testpmd should use the ownership mechanism as a good e=
xample for it.

Thanks!
=20
> --
> Ga=EBtan Rivet
> 6WIND