From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CDC4B374; Sat, 20 Jan 2018 18:26:59 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2018 09:26:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,387,1511856000"; d="scan'208";a="20974124" Received: from irsmsx153.ger.corp.intel.com ([163.33.192.75]) by orsmga003.jf.intel.com with ESMTP; 20 Jan 2018 09:26:56 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.236]) by IRSMSX153.ger.corp.intel.com ([169.254.9.34]) with mapi id 14.03.0319.002; Sat, 20 Jan 2018 17:26:55 +0000 From: "Ananyev, Konstantin" To: Matan Azrad , 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: AQHTkHpove1QfrwpX02fYFpbHvt5cqN7I/DggAHYHQCAAAqIsA== Date: Sat, 20 Jan 2018 17:26:55 +0000 Message-ID: <2601191342CEEE43887BDE71AB977258862812B2@irsmsx105.ger.corp.intel.com> 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: Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNjYyYzg1MzktOTcxMC00NjU0LWJjOGUtZDk4YzZkN2FjNTY4IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6Ik56VExwMXhhUllkUWVrTkE3d00rRGdxV0RDSkw2NzJpcVJwVlc0ZlMzYzA9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v3 2/7] ethdev: fix used portid allocation 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: , X-List-Received-Date: Sat, 20 Jan 2018 17:27:00 -0000 Hi Matan, >=20 > Hi Konstantin >=20 > 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') > > > > 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') > > > Since, as you, I don't think it is necessary, searched again and didn't f= ind reason to that, > What's about > RTE_ASSERT(rte_eth_devices[i].state =3D=3D RTE_ETH_DEV_UNUSED); > Instead? Sounds ok to me. Konstantin >=20 > > Aprart from that: Acked-by: Konstantin Ananyev > > > > > > > return i; > > > } > > > return RTE_MAX_ETHPORTS; > > > -- > > > 1.8.3.1