From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 7F465A48D; Fri, 19 Jan 2018 13:40:04 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jan 2018 04:40:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,381,1511856000"; d="scan'208";a="194656197" Received: from irsmsx154.ger.corp.intel.com ([163.33.192.96]) by orsmga005.jf.intel.com with ESMTP; 19 Jan 2018 04:40:01 -0800 Received: from irsmsx112.ger.corp.intel.com (10.108.20.5) by IRSMSX154.ger.corp.intel.com (163.33.192.96) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 19 Jan 2018 12:40:01 +0000 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.236]) by irsmsx112.ger.corp.intel.com ([169.254.1.12]) with mapi id 14.03.0319.002; Fri, 19 Jan 2018 12:40:00 +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/Dg Date: Fri, 19 Jan 2018 12:40:00 +0000 Message-ID: <2601191342CEEE43887BDE71AB97725886280A89@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> In-Reply-To: <1516293317-30748-3-git-send-email-matan@mellanox.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTZkMzc1OWYtOTk3Yi00Njc5LWI5NjAtMDc1ZDQ3NmY5NDhhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE2LjUuOS4zIiwiVHJ1c3RlZExhYmVsSGFzaCI6IkR1VGN6RmZMbFczMUZFY1NRTGZUZGNPNDBzbmF0UUc0bFEyVjE3ZnBMc1U9In0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: Fri, 19 Jan 2018 12:40:05 -0000 > -----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 >=20 > 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. >=20 > 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. >=20 > Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple proces= s model") > Cc: stable@dpdk.org >=20 > Suggested-by: Konstantin Ananyev > Signed-off-by: Matan Azrad > --- > lib/librte_ether/rte_ethdev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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; >=20 > 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_shar= e_data->data[i].name[0] =3D=3D '\0') Aprart from that: Acked-by: Konstantin Ananyev > return i; > } > return RTE_MAX_ETHPORTS; > -- > 1.8.3.1