From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6B75BA00E6 for ; Mon, 8 Jul 2019 08:37:19 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 06E693256; Mon, 8 Jul 2019 08:37:18 +0200 (CEST) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40085.outbound.protection.outlook.com [40.107.4.85]) by dpdk.org (Postfix) with ESMTP id 490A4A3 for ; Mon, 8 Jul 2019 08:37:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MdKCV/fhh7mYGZW05qG1vqcZY6BCRDhUUn27Tzv0jHo=; b=ULCooZYzLrJ9HjlVQ3NlQWmwMwfGekEyByWxiGIVknFoQ3fpjmoBzq7YaaE9A9pHYvWumvuvfCAlUwAqC+ueJ9Rxf6Q68ixMsasF7vhB9ibqk0HB7f5ZJLpU6HBqyOWL84SVDEUZDB398FyQtg+s+p1+o/rkNqTKg8r/41XYlHc= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.39.139) by AM0PR0502MB4083.eurprd05.prod.outlook.com (52.133.36.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.19; Mon, 8 Jul 2019 06:37:15 +0000 Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::a81f:9e35:487d:d788]) by AM0PR0502MB4019.eurprd05.prod.outlook.com ([fe80::a81f:9e35:487d:d788%7]) with mapi id 15.20.2052.020; Mon, 8 Jul 2019 06:37:15 +0000 From: Matan Azrad To: Stephen Hemminger CC: "anatoly.burakov@intel.com" , "dev@dpdk.org" , Stephen Hemminger Thread-Topic: [dpdk-dev] [PATCH v2] examples/client_server_mp: check port ownership Thread-Index: AQHVNOOrJ4vWhDVSgkavmBgl/5/qsKbAQTfw Date: Mon, 8 Jul 2019 06:37:14 +0000 Message-ID: References: <20190529224321.20760-1-stephen@networkplumber.org> <20190603222835.27909-1-stephen@networkplumber.org> <20190707094721.28096618@hermes.lan> In-Reply-To: <20190707094721.28096618@hermes.lan> 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-ms-office365-filtering-correlation-id: 46906100-5135-4510-8bdb-08d7036eb725 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020); SRVR:AM0PR0502MB4083; x-ms-traffictypediagnostic: AM0PR0502MB4083: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 00922518D8 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39860400002)(366004)(136003)(376002)(346002)(396003)(189003)(199004)(74316002)(71200400001)(71190400001)(5660300002)(7736002)(52536014)(54906003)(4326008)(33656002)(102836004)(2906002)(316002)(186003)(54075001)(6916009)(66446008)(8936002)(66556008)(64756008)(256004)(14454004)(81166006)(66946007)(73956011)(76116006)(11346002)(446003)(66476007)(305945005)(8676002)(476003)(86362001)(486006)(81156014)(14444005)(6116002)(3846002)(99286004)(478600001)(76176011)(68736007)(55016002)(7696005)(9686003)(6436002)(53936002)(53546011)(66066001)(229853002)(6506007)(25786009)(6246003)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB4083; H:AM0PR0502MB4019.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: NwuPEhl7M3zNmBJW7t0Jh06m3bwQHv4PKCoQ3j+gpvypxsdk1TAPuY8ZuEBACyuE0uTPUdDbxxkzkUD1kw0YNJ244A711URWnO1503BnCBqPcob9bhqC2/GshDlCg3eSJfdPF/7Igk9NI15efX0vEjaF01MkgZJAlYZQizek7eSSwyg/ASk5Vq1dKKuVRKN+VzkN/agPuV/JbcQHKsZqHjjxSVzV4adipoakWsXkUbdeTEwphmCaqML4gT3E19exSzNwSk5KFZ1ccSNxPxMSpTqRs9xAu82iYwzIRLO/zuOurOWkbTioTzNJH17/iLXKuxk3vLYkr4nYkikOo6OpoD26YxJItMOCoMpyKhb0ZoeLr1UCPAyApAfM2GCt8L6A98xpia32jpLW25qAM15qW2tCzdNX3+7vWrE+yLRihMs= 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: 46906100-5135-4510-8bdb-08d7036eb725 X-MS-Exchange-CrossTenant-originalarrivaltime: 08 Jul 2019 06:37:14.9471 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: matan@mellanox.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0502MB4083 Subject: Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: check port ownership 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Stephen From: Stephen Hemminger=20 > Sent: Sunday, July 7, 2019 7:47 PM > To: Matan Azrad > Cc: anatoly.burakov@intel.com; dev@dpdk.org; Stephen Hemminger > > Subject: Re: [dpdk-dev] [PATCH v2] examples/client_server_mp: check port > ownership >=20 > On Sun, 7 Jul 2019 05:44:55 +0000 > Matan Azrad wrote: >=20 > > > + for (count =3D 0; pm !=3D 0; pm >>=3D 1, ++count) { > > > + struct rte_eth_dev_owner owner; > > > + > > > + if ((pm & 0x1) =3D=3D 0) > > > + continue; > > > + > > > + if (count >=3D max_ports) { > > > + printf("WARNING: requested port %u not present - > > > ignoring\n", > > > + count); > > > + continue; > > > + } > > > + if (rte_eth_dev_owner_get(count, &owner) < 0) { > > > + printf("ERROR: can not find port %u owner\n", > > > count); > > > > What if some entity will take ownership later? > > If you want the app will be ownership aware: > > if you sure that you want this port to be owned by this application > you need to take ownership on it. > > else: > > the port is hidden by RTE_ETH_FOREACH_DEV if it is owned by some entity= . > > see how it was done in testpmd function: port_id_is_invalid(). >=20 > There are no mysterious entities in DPDK. > The only thing that can happen later is hotplug, and that will not change= state > of existing port. > This model is used for all applications. The application does not take > ownership, only device drivers do. A long discussions were done on it. There is an application model to take ownership as I wrote you above. You chose in the second option - not to be ownership aware. =20 >From docs: "10.4.2. Port Ownership The Ethernet devices ports can be owned by a single DPDK entity (applicatio= n, library, PMD, process, etc). The ownership mechanism is controlled by et= hdev APIs and allows to set/remove/get a port owner by DPDK entities. Allow= ing this should prevent any multiple management of Ethernet port by differe= nt entities. Note It is the DPDK entity responsibility to set the port owner before using it = and to manage the port usage synchronization between different threads or p= rocesses." > The whole portmask as command-line parameter is a bad user experience > now, but that is a different problem. I think, this is the problem you should solve here. Matan