From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <matan@mellanox.com>
Received: from EUR01-VE1-obe.outbound.protection.outlook.com
 (mail-ve1eur01on0060.outbound.protection.outlook.com [104.47.1.60])
 by dpdk.org (Postfix) with ESMTP id A7C0B1B016
 for <dev@dpdk.org>; Thu, 25 Jan 2018 09:30:30 +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=lf4fSbrKg7Y/aVXLxcrr7Z6zvyhKZat15Cvqr3yEyzI=;
 b=APj/YNyZY+gNAOOjRk6Yz/n5JH/3AcaPcdmwrzFSpbuy5wRQ6BKuJHtIdShD8IJHIG2i7iunzlnvVLNIS3Y+oyp5nGNtohzrFYvCun6jXSKWLAMNYpGqLXvXZp3wVyJHPWH0JbUDz1JSjME1gRFWPb2LuhP03/d3BVMLJXPi3VI=
Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.21.26) by
 AM6PR0502MB3621.eurprd05.prod.outlook.com (52.133.20.30) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id
 15.20.444.14; Thu, 25 Jan 2018 08:30:28 +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.0444.015; Thu, 25 Jan
 2018 08:30:28 +0000
From: Matan Azrad <matan@mellanox.com>
To: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>, Thomas Monjalon
 <thomas@monjalon.net>, Gaetan Rivet <gaetan.rivet@6wind.com>, "Wu, Jingjing"
 <jingjing.wu@intel.com>
CC: "dev@dpdk.org" <dev@dpdk.org>, Neil Horman <nhorman@tuxdriver.com>,
 "Richardson, Bruce" <bruce.richardson@intel.com>, "Ananyev, Konstantin"
 <konstantin.ananyev@intel.com>
Thread-Topic: [dpdk-dev] [PATCH v5 7/7] app/testpmd: adjust ethdev port
 ownership
Thread-Index: AQHTk5+37MI2qTv4Yk+uaeLdYqXfoqOD1aGAgABu6jA=
Date: Thu, 25 Jan 2018 08:30:28 +0000
Message-ID: <AM6PR0502MB3797C278D1DFB84C456688C1D2E10@AM6PR0502MB3797.eurprd05.prod.outlook.com>
References: <1516483468-9048-1-git-send-email-matan@mellanox.com>
 <1516639103-27166-1-git-send-email-matan@mellanox.com>
 <1516639103-27166-8-git-send-email-matan@mellanox.com>
 <6A0DE07E22DDAD4C9103DF62FEBC09093B715E03@shsmsx102.ccr.corp.intel.com>
In-Reply-To: <6A0DE07E22DDAD4C9103DF62FEBC09093B715E03@shsmsx102.ccr.corp.intel.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; AM6PR0502MB3621;
 7:WUijA5A2W5MY/KY1LNolFJNFrdQ1SqpOGuAng1AcuFVG961hFmxQYMGEwTIntte17G6BWS+WB1yfQYQ0BIONl2Uhq90jbIHkCE8JHAHQUVWa7iOPenG4mHlpWg649YpQW+andKjb9uvNBFJRklNpFuKd30psAsEgzsAqOwmmZ1eqVcUkxdLDw4A0RqO7wjaiR+tZXR5tpUNR3iaEN27uBQlSRknPF96+RM81rh1Cj1R+yCA5feH70x2uxP0D6s5H
x-ms-exchange-antispam-srfa-diagnostics: SSOS;
x-ms-office365-filtering-ht: Tenant
x-ms-office365-filtering-correlation-id: 1f576f73-9117-4b3e-71ed-08d563cde3e0
x-microsoft-antispam: UriScan:; BCL:0; PCL:0;
 RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020);
 SRVR:AM6PR0502MB3621; 
x-ms-traffictypediagnostic: AM6PR0502MB3621:
x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr
x-microsoft-antispam-prvs: <AM6PR0502MB36210C2C73696BEB66AFCE10D2E10@AM6PR0502MB3621.eurprd05.prod.outlook.com>
x-exchange-antispam-report-test: UriScan:(60795455431006)(228905959029699);
x-exchange-antispam-report-cfa-test: BCL:0; PCL:0;
 RULEID:(6040501)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(3231023)(2400081)(944501161)(6055026)(6041288)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(6072148)(201708071742011);
 SRVR:AM6PR0502MB3621; BCL:0; PCL:0; RULEID:; SRVR:AM6PR0502MB3621; 
x-forefront-prvs: 0563F2E8B7
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(39860400002)(376002)(396003)(346002)(39380400002)(366004)(199004)(189003)(13464003)(105586002)(5660300001)(26005)(6246003)(186003)(2900100001)(4326008)(33656002)(76176011)(305945005)(93886005)(8936002)(68736007)(6506007)(74316002)(2950100002)(53546011)(25786009)(102836004)(478600001)(7736002)(316002)(7696005)(66066001)(9686003)(5250100002)(97736004)(99286004)(575784001)(86362001)(2906002)(53936002)(3280700002)(106356001)(3660700001)(8676002)(229853002)(6436002)(54906003)(110136005)(14454004)(55016002)(6116002)(3846002)(81156014)(81166006);
 DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3621;
 H:AM6PR0502MB3797.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)
x-microsoft-antispam-message-info: wRZpC4vcFvo6cCSjM7y3lS74PQFvULBAhptbXdsXk151PaDQDyxh4WaFV1BbbXrF8YxfbnkHMLsXCcJ43DVYiA==
spamdiagnosticoutput: 1:99
spamdiagnosticmetadata: NSPM
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: Mellanox.com
X-MS-Exchange-CrossTenant-Network-Message-Id: 1f576f73-9117-4b3e-71ed-08d563cde3e0
X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Jan 2018 08:30:28.4594 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b
X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3621
Subject: Re: [dpdk-dev] [PATCH v5 7/7] 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: Thu, 25 Jan 2018 08:30:30 -0000

Hi Lu

From: Lu, Wenzhuo [mailto:wenzhuo.lu@intel.com]
> Hi Matan,
>=20
>=20
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Matan Azrad
> > Sent: Tuesday, January 23, 2018 12:38 AM
> > To: Thomas Monjalon <thomas@monjalon.net>; Gaetan Rivet
> > <gaetan.rivet@6wind.com>; Wu, Jingjing <jingjing.wu@intel.com>
> > Cc: dev@dpdk.org; Neil Horman <nhorman@tuxdriver.com>; Richardson,
> > Bruce <bruce.richardson@intel.com>; Ananyev, Konstantin
> > <konstantin.ananyev@intel.com>
> > Subject: [dpdk-dev] [PATCH v5 7/7] app/testpmd: adjust ethdev port
> > ownership
> >
> > 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.
> >
> > Signed-off-by: Matan Azrad <matan@mellanox.com>
> > ---
> >  app/test-pmd/cmdline.c      | 89 +++++++++++++++++++------------------=
---
> -----
> >  app/test-pmd/cmdline_flow.c |  2 +-
> >  app/test-pmd/config.c       | 37 ++++++++++---------
> >  app/test-pmd/parameters.c   |  4 +-
> >  app/test-pmd/testpmd.c      | 63 ++++++++++++++++++++------------
> >  app/test-pmd/testpmd.h      |  3 ++
> >  6 files changed, 103 insertions(+), 95 deletions(-)
> >
> > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index
> > 9f12c0f..36dba6c 100644
> > --- a/app/test-pmd/cmdline.c
> > +++ b/app/test-pmd/cmdline.c
> > @@ -1394,7 +1394,7 @@ struct cmd_config_speed_all {
> >  			&link_speed) < 0)
> >  		return;
> >
> > -	RTE_ETH_FOREACH_DEV(pid) {
> > +	RTE_ETH_FOREACH_DEV_OWNED_BY(pid, my_owner.id) {
> I see my_owner is a global variable, so, don't know why we need the
> parameter 'my_owner.id' here.

Yes it is a testpmd global variable (which was initiated in testpmd main fu=
nction - you can see it in this patch) as a lot of variables in testpmd.
RTE_ETH_FOREACH_DEV_OWNED_BY iterator is an ethdev iterator -> not only for=
 testpmd\applications.
So, each dpdk entity(application, PMDs, any other libs) should use this ite=
rator with its specific owner id to get its owned ports.

> I think we can still use
> RTE_ETH_FOREACH_DEV and check 'my_owner' in it. If there's some reason
> and you don't want change RTE_ETH_FOREACH_DEV, I think '
> RTE_ETH_FOREACH_DEV_OWNED(pid) {' is better.