From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <wenzhuo.lu@intel.com>
Received: from mga02.intel.com (mga02.intel.com [134.134.136.20])
 by dpdk.org (Postfix) with ESMTP id 94DCC2951
 for <dev@dpdk.org>; Wed, 17 Jan 2018 01:46:45 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga006.jf.intel.com ([10.7.209.51])
 by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 16 Jan 2018 16:46:44 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.46,369,1511856000"; d="scan'208";a="11117065"
Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206])
 by orsmga006.jf.intel.com with ESMTP; 16 Jan 2018 16:46:44 -0800
Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by
 FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Tue, 16 Jan 2018 16:46:43 -0800
Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by
 fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS)
 id 14.3.319.2; Tue, 16 Jan 2018 16:46:43 -0800
Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.189]) by
 SHSMSX104.ccr.corp.intel.com ([169.254.5.152]) with mapi id 14.03.0319.002;
 Wed, 17 Jan 2018 08:46:41 +0800
From: "Lu, Wenzhuo" <wenzhuo.lu@intel.com>
To: 'Matan Azrad' <matan@mellanox.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 v2 6/6] app/testpmd: adjust ethdev port
 ownership
Thread-Index: AQHTh5ypoteWd8b8HEyxdkLfW8dkVqN2BtlA//+oQoCAAIl+sA==
Date: Wed, 17 Jan 2018 00:46:40 +0000
Message-ID: <6A0DE07E22DDAD4C9103DF62FEBC09093B711969@shsmsx102.ccr.corp.intel.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>
 <6A0DE07E22DDAD4C9103DF62FEBC09093B7110ED@shsmsx102.ccr.corp.intel.com>
 <AM6PR0502MB379790C1EB3EEB31A483095BD2EA0@AM6PR0502MB3797.eurprd05.prod.outlook.com>
In-Reply-To: <AM6PR0502MB379790C1EB3EEB31A483095BD2EA0@AM6PR0502MB3797.eurprd05.prod.outlook.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
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: Wed, 17 Jan 2018 00:46:46 -0000

Hi Matan,

> -----Original Message-----
> From: Matan Azrad [mailto:matan@mellanox.com]
> Sent: Tuesday, January 16, 2018 4:16 PM
> 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; Neil Horman <nhorman@tuxdriver.com>; Richardson,
> Bruce <bruce.richardson@intel.com>; Ananyev, Konstantin
> <konstantin.ananyev@intel.com>
> Subject: RE: [dpdk-dev] [PATCH v2 6/6] app/testpmd: adjust ethdev port
> ownership
>=20
> Hi Lu
> From: Lu, Wenzhuo, Tuesday, January 16, 2018 7:54 AM
> > Hi Matan,
> >
> >
> > > -----Original Message-----
> > > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Matan Azrad
> > > Sent: Sunday, January 7, 2018 5:46 PM
> > > 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 v2 6/6] 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.
> > Sorry I don't follow all the discussion as there's too much. So it may
> > be a silly question.
>=20
> No problem, I'm here for any question :)
>=20
> > Testpmd already has the parameter " --pci-whitelist" to only use the
> > assigned devices.
>=20
> It is an EAL parameter. No? just say to EAL which devices to create..
>=20
> > When using this parameter, all the devices are owned by the current
> > APP.
>=20
> No, what's about vdev? vdevs may manage devices(even whitlist PCI devices=
)
> by themselves and want to prevent any app to use these devices(see fail-
> safe PMD).
I'm not an expert of EAL and vdev. Suppose this would be discussed in other=
 patches.
I don't want to bother you again here as testpmd is only used to show the r=
esult.
So I think if this patch is needed just depends on if other patches are acc=
epted :)

>=20
>  > So I don't know why need to set/check the ownership.
> > BTW, in this patch, seem all the change is for ownership checking. I
> > don't find the setting code. Do I miss something?
>=20
> Yes, see in main function (the first FOREACH).
I think you mean this change,

@@ -2394,7 +2406,12 @@  uint8_t port_is_bonding_slave(portid_t slave_pid)
 	rte_pdump_init(NULL);
 #endif
=20
-	nb_ports =3D (portid_t) rte_eth_dev_count();
+	if (rte_eth_dev_owner_new(&my_owner.id))
+		rte_panic("Failed to get unique owner identifier\n");
+	snprintf(my_owner.name, sizeof(my_owner.name), TESTPMD_OWNER_NAME);
+	RTE_ETH_FOREACH_DEV_OWNED_BY(port_id, RTE_ETH_DEV_NO_OWNER)
+		if (rte_eth_dev_owner_set(port_id, &my_owner) =3D=3D 0)
+			nb_ports++;
 	if (nb_ports =3D=3D 0)
 		RTE_LOG(WARNING, EAL, "No probed ethernet devices\n");
But I thought about some code to assign a specific device to a specific APP=
 explicitly.
This code looks like just occupying the devices with no owner. So, it means=
 the first APP will occupy all the devices? It makes me confused as I don't=
 see the benefit or the difference than before.

>=20
> Thanks, Matan.