From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 978C62BF3; Sat, 20 Jan 2018 17:48:35 +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=VW8elI6wK/tSgVt1jM8PMne+5fQiAPgg31QMWBDODGI=; b=hCwAPpjFXQVOPzZLMQoErGLC9xXc59zn2B5mTXI0x/ZcmPGqsJgehebSCFF/mM/L6KfFpcwOcg7fjbrlgmipPPWSMFYheekUqBc7vyTaaykelSeHSJboW/jQMWemQCYZ+a7oT6qGt7m56m9da9Lq1XTh8SX5nuSNPDZOOLloU/I= Received: from AM6PR0502MB3797.eurprd05.prod.outlook.com (52.133.21.26) by AM6PR0502MB3862.eurprd05.prod.outlook.com (52.133.21.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Sat, 20 Jan 2018 16:48:33 +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.0428.019; Sat, 20 Jan 2018 16:48:33 +0000 From: Matan Azrad To: "Ananyev, Konstantin" , Thomas Monjalon , Gaetan Rivet , "Wu, Jingjing" CC: "dev@dpdk.org" , Neil Horman , "Richardson, Bruce" , "stable@dpdk.org" Thread-Topic: [PATCH v3 2/7] ethdev: fix used portid allocation Thread-Index: AQHTkSKj2N/tRa4+6k2KQtBBYEBiDqN8+deA Date: Sat, 20 Jan 2018 16:48:32 +0000 Message-ID: References: <1515318351-4756-1-git-send-email-matan@mellanox.com> <1516293317-30748-1-git-send-email-matan@mellanox.com> <1516293317-30748-3-git-send-email-matan@mellanox.com> <2601191342CEEE43887BDE71AB97725886280A89@irsmsx105.ger.corp.intel.com> In-Reply-To: <2601191342CEEE43887BDE71AB97725886280A89@irsmsx105.ger.corp.intel.com> Accept-Language: en-US, he-IL Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [85.64.136.190] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM6PR0502MB3862; 7:O3+7tUSmbBgLrHT1B5Fj9rd6snzhAg5fNZkWbHaxoAfahce2JX/4AL4xVz6A1gLilvSoNnjadwEFJjzTNNJ6u/moQu0UMSXqUucoz0jIYDoPG2+VBf7laxzVSoArIz8+yvj5kpoCdeHVS5/lh8YFIbBEBGmgbNgLCdrGlJXhOpjIcPAd7z1+zYwIWPS6pN/6c7vSwuACKIbJj8fPx3Y75pHxCqaYvD2eiUf9zkRMBkojmtlYh3CXMpbyHztBIMcg x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: 49d29539-50be-45db-9a0a-08d56025a45d x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(3008032)(48565401081)(2017052603307)(7153060)(7193020); SRVR:AM6PR0502MB3862; x-ms-traffictypediagnostic: AM6PR0502MB3862: x-ld-processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(788757137089)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040501)(2401047)(5005006)(8121501046)(3231023)(2400081)(944501161)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041288)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:AM6PR0502MB3862; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM6PR0502MB3862; x-forefront-prvs: 0558D3C5AC x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(396003)(346002)(366004)(376002)(39860400002)(39380400002)(13464003)(199004)(189003)(110136005)(53936002)(54906003)(6506007)(74316002)(93886005)(6346003)(66066001)(14454004)(26005)(86362001)(5660300001)(53546011)(99286004)(478600001)(229853002)(6436002)(33656002)(8676002)(81156014)(3846002)(6116002)(102836004)(8936002)(55016002)(7696005)(25786009)(316002)(59450400001)(3280700002)(7736002)(3660700001)(97736004)(9686003)(5250100002)(2900100001)(105586002)(2906002)(68736007)(106356001)(76176011)(305945005)(6246003)(2950100002)(81166006)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM6PR0502MB3862; 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) authentication-results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; x-microsoft-antispam-message-info: oqYG0DoTPGPmA8dncUlER11wbm1EXQYjotV5xqfCLjydhnrgZbnZKNRl1UQz/oXn12iDMwnB7Tmrd2C+RX5Fag== 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: 49d29539-50be-45db-9a0a-08d56025a45d X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jan 2018 16:48:32.8728 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0502MB3862 Subject: Re: [dpdk-stable] [PATCH v3 2/7] ethdev: fix used portid allocation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Jan 2018 16:48:35 -0000 Hi Konstantin From: Ananyev, Konstantin, Friday, January 19, 2018 2:40 PM > > -----Original Message----- > > From: Matan Azrad [mailto:matan@mellanox.com] > > Sent: Thursday, January 18, 2018 4:35 PM > > To: Thomas Monjalon ; Gaetan Rivet > > ; Wu, Jingjing > > Cc: dev@dpdk.org; Neil Horman ; Richardson, > > Bruce ; Ananyev, Konstantin > > ; stable@dpdk.org > > Subject: [PATCH v3 2/7] ethdev: fix used portid allocation > > > > rte_eth_dev_find_free_port() found a free port by state checking. > > The state field are in local process memory, so other DPDK processes > > may get the same port ID because their local states may be different. > > > > Replace the state checking by the ethdev port name checking, so, if > > the name is an empty string the port ID will be detected as unused. > > > > Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple > > process model") > > Cc: stable@dpdk.org > > > > Suggested-by: Konstantin Ananyev > > Signed-off-by: Matan Azrad > > --- > > lib/librte_ether/rte_ethdev.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/librte_ether/rte_ethdev.c > > b/lib/librte_ether/rte_ethdev.c index 156231c..5d87f72 100644 > > --- a/lib/librte_ether/rte_ethdev.c > > +++ b/lib/librte_ether/rte_ethdev.c > > @@ -164,7 +164,7 @@ struct rte_eth_dev * > > unsigned i; > > > > for (i =3D 0; i < RTE_MAX_ETHPORTS; i++) { > > - if (rte_eth_devices[i].state =3D=3D RTE_ETH_DEV_UNUSED) > > + if (rte_eth_dev_share_data->data[i].name[0] =3D=3D '\0') >=20 > I know it is not really necessary, but I'd keep both (just in case): > if (rte_eth_devices[i].state =3D=3D RTE_ETH_DEV_UNUSED) && > rte_eth_dev_share_data->data[i].name[0] =3D=3D '\0') >=20 Since, as you, I don't think it is necessary, searched again and didn't fin= d reason to that, What's about=20 RTE_ASSERT(rte_eth_devices[i].state =3D=3D RTE_ETH_DEV_UNUSED); Instead? > Aprart from that: Acked-by: Konstantin Ananyev > >=20 > > return i; > > } > > return RTE_MAX_ETHPORTS; > > -- > > 1.8.3.1