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-eopbgr30063.outbound.protection.outlook.com [40.107.3.63])
 by dpdk.org (Postfix) with ESMTP id 75544FE5
 for <dev@dpdk.org>; Wed,  6 Sep 2017 13:09:22 +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=V3IAoUv/R7JkZJmzJDgYVYl7bSyr/ETNIppl5jABfJw=;
 b=F74x1VOQwfRqIHVH8noEelErzDEN3MhMBSpR0U8qubvtGwrvuXbLy4DGlT867BTZIX5zF+R5j/iuyjcwK2C+vrNyLvtzS8sHBxFq7Ia4QaNOqMXk5KHR1S23bz7BbxURfX5mOH0KoggLLEGlGjHUHx8A6mrvCjtCwmv15Ebwk7c=
Received: from DB6PR0502MB3048.eurprd05.prod.outlook.com (10.172.250.136) by
 DB6PR0502MB2968.eurprd05.prod.outlook.com (10.172.246.142) with Microsoft
 SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Wed, 6 Sep
 2017 11:09:21 +0000
Received: from DB6PR0502MB3048.eurprd05.prod.outlook.com
 ([fe80::e938:efe9:effc:7ef8]) by DB6PR0502MB3048.eurprd05.prod.outlook.com
 ([fe80::e938:efe9:effc:7ef8%14]) with mapi id 15.20.0013.018; Wed, 6 Sep 2017
 11:09:20 +0000
From: Matan Azrad <matan@mellanox.com>
To: Jingjing Wu <jingjing.wu@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, Ori Kam <orika@mellanox.com>, "Thomas
 Monjalon" <thomas@monjalon.net>, =?iso-8859-1?Q?Ga=EBtan_Rivet?=
 <gaetan.rivet@6wind.com>
Thread-Topic: [dpdk-stable] [PATCH] app/testpmd: fix forward port ids setting
Thread-Index: AQHTJVo2lKO7rAT05UWFWNtTAIOC7qKkcdPggAAKhgCAAyyzAIAAC5YQ
Date: Wed, 6 Sep 2017 11:09:20 +0000
Message-ID: <DB6PR0502MB30487C7F0A8D23C1938864DED2970@DB6PR0502MB3048.eurprd05.prod.outlook.com>
References: <1504444747-56298-1-git-send-email-matan@mellanox.com>
 <DB6PR0502MB3048708C2F230CA041D7BC36D2910@DB6PR0502MB3048.eurprd05.prod.outlook.com>
 <20170904095231.GD21444@bidouze.vm.6wind.com> <1766803.K7SpHi0fzz@xps>
In-Reply-To: <1766803.K7SpHi0fzz@xps>
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; DB6PR0502MB2968;
 6:ttj05H4ZgKNgtw0QmpzdEE0dkOQswzw9qp9yAo6jEqBaFKl/AAb8qkvtDUcODWJBUAugLfJG5Oifk5kc9Rhu8iR9MK8pcHD1IcZl0RJ23i2ldyt5QBPYt2MXOCyZXGRQKl02N8Vt/nSHJ4Ydqy/x2t/k8ZmHdiWI2s8W6SB5QTijAy//KhxLDTJ1d3B7XIbwIDkQ+AmcGyuFvvGmaENvOf3Zxs8Cqzkhusv2uXE3gVEaEaHfCHAow/jR/02MK806+LvrA93ZrNM4v7nuEqYZA68u0EEm4CUtS/jOJkK7GZgXfcQzwgdPWMP8TSMuv3KcA8rhopz8M/tBxR4SOe6t6g==;
 5:3CsRjh0j4HiIVGz9QPjB1VftByp/2W8T7lbfPxeG1fR2bfbGDxxBPDMwRgRR/A/6ygfr+77uYTZSgb0EAszcTQoNWoybeZZn8wajWABfwnqlcxIk1Uj8ztumOPNqnfDSvsQ9JeTVt1rQxk/uRRr/WYxCMDJZy4oXLMz+gmo3xe8=;
 24:4g0gDPT7LNfKe5qI8aQydQ4tnDGHU1T9IBtOFBJTfJXZEdXVd7nRxCDdtqV3XCEZZUsc1PAzDMRpAyjAQc34l+OaVIFL+tzjN8JOXXgVm0s=;
 7:jKYb7T0qYoCV1bPK5CPjI/PXFAFKEwGQ1itBbUALX+cnMluf5kGh8H9Ns7TqRwxIK1DkzDHIlAPMOEwCPYmBF9tfdDFD2w/c3zR7PqrXziilDc+Ytr54Fw0loZmjIqjqEhK3LPV53EPGbmvSBY4h6NjY/l1EmzKOaupxTky2N/0NzCcS8CeGLDzof1rKvZIie74Zl5CbaPo848RyyyxJodw/NsSV+jeJlMspXJ8SuEY=
x-ms-exchange-antispam-srfa-diagnostics: SSOS;
x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr
x-ms-office365-filtering-correlation-id: 0b68aa23-f167-45c4-78bb-08d4f517b968
x-ms-office365-filtering-ht: Tenant
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);
 SRVR:DB6PR0502MB2968; 
x-ms-traffictypediagnostic: DB6PR0502MB2968:
x-exchange-antispam-report-test: UriScan:(278428928389397)(189930954265078)(45079756050767)(228905959029699); 
x-microsoft-antispam-prvs: <DB6PR0502MB29686E7703D9E5FF1C005813D2970@DB6PR0502MB2968.eurprd05.prod.outlook.com>
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6041248)(20161123564025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);
 SRVR:DB6PR0502MB2968; BCL:0; PCL:0;
 RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);
 SRVR:DB6PR0502MB2968; 
x-forefront-prvs: 0422860ED4
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(6009001)(39860400002)(377454003)(76104003)(51444003)(13464003)(53754006)(199003)(24454002)(189002)(5890100001)(101416001)(86362001)(2950100002)(6916009)(2900100001)(50986999)(5660300001)(189998001)(7696004)(229853002)(54356999)(76176999)(74316002)(66066001)(54906002)(14454004)(110136004)(966005)(55016002)(53546010)(99286003)(6436002)(6246003)(53936002)(33656002)(9686003)(3846002)(97736004)(93886005)(81166006)(6306002)(81156014)(8676002)(68736007)(102836003)(305945005)(5250100002)(25786009)(6116002)(106356001)(8936002)(45080400002)(105586002)(6506006)(3280700002)(4326008)(2906002)(478600001)(3660700001)(7736002);
 DIR:OUT; SFP:1101; SCL:1; SRVR:DB6PR0502MB2968;
 H:DB6PR0502MB3048.eurprd05.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords;
 A:1; MX:1; LANG:en; 
received-spf: None (protection.outlook.com: mellanox.com does not designate
 permitted sender hosts)
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-originalarrivaltime: 06 Sep 2017 11:09:20.8360 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0502MB2968
Subject: Re: [dpdk-dev] [dpdk-stable] [PATCH] app/testpmd: fix forward port
	ids setting
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <http://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: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 06 Sep 2017 11:09:22 -0000

Hi Jinging,

> -----Original Message-----
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, September 6, 2017 1:21 PM
> To: Ga=EBtan Rivet <gaetan.rivet@6wind.com>; Matan Azrad
> <matan@mellanox.com>
> Cc: Jingjing Wu <jingjing.wu@intel.com>; dev@dpdk.org; Ori Kam
> <orika@mellanox.com>
> Subject: Re: [dpdk-stable] [PATCH] app/testpmd: fix forward port ids sett=
ing
>=20
> 04/09/2017 11:52, Ga=EBtan Rivet:
> > On Mon, Sep 04, 2017 at 09:25:04AM +0000, Matan Azrad wrote:
> > > From: Ga=EBtan Rivet [mailto:gaetan.rivet@6wind.com]
> > > > On Sun, Sep 03, 2017 at 04:19:07PM +0300, Matan Azrad wrote:
> > > > > Hi All
> > > > > I would like to bring up a discussion to complete this bug fix.
> > > > >
> > > > > When user wants to set the list of forwarding ports by "set portl=
ist"
> > > > > (testpmd command line), the testpmd application checks the
> > > > > availability of the ports by rte_eth_dev_is_valid_port API.
> > > > > By this way, it gets the DEFERRED port as valid port and will
> > > > > try to recieve\send packets via this port.
> > > > >
> > > > > This scenario will cause the same error as this patch fixes.
> > > > >
> > > > > Should testpmd allow user to run traffic by DEFERRED port directl=
y?
> > > > >
> > > > > If any application wants to check a port availability for device
> > > > > usage (conf\rxtx), Which API should be used?
> > > > >
> > > > > According to the patch cb894d99eceb ("ethdev: add deferred
> > > > > intermediate device state"), DEFERRED ports should be invisible
> > > > > to application, So maybe the rte_eth_dev_is_valid_port API
> > > > > should be internal and a new ethdev API should be created for
> applications.
> > > > >
> > > > > What do you think?
> > > > >
> > > >
> > > > I think that regardless of the semantic of the DEFERRED state or
> > > > any other port handling, the correct assumption is to consider any
> > > > port iterated over by RTE_ETH_FOREACH_DEV to be the exact set of
> > > > devices that are supposed to be usable. In the event of an API
> > > > evolution regarding port states, this macro should remain correct.
> > > >
> > > > So I think your fix is correct, and that the implication of
> > > > RTE_ETH_FOREACH_DEV avoiding DEFERRED devices is correct.
> > > >
> > >
> > > This patch fixes the default forward ports setting (actually when
> > > user don't use --portmask param or "set portlist"), But it don't fix =
the port
> validation which PMD does for "set portlist" command.
> > > So, the discussion is how to fix this port validation.
> >
> > You could make a static rte_eth_dev_is_valid_port with a different
> > name, declare both RTE_ETH_VALID_PORT* macros within rte_ethdev.c
> and
> > introduce a new rte_eth_dev_is_valid_port which would restrict devices
> > to those ATTACHED.
> >
> > I'm not sure this would be interesting for applications. Currently
> > this check is performed internally by the ether layer, I guess most
> > applications rely on it. Making the "extended" version (ATTACHED +
> > DEFERRED) private with the strict one public would probably not change
> > behaviors, thus it would probably have little to no effect.
> >
> > So my opinion is "why not, but the risk is adding dead code for no
> > real benefit".
> >
> > > In current code, testpmd uses  rte_eth_dev_is_valid_port which return
> the DEFERRED device too for forwarding.
> > > Should it use the RTE_ETH_FOREACH_DEV  iterator for one port
> validation?
> > > Don't you think we need new API for one port?
>=20
> Please, let's continue this ethdev discussion in a separate thread.
> I've started a new one:
> 	https://emea01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F
> %2Fdpdk.org%2Fml%2Farchives%2Fdev%2F2017-
> September%2F074656.html&data=3D02%7C01%7Corika%40mellanox.com%7C5
> 9017f577e004c8be80c08d4f51104ec%7Ca652971c7d2e4d9ba6a4d149256f461b
> %7C0%7C0%7C636402900840946032&sdata=3DlPFh1ro1cJTyiYYC7KQtRm7CQ8M
> rkct7i6%2BUBW1HEsM%3D&reserved=3D0

I think you can acknowledge this fix for the default forward port IDs setti=
ng (this patch fixes it).
I will send fix in a separated patch to the  "set portlist" port validation=
 after ethdev discussion will be done.

Regards,
Matan Azrad