From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30058.outbound.protection.outlook.com [40.107.3.58]) by dpdk.org (Postfix) with ESMTP id AE931A488; Mon, 22 Jan 2018 17:38:46 +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=HscrDyH8EP457NGNMWyw4WQUqAjam8zO6d2r6D954UI=; b=XukQghU9pMKA1vghU8UexGBcAl5RbzgwD9UXfSDiodvKkgTQb+eUEkUQYcHtozrrPRlrl/4ic5dhcmJUnEqAWPebvCNflIcdbnaa82sKGl1IMpqgnsB+p4HiBxeXW6WYbVE5IK+7VlmA2RMtzygK37sSvDVlXGEA/nAAy7UHfmI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0502MB3802.eurprd05.prod.outlook.com (2603:10a6:7:86::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Mon, 22 Jan 2018 16:38: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: Mon, 22 Jan 2018 16:38:18 +0000 Message-Id: <1516639103-27166-3-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516639103-27166-1-git-send-email-matan@mellanox.com> References: <1516483468-9048-1-git-send-email-matan@mellanox.com> <1516639103-27166-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR0102CA0058.eurprd01.prod.exchangelabs.com (2603:10a6:7:7d::35) To HE1PR0502MB3802.eurprd05.prod.outlook.com (2603:10a6:7:86::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 762cbca0-b31b-4a20-6d1c-08d561b69a62 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4604075)(48565401081)(2017052603307)(7153060)(7193020); SRVR:HE1PR0502MB3802; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3802; 3:ic5wbbaDoDsppPqABHzOTMTEyAFSG9n2Gpda9Yb/XJOmlHf5118sPpKTLVaUeMYFMh4TuLkkWSewN5O22kn4L+6QNTaB5XrLE3tRJ/8b6BHfCYF8CVCSwj4h2GYCQKzOyXI09coDZaIReSAKXdYHQMpFVh/4InJoL4BycU8P2MTTeFfiXbqOSrzEsipg21xWxLCzrRF9pmAwU70hDRihynFWTl7bgGjj2isCS62RLAZzRcMbj3FFPL1cPTQ9SIIC; 25:ko4GgL4FvQ/NEteOuOZc3duu947XwEbvD+KaPa6Shqx/uHdTg7khf9JmjeKsygv8JfOC6mjjJ1R2p8M/QllhqOTwIHrzemslhzFgO/sS6SSPp/OjbnnhhJ2xbV5syT9AthhgoXp4U1BqryNp5LuGSD+BMfIKxjAequj1GEErONl8fQSldUlTsYUFW/zK01u1YTuh4adRc3/EOuFjVN09RQnM4imj7wFH6JN4ku/QGw6Hdh4vsQhHqQ4R3oKmFxydj3pcwcxEkQDFneIwyC/cXNneQK3QpIekPSHq8AxEMdJbUEUUp46+pMgps7lXQLTUh1RZYmGruz/0kKhRGnjzgg==; 31:I9o5d8Sy7KDtm/ljWNOlA6on8Jnqxb+7/Jdi4Y7KKr+JZA499F5jVtymFHY/iFcJdKlCvpnw+GMzlWY+bQXRVOgoMvoh4x/fMMYJ87OfNACc+ZOv/KPQ7gD5g1qpgw29czIGqx3KLQKLl9kO6NDTD3hjSBFZBxdCIsuonoA/9u5+KjrZtY7aZ9dgGzV1CLInpCAwvaZ6Rh178I4+mgrKpVmVMFg1QKL/EBlM3vTsloY= X-MS-TrafficTypeDiagnostic: HE1PR0502MB3802: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3802; 20:SeK7foDsvelaCBO1hBRoFWPB3bm9XNTUviWaK9qfg77x08VCsclOwka3bNIMqBNijohlImbQ1jYWTNQfdITSl0is+CiHsEwABUgsjRELPhsoxk3/7jsrXPQtO+Za5B4QJ8Hx0j+GDNDnLiCCwqc55k9wTwt70TQOn6vlDsWWNk4/UbJsz9ck56B/POGPOcExvNsf3yT7xOszXP9TjdQPALj1+2qSYmmv0nnoSLXNir9NKUgUgsL8h6Zhkwf54TKev9Lfj6ND2DagGQlrjCKb/dBDndPGV5k1dZnj9k1UQaGy21NaRv3T6dqYgYCUL8lXjySueOXy31s7EXG/QXOh0M4gw34xcW1cfJU1fp8NwQcSnZra6nhfRZ3uaeANRI6G9R+0GGDtcZNsw0OnuGX6e6qUm2cRpShb5tarUHbNGKnlmqvUJy72DJdy9QkDSYLphiWAEJXffuYPIjEOYaQ/77MCN0od315d+2XkHnKjg7MkOtu4ymEZuZonwhk8LR//; 4:eaSKueQ3MsBxUnTkSt9izbYuD7r7ZzFvPtlpElpFHYH/eaWGdOTw/EN90mCD5MjcACOix6W7z9q6b5OumWkbWYkFjx157/Qwxpx3EHGGwypeXIzwlfHsTGmtmU1aIVQ0ungG37gePSZ3/X7gh4I0ZYEBhdmekRQcMFURq2WvHruEDcHd0EkbrbMO09sQhZe+ILkMdYIRswqYjZ3wCl2J7M3cBR9j+NF9QsAxb2SYnz3WXOkCZve3d61vchxMj4lIHZHfujB2yytRuN3LidIMKn/bcCzRodbXuQygrgF0xqytNPW1Yr/X4cSUyuaRTNIxKCcan00sDVVM3XlvxKm/SA== 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)(93006095)(93001095)(3231023)(2400081)(944501161)(3002001)(10201501046)(6055026)(6041288)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123560045)(20161123564045)(6072148)(201708071742011); SRVR:HE1PR0502MB3802; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:HE1PR0502MB3802; X-Forefront-PRVS: 0560A2214D X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(39380400002)(366004)(396003)(376002)(39860400002)(199004)(189003)(5660300001)(53936002)(47776003)(8936002)(50226002)(2906002)(68736007)(4720700003)(55016002)(6666003)(2950100002)(69596002)(478600001)(76176011)(7696005)(316002)(52116002)(386003)(16586007)(36756003)(51416003)(59450400001)(6116002)(3846002)(16526018)(8676002)(81166006)(81156014)(66066001)(110136005)(48376002)(26005)(54906003)(86362001)(25786009)(106356001)(105586002)(50466002)(305945005)(4326008)(7736002)(97736004)(21086003)(33026002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0502MB3802; 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; HE1PR0502MB3802; 23:yH5AVMbPHwEXZLDioMFjFJydsPiICgT4s8qfBnO?= =?us-ascii?Q?NmEfgEq12RmJeXW4P0FbjZwSDQ1SLaPXP1clO9+uUaizhijmvC84p3FYJSRL?= =?us-ascii?Q?klIJqFnxKEmWTPSkqUwYTpIZonR3NRSZ4j3IZTyriGT70UdMoCTbXz3kH4sQ?= =?us-ascii?Q?rUOzUeGYa0ZI2HIFYYj7SswobMawuU+kh535S75MFwC+PnBQlm0wXs8Xzb/P?= =?us-ascii?Q?Suj6BfRPW4kkHnbuBaTxIlATxcLDks2jenzPIE6LBjdksXfGIJoNlNnNd1x/?= =?us-ascii?Q?E+zFaebCFv86MkTqJgVBKk3Xv7TOXI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WHsLdPzbpRYdyDIQbNhbqkmxVcbD//p+1A?= X-Microsoft-Exchange-Diagnostics: 1; HE1PR0502MB3802; 6:3xogjiwp+oxf2qOgd52j5K0D0L257aHGristODuiM4wLEmBSQ2bvHJdYj8UuYxq6h+3Yl4pmtL9vf0lxw7A/FFt1kK7dgxEhlVuWxXjR99BGxxCCnUm24Q5ls1B4ihahhSG8//0nYSaIgejPTHA8RXK1PW4prAINauhckcptUxJWqghr1UfO6gGXYTuUHT1j0yE9ZUqrWCIN9DqEO01AO5LyhtH/NsbZHvZX4WirvTY6K0UeYd7hr9xLHY+bLyXS1C4UYXjSz4/UsZgZSk5YzF6iG4y6r/MwhUvQRMRfBdQEERr49MHMAkbGTPB3Ej3SwXSh+fssxlMdc12qonSx88dyY0DE8Y2xm7PCi0Z7aV8=; 5:Cx3f/QCPZbV3gSeld0HzrPzAaNjO1EyGTe0rvrn4/iSFiOn2ujfvBoWC6/hrjVZ9CFu5Rcr12XCcmL83aRK7QaPkGyPE1R+W4q8hmIbP1cFkargY64x63a7r9w7FmZvIE1DZlPqB365BAMyUbcPx6YpoW729hzmzAoxTBWw5IP4=; 24:BnW73/MqqWvlbT73c9RYcQsck0t6eJHLMuaxlpFECMauqh3adWlEiBUYlaMBKpvMuGlMiShkZiEwnqXm/fnBDo2wCE4c9wlBH8YXYNj7RpY=; 7:/NF2bOYrNHl41LrWGQIsJO0jfmux+20O6bfW4xNUVm8Zthf2cY4mdL28Vgp999uV7IXlp12asnQ91Cl0qhMrIFSZRsf+QICefmsrSAAusUhWcyoWL5AiwiH2Xn+jJ9Vo3jseWhcBN/CefbYoQhtOSE/u7696hk3TT+x+2qIrmV/jkx+4CP8DaS6347wNz4O0qCwczKrhMrYR4hBG2xTEGmNoMGc1gbD5SAnxRYY+NSZPs8PQ6FwwuuTTDIPBBbdH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2018 16:38:43.1908 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 762cbca0-b31b-4a20-6d1c-08d561b69a62 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0502MB3802 Subject: [dpdk-dev] [PATCH v5 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: Mon, 22 Jan 2018 16:38:47 -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 c469bd4..e348b63 100644 --- a/lib/librte_ether/rte_ethdev.c +++ b/lib/librte_ether/rte_ethdev.c @@ -221,8 +221,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