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 0175DA00E6 for ; Tue, 9 Jul 2019 07:40:47 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5268324D; Tue, 9 Jul 2019 07:40:46 +0200 (CEST) Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70054.outbound.protection.outlook.com [40.107.7.54]) by dpdk.org (Postfix) with ESMTP id 4ABAA3237 for ; Tue, 9 Jul 2019 07:40:45 +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=+oyGYzNwGl4StSZIyy5H8lV3+V5YF4hRX5Jw27hObxg=; b=ljC7WgIWH2haqQSjjsui4XPOXlOIyCzfcJwXHAwKJs4rOZuTAvUSNGsCq/cOXmByDMLO0CIiVnmqIb5wu4FS4UW75LiqXmVofJOccVK+H5wtk0aNHiIrmxgrT5L0R0hBtYyQmyy9QUhAPyqqe9mRKEdebUqBCHWiia+HFVvHkiQ= Received: from AM0PR0502MB4019.eurprd05.prod.outlook.com (52.133.39.139) by AM0PR0502MB4050.eurprd05.prod.outlook.com (52.133.37.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2052.19; Tue, 9 Jul 2019 05:40:44 +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; Tue, 9 Jul 2019 05:40:43 +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/qsKbAQTfwgACNlgCAAPdfAA== Date: Tue, 9 Jul 2019 05:40:43 +0000 Message-ID: References: <20190529224321.20760-1-stephen@networkplumber.org> <20190603222835.27909-1-stephen@networkplumber.org> <20190707094721.28096618@hermes.lan> <20190708074906.301917f7@hermes.lan> In-Reply-To: <20190708074906.301917f7@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: bca2ef25-d8c8-4ed0-0700-08d7042ffc52 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:AM0PR0502MB4050; x-ms-traffictypediagnostic: AM0PR0502MB4050: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0093C80C01 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(366004)(396003)(346002)(376002)(136003)(39860400002)(199004)(189003)(52536014)(6246003)(256004)(81166006)(33656002)(2906002)(186003)(11346002)(14444005)(8676002)(446003)(476003)(86362001)(76116006)(5660300002)(7736002)(71200400001)(478600001)(66476007)(14454004)(305945005)(66946007)(73956011)(66066001)(486006)(64756008)(66446008)(66556008)(71190400001)(53546011)(3846002)(6916009)(54906003)(9686003)(55016002)(6436002)(26005)(54075001)(8936002)(4326008)(7696005)(99286004)(25786009)(74316002)(316002)(53936002)(102836004)(6506007)(229853002)(68736007)(6116002)(81156014)(76176011); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0502MB4050; H:AM0PR0502MB4019.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX: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: 5cF/ZjQqvHjNIlNDByh32xfNvYWW09PU1OiCf3i+TfMdb+B7k1Nc+hhjJjp2NJPM1P4Iob0E4u/MtHvhxbQq+VZmWXQJHf2FK/V+hEA8ltomqYLzJ8V9yeTm2Z9nn3464U9twWTiD/oGC7NB2npK1eW5y/wxskdYQYyvyDkP+DO203Z9GDK8qQ/NdaA8YNNRV+5An8YcoMlL5H4OOFc21jC9aanPIU8dO05QsPE2oMa+apXftU9T5wTXLv2TqmAKYz801NQPG/5397w21ncIg+uMKl0OTC2knaPSa9UXsew9rol6l32wh+Lode+edPbTS/KpQ5mzIwzTEo+LxbJZpti6KLRHocyYkkacv+X1TY+fJGfkWsYHtyRfqZJRNOCLseONOeCrr2fyYKyL7OL5S/6p3sj+m1LAFzwJE2b17t8= 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: bca2ef25-d8c8-4ed0-0700-08d7042ffc52 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jul 2019 05:40:43.8643 (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: AM0PR0502MB4050 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 > On Mon, 8 Jul 2019 06:37:14 +0000 > Matan Azrad wrote: >=20 > > Hi Stephen > > > > From: Stephen Hemminger > > > 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 > > > > > > On Sun, 7 Jul 2019 05:44:55 +0000 > > > Matan Azrad wrote: > > > > > > > > + 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(). > > > > > > 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. > > > > From docs: > > "10.4.2. Port Ownership > > The Ethernet devices ports can be owned by a single DPDK entity > (application, library, PMD, process, etc). The ownership mechanism is > controlled by ethdev APIs and allows to set/remove/get a port owner by > DPDK entities. Allowing this should prevent any multiple management of > Ethernet port by different 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 > processes." > > > > > 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. >=20 > No other application is doing this: testpmd, l3fwd, ... why do you think = this > application is different. Plus you would be putting a new requirement on = all > the user applications. That would be a user hostile change. As I said above: Apps have 2 options: 1. be ownership aware and to take ownership on its ports. 2. not be ownership aware and use by RTE_ETH_FOREACH_DEV to detect the appl= ication ports. Most of the apps should use the second option. (see testpmd). Matan.