From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr60060.outbound.protection.outlook.com [40.107.6.60]) by dpdk.org (Postfix) with ESMTP id 075F2A84F; Sat, 20 Jan 2018 22:24:45 +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=ZgPWc0v0883zCMYltrKANnTaQYgInFTiZfi8Cn1FIfQ=; b=CB5V0CHWC1padiKJlBZiXcXuHGksKj87TeMzfzoLnHpxW5SO70TLEe3faInc1/0lGEpmPTtxsIrMBM+SBwlY9UypPSrfGdNjvpZPxcDLDnWZqUVvnidSxlpMX7/WF/gV9/gafm67ETYviggpqYCgUIgqbOkqOKdQvL44Y+TRUvk= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0502MB3804.eurprd05.prod.outlook.com (2603:10a6:7:86::30) 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 21:24:43 +0000 From: Matan Azrad To: Thomas Monjalon , Gaetan Rivet , Jingjing Wu Cc: dev@dpdk.org, Neil Horman , Bruce Richardson , Konstantin Ananyev , stable@dpdk.org Date: Sat, 20 Jan 2018 21:24:23 +0000 Message-Id: <1516483468-9048-3-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516483468-9048-1-git-send-email-matan@mellanox.com> References: <1516293317-30748-1-git-send-email-matan@mellanox.com> <1516483468-9048-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0402CA0047.eurprd04.prod.outlook.com (2603:10a6:7:7c::36) To HE1PR0502MB3804.eurprd05.prod.outlook.com (2603:10a6:7:86::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 21c7dc7b-d956-469c-5e20-08d5604c39e7 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:HE1PR0502MB3804; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 3:1WXKq3TI7O+h5sUZwHWaYdnkZK8XrphfH9iQ7VJQBF0xQwjnXbhZvguRpGBBaHhl6qoICvH3CqK6VvG2qxSTHEk2/KMmjkC4ynkAWTtGNAhq5e/XxyRc2daSedbRX2IwJrPlARIqxmvD0NuI6DNN/8Q6uIq2aw/zGxKfSqjEzEHRZXpARLNfIxAgn9/i4TiOYhoj4glGigADVM0vwSyj9rEACIF+bpR2ChQIk5Xf/CXFobGWWJ4YkEo9B7bXWvUZ; 25:S9q5qi42TBO7xRKUuCoOo3MV7Iy/+wt1VGUsu1yCb7zo8lwH1ttDYL8RyeCQuAIfbpMjO2blUj967z00Po30ByaSPrYRASt+L6ow6qZbjVaBkBiwm/+jqa4aoSEtVIctzbdaj7dBvE0iPv2EZj4c1KFsMKTMviPt0RmpRSF3/gZ0sRs+MQrhQzuDfL8zkj4DzgWWGsWVo3cjZlSEO2Sb6C9tupSfpX8Mpbs8isLxQBivrr0E572gIAcN09FOP/d0a8/MLWinfbuGzbza7TYA1Zojd5P7X7f1Xx7wT9u1VLTEyrubTXCY7yhj8axJ9hfn251OiOjZp5LK4x3k7W9isw==; 31:GQJeEkZNwvZtu8SUoFkSW0EmFZST6S69wfTpwcupNNUE+t8GVFUMrdC74AAVk9kCgpsfnPG7Om4uQgGcIe1ngLUvHHt2EQhACcjI44/OZ1YLjDKGlrTkyijAMZN91YGV7ACRR4BPn3XWuPoO5k++JMfZU8tYtyLI7vvKQQntRwbMCeUU5hf4F+behp7kinNXClEJ45DsKN3wdprCtzaXk8KDfmdmR9X7Yh388YLxNMI= X-MS-TrafficTypeDiagnostic: HE1PR0502MB3804: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3804; 20:rAYIgNqrJaAeYG2SvYnVxBiORiRzgTeftGOTJuDfuPTKnZ+TgWgJdpaY/B2/O+fd0zEMW/cQREyuUU2D64H+NSgr7ulpq7ljgoIiCV/ojp8hoccpV4NRWeglJ28tbwd6GHCu7DTNAB7KlLeqyBHC0GqFCBSYPatK1MbcJwEO9BlF3vdiVoqstej3EQXu/jJD1v8ic5kNy0GvI5oY9VnJ3pdmVV0ZCEJxLEE5qCZmfBrkxOpbnas8afX9aTzGqUbuf48F4T6sYbnTqC+FdPu6j+Yg3/vIlSLQwmIbp6xVIfGsY4F38K2fu4PaBIVMldde2NCCt09T/qs6c6ELl/JzA91PChlLurHVXCpVqk45auaemwNtty9vBDIpfs7PAjgkmk5ucQ2c0NuJ4EERrSEE8PsThaw/jIlD99oykccnYJHnFMC3/0/FsxQAVvOTfQTjG5MahAT6HENHHSsbWb7MP4xOsV0RGKetLi/H5wSvdrLULtA5W8FJub84radaJd/M; 4:Ix9wN+e3l4IewZARsMhXFU877Dw2u0ktZ3QCOI9VFfQC0ZpsZOolRz94qohXN7nTiHM2cpriS4j+GCNUwvstmweXMRx9VTtJA1rwd+UfrCZBXgtAEgN8RI8uBo6kTfxW+8YEad7oJY0n4G124yOilLy5fe1HiOt+5Im4UBCEg7YilvEFLLg6g5pVHoS4CmUIkV72NcBOEiuQ/ig80lDDmhGaL/16TiltsYBap72e7oSP0PNMhxFvcWEZ5acXO9uvhvEnxNxw8UZM0Xs/xuLYM8dLMv4m52y7Wj4bQD33RFo1RyA8cN61Q4VrfOdrNyxA8v8L4Tw8KZSCbXRG6A6lyg== 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)(8121501046)(5005006)(3231023)(2400081)(944501161)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041288)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR0502MB3804; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR0502MB3804; X-Forefront-PRVS: 0558D3C5AC X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(39860400002)(39380400002)(396003)(376002)(366004)(346002)(199004)(189003)(97736004)(53936002)(26005)(8676002)(305945005)(66066001)(2950100002)(6666003)(69596002)(86362001)(55016002)(68736007)(50466002)(4720700003)(21086003)(48376002)(6116002)(50226002)(478600001)(25786009)(36756003)(2906002)(5660300001)(4326008)(47776003)(110136005)(52116002)(54906003)(33026002)(105586002)(8936002)(81166006)(386003)(7736002)(106356001)(316002)(59450400001)(81156014)(16526018)(7696005)(51416003)(76176011)(3846002)(16586007); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3804; H:mellanox.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) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0502MB3804; 23:8ZuJh40BgixmY1SyQ/vtHp35m+UgaYt98MW+qAv?= =?us-ascii?Q?KBxuUd16q71IbTzHKL3zJ5Je4gUGcBPUJbUpYu4wsfJPFM2QFpYtf9+f7y0n?= =?us-ascii?Q?j858xLlEV1V1qdaW/sAARYK0G1bI7vFSD+OVVmh6L8q/wKNiEI4ySLsToqGh?= =?us-ascii?Q?LIlKcPsfAN7lzs4dv6a4Yii8zCdewIpKIKOwMmr3TFUsWJQceC7GZZ03r7va?= =?us-ascii?Q?e395fz161QYUgZa3ralEFcxxXzu4f51u9yrDilbvrxH9/nKs622GIzSEq1w5?= =?us-ascii?Q?lLYDXl+yhntKP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ellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2018 21:24:43.4600 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 21c7dc7b-d956-469c-5e20-08d5604c39e7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3804 Subject: [dpdk-dev] [PATCH v4 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 21:24:46 -0000 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 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 23b7442..3a25a64 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -164,8 +164,12 @@ struct rte_eth_dev * 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; } -- 1.8.3.1