From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id 665112D13 for ; Thu, 1 Feb 2018 10:49:44 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 1EB5D2082E; Thu, 1 Feb 2018 04:49:44 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 01 Feb 2018 04:49:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=0UilRW6MQMb15B573 v6Xr29nCt4t8qvSvbiXE4cMBqU=; b=fbKETn1WWEazjz2kC7Y5CxCMR3ydywPpp GaF0sGV3GhDeQIPWtf6gtJfd2FJNscBW9KorJ4fdJVlz9+Uacm9dxJuYTE4h8HOf 8UOkV2zmVKyuCgIe8tYNNOdnEO40vIvihayFfb524PHzm7zaAGMIyCZAZ8SpFeWT YqeB6XLlANoJIdTGuX69C71tDws48qIAcMkule82V48NBoJ58OZ1mI0j5fsNl/Bq UyzGEFkNIW86niINr1WeNT9mJdc5mGtY0sWCFJsY0ZWU630S5IokwvhQa/LuPEZq KIY+UIDkUXVB2wJejuLKhnnhxk2BovtNVb8r5Y3VEmRofUdjh7jxg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=0UilRW6MQMb15B573v6Xr29nCt4t8qvSvbiXE4cMBqU=; b=DHJE/Eiv 0HArKbxVjvNagWfuZVlFGakJMwt6LpovdR1cf2eNecy8xQbQIU36MkXu8H450LsQ P6PVZjygOvR5XX6utDGaUFd/iUV9EIuzqcaHYQUwXTGKe6DNdo65ZZNP381QH9db bowm6691ejlkL6AavlKaW0t6h37oLuAHN/wooEzFVoM/lQspPvqEB2N5MIcecSHn nlsseBlxjFBl8lyXHiT4KhiSZTUSb75XAZdsFcs4Rj1km5FVA+SBW25WLLLMQWkq h4Proh5na/Eo8u0ZhPoZNbFu7CHtKH8J7Ocf8Bpb/zOhzs7nErMC2M0JDwsvnkGd I52Ot24TlBHJYQ== X-ME-Sender: Received: from yliu-mob.mtl.com (unknown [115.150.27.200]) by mail.messagingengine.com (Postfix) with ESMTPA id 6C7A6240B6; Thu, 1 Feb 2018 04:49:42 -0500 (EST) From: Yuanhan Liu To: Matan Azrad Cc: Konstantin Ananyev , Thomas Monjalon , dpdk stable Date: Thu, 1 Feb 2018 17:47:54 +0800 Message-Id: <1517478479-12417-40-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> References: <1517478479-12417-1-git-send-email-yliu@fridaylinux.org> Subject: [dpdk-stable] patch 'ethdev: fix port id allocation' has been queued to LTS release 17.11.1 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: Thu, 01 Feb 2018 09:49:44 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.1 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/03/18. So please shout if anyone has objections. Thanks. --yliu --- >>From 67abe74f3c09e6f166902c9fc5f4d7f65f7b3007 Mon Sep 17 00:00:00 2001 From: Matan Azrad Date: Mon, 22 Jan 2018 16:38:18 +0000 Subject: [PATCH] ethdev: fix port id allocation [ upstream commit 8ee892a2385c50427c03db5cef1789babceb5999 ] 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") Suggested-by: Konstantin Ananyev Signed-off-by: Matan Azrad Acked-by: Thomas Monjalon Acked-by: Konstantin Ananyev --- lib/librte_ether/rte_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c index 9dcb0d2..8ea85cd 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -192,8 +192,12 @@ rte_eth_dev_find_free_port(void) unsigned i; for (i = 0; i < RTE_MAX_ETHPORTS; i++) { - if (rte_eth_devices[i].state == RTE_ETH_DEV_UNUSED) + /* Using shared name field to find a free port. */ + if (rte_eth_dev_data[i].name[0] == '\0') { + RTE_ASSERT(rte_eth_devices[i].state == + RTE_ETH_DEV_UNUSED); return i; + } } return RTE_MAX_ETHPORTS; } -- 2.7.4