From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0073.outbound.protection.outlook.com [104.47.2.73]) by dpdk.org (Postfix) with ESMTP id AD5D02B82; Thu, 3 May 2018 12:32:18 +0200 (CEST) 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=YThYYYNgyZ5QH6K7hZc7K+nxYrzIlbLTO+84MCHoFfw=; b=xtZy3eNFaHjF3CCQD/Av+XwHpSZRreDQ5F1E+ViDHtTXau4Qzs8G0d9WrH2EaeOOAIQyh4RQmioxaXbwBC6bMGPgykuJDNo4uobuvXcDfjc2VQrsOLf0UYHpUi+bZWbafOzSDjPhtNobwDBfhteh/PmFm4pYrZPr9VbnJcDVr2A= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=matan@mellanox.com; Received: from mellanox.com (37.142.13.130) by HE1PR0501MB2665.eurprd05.prod.outlook.com (2603:10a6:3:cb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.22; Thu, 3 May 2018 10:32:16 +0000 From: Matan Azrad To: Wenzhuo Lu , Jingjing Wu Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 3 May 2018 10:31:48 +0000 Message-Id: <1525343508-29487-7-git-send-email-matan@mellanox.com> X-Mailer: git-send-email 1.9.5 In-Reply-To: <1525343508-29487-1-git-send-email-matan@mellanox.com> References: <1525343508-29487-1-git-send-email-matan@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [37.142.13.130] X-ClientProxiedBy: HE1PR08CA0058.eurprd08.prod.outlook.com (2603:10a6:7:2a::29) To HE1PR0501MB2665.eurprd05.prod.outlook.com (2603:10a6:3:cb::19) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2665; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 3:1jtmUjpnF2msjNi9WLJVr8pRwNdhFzzdi495dYdfAJcRRnxas9rC9XHqDJzwfoQshhOntXFN0UVLpU4wZeI3Cp+Ybg/1zI1kYLmpON8mMZ1lBzziXkttT0Yp0MsKsLt11ai9+x9vDypFiNU4TOTbOD/LYod9L6W1H5B0qJfQRs3j2qG5ZaZI5iVT00nge7NoXY0cO4UL0MEqJFODZx9Thpofx4i8/pdz0afQ38TxaFxIUg5SLLREPZgoA08wccho; 25:F7bYqS6WKpr/ra290OKu8UQI1W394FQXgKeX2wYOjNVHPbQmet/9RI7JsiCCozdSWpSVbz9nXSznYzYLwz6xRecHcRzZ1QwX+e9ligpap3t5KpOHF7nU4UsB0CqT5kiY+a2rfLheIUDTPDJVIFxN+DcXLAGJUu2qaWW59ZFbiDSptnID7rZx0G6ZFib5G2z37sMPxXFMfw+qS6Q4eG/rp4WuMw/JU//kXOLa4dLElsGxUCW/hUpkpIeWF2GrPlZ2973LN3K1wE5raRVnKEtaDMZTFAqAx2G+jCkDZX5nDpIh9eFFCPWb4r9gS9iuS0RgWa3kDLVsuL5ctHjJ3HYqgQ==; 31:u2etFqvc3183QGeimUqf83w3TJtmXwLvXg7PwH3IEbr150vpXvvoANTfG8LgWN+/4WXbtXE5FM4rQlYsoaGcfjfOWjq0srjiwbxwlWTh7ZyClM+zelyDhA+mvPvBy7RYqbLPQ+iQtrjEHr3fBlnYxUv9wJ2fRBp+PiV2ChmAu3+KqkqIftMiDoQvLga8mjJqdT8Q++smf+2UJ5EVY19U/Dt5F3tB8HtJPqFypCB5ZJk= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2665: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 20:G4viaCAPR5ytQlu086Mj67SdP74FfV3wBhceTiF0vxn+lJI4JVOnRxDFyjC0iDAlFHPC2RgMkU8i07mg9FuCWYkZUJJvoIK6R0hpJtI4c8HNgisQH8Mmj/YN0etykvu1oxbwm9hYN+r6hkuC9h2jnTftHlJ2ZGflXt3o5mtYTSMwyKT3lHdfwRNMSL3dAvzDT357VNt5RBwdZJUf7TTeULNQlSrZEnvo+fkGlhFjakjr5pEx+/+pryYpJdyRYQEYfFER1eQt2b2rexZhDEX2DfMf7hAFC8weCyG/uZCJhfohWwUZ4hwN2SsG5lNsIGk4zixXEYEw66ZaaNiygNdWFsr9GTvSMZ49HgBQ3YwOdjubDSXyQSjZjm+wPaSVu7QT0xzPdtWYLrTkatWQVrHjFN7mYtzvPf145ObblEfTB2n9AMBVMYd5lHsUuGdzeVE87GuXiFPpnDFGmb0e+Vk7oNp1ssA15UhT2hsi+FL4Ul3Z3/SdaLKsVxHEFEVmkkCM; 4:w0yvlyZ+1o2WpI9U4X2MjWv500P/2RgxYmuVjRfdhKAwooOghvdRYRuBvebybf7DgGcWM6/5icxEpnbUCN3Dl1s7FpR1IWrMLo4kt12rUk5MvQ0GwP+i5ujgP1+CM5lz/CPMUwmqN2lcXVnd/lCyaSW3z8qXIzkHnMqVfSIwd/OHLP8QNmUONUCJmDhRfMZKZXQ36lr3VuoRjETnQT/DJb6tzV+OpA+KEUr/HzAkifcic0JhCRreiGXMftAzTZihpfyZANiIpFdD/dMRQjTPfA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(3231254)(944501410)(52105095)(93006095)(93001095)(10201501046)(6055026)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011); SRVR:HE1PR0501MB2665; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2665; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(376002)(39380400002)(39860400002)(396003)(189003)(199004)(97736004)(47776003)(316002)(52116002)(51416003)(36756003)(7696005)(86362001)(25786009)(16586007)(110136005)(68736007)(5660300001)(2906002)(8676002)(81166006)(81156014)(8936002)(66066001)(53936002)(3846002)(6666003)(26005)(305945005)(33026002)(11346002)(69596002)(186003)(106356001)(386003)(50226002)(486006)(55016002)(105586002)(4326008)(6116002)(7736002)(76176011)(446003)(478600001)(476003)(21086003)(59450400001)(48376002)(50466002)(2616005)(956004)(16526019); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2665; H:mellanox.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2665; 23:Q0oabMGQrJ9gpwFEZ5UQF+LHAUfIlf8flJP7oF7?= =?us-ascii?Q?h346nzmV5wK3VquzAjbHNFgYckPmJX9apFUWhGKRBOBuWFH1UIYT0qx0e56P?= =?us-ascii?Q?ZzYncjCTT2xoBh1+a3RFyZxHjM9+Z1neHz38lMwH3yPNPj9aoNcJ+uzWkjqr?= =?us-ascii?Q?sP0SubLK9ssmLoeSLk9IAxy25zyM5Ee3T90KSyo0bjUPrNm80wwSlOcm/Rvz?= =?us-ascii?Q?L7SaQM0EFTkE86SEmj7bswszr2/mD6o/ilK787XJpBQdSVSwkG7BcHpDJBIl?= =?us-ascii?Q?01kqIA/DKI99QLYJJfdgdOJtQPVkjNvfOR7cLgrysh1PCFkv61PPui46KRwJ?= =?us-ascii?Q?4iySZlqUUXTe1XDL4FRxN/MpIY/QB5zxYeaGj4ee2/rAvXGiTed90eLpI0Tp?= =?us-ascii?Q?zZGg+PWX3ANi00oN2pM21u2Pc/KZqKXmH11GYv+/ECTN/YVyRMCPzVnGLPoW?= =?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wV3EcVGd5k1wO1NQA+unBgi7pRls8heou4IN//h5pWAPzWsfuJamadM5C+x++QsUqdxq92BIb1Jqc2R0qMzEN/+wrte8GuacAalHTyCXj4RP3lPUspJjtgt0liLN3XBb6bx X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 6:5EIP9pW54wGhyk6sPTT01gnRGGVmvAMYaJdJJd6naJiCpVXO7OmrAscXKAPjzK/Gkroqk80aZkzD/5WWYiqTVzpAxYd+goKwhuGD12aXn8PElHg5IyKAd3+hPF+3wxECG4B3h3wiKZyYin0z13FRseTtMQ1G4J299U9Ve/WfzSsFAdfOD9FZPJC7T6gyNRFP3NWLyZXwPXxjRVEVjWUzSe5a54s+FZrdHF+usRHAiYNdjKUIS6UKeWwPCZQma8HFHWIAayFLy+UucUiXEWyQ17Gx9spYpuCF+bPOi3/wVmESHL3Vb0EqREO4aOzwrcKavBqvHdkvjv4tfQi2fa1/VW5Mex6jQRzhgLKFUuDmzsWKRWOUr78py1rpAmE5c3ijLEd/S784XFpPtmrIXHvDeSqIs/jQ93M2mC9hka88FxrUR3b49rNDizQkTgvYjwS8nXlIY5+bJlNQVvEd2Ck5Nw==; 5:pg2N5tc3HqVf63ZL34Z2QgvzOAKFMZDhUCT3MxE7MssqyCGzTGeU+jigsZjGa8/x1LGqHCVcLyVSz0vARKpNcSsGILDyOX/SCYfbBAnfeYzKsGWESuwy7QwnbEJSIpTfmprkI0ewd319Wyy4qxUQqPHrjqMwvcVQVODyzXYA/94=; 24:qbzjrMP+5JTMWF5vA8QjZgpfr8dsqnjTx+5lc8eiNAWef2u0+5HMZuqirtMjMKSuqlBZLkp8UIJRDfirBYPsP0sNPMbo7IfxdQeW8W0secs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2665; 7:9ECjIhcbkw6EmAuBWYbveoZz5Qs7lipKLWogXWNm0FTbB+8DX2x4OZHZ1+eZa6E5O3IkAMqen4aD5FYv95AgXy5b8kVuVArG7OFsiGlMtBbqXjs1cSbKyVBsbKY8KTb04sB7cwt8YKHsFntNo2uhQFNavxQkHK+sZIPygHOJMg3SFu3ycej6AN0neoN5c8n0Sc6asstKnCxP4SJAky4lWqAEmi8+P3FQoth9qRgKPWxEZha/+oq8oDKIRMMrxWOe X-MS-Office365-Filtering-Correlation-Id: ec63b0b3-f219-4635-a4cd-08d5b0e124d4 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 10:32:16.7026 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ec63b0b3-f219-4635-a4cd-08d5b0e124d4 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2665 Subject: [dpdk-dev] [PATCH 6/6] app/testpmd: fix asynchronic port removal 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: Thu, 03 May 2018 10:32:19 -0000 When a removable device is plugged-out, a RMV interrupt is invoked and the application can catch the event in order to stop the device management. The Testpmd wrong behavior in this case is to detach the removed device using the EAL detach API. The EAL API does not invalidate the ethdev port and the port keeps appearing as valid from the ethdev point of view. Thus, the next operations for the ethtev port X may trigger an invalid rte_device access. For example, calling "show port info X" may cause segfault. Moreover, the removed port is not removed from the Testpmd data-path structures. Therefore, the invalid device may still be used by the Testpmd data-path. Call the Testpmd detach_port() function which uses the ethdev detach API, and prepare the Testpmd forward ports database for a new forwarding session without the detached port. Fixes: 284c908cc588 ("app/testpmd: request device removal interrupt") Cc: stable@dpdk.org Signed-off-by: Matan Azrad --- app/test-pmd/testpmd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 33a9e96..2edf644 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -2096,21 +2096,23 @@ struct pmd_test_command { static void rmv_event_callback(void *arg) { + int need_to_start = 0; int org_no_link_check = no_link_check; - struct rte_eth_dev *dev; portid_t port_id = (intptr_t)arg; RTE_ETH_VALID_PORTID_OR_RET(port_id); - dev = &rte_eth_devices[port_id]; + if (!test_done && port_is_forwarding(port_id)) { + need_to_start = 1; + stop_packet_forwarding(); + } no_link_check = 1; stop_port(port_id); no_link_check = org_no_link_check; close_port(port_id); - printf("removing device %s\n", dev->device->name); - if (rte_eal_dev_detach(dev->device)) - TESTPMD_LOG(ERR, "Failed to detach device %s\n", - dev->device->name); + detach_port(port_id); + if (need_to_start) + start_packet_forwarding(0); } /* This function is used by the interrupt thread */ -- 1.9.5