From: Paulis Gributs Date: Wed, 28 Jul 2021 13:48:48 +0000 (+0000) Subject: app/testpmd: fix hotplug removal X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=e1d38504e16cdc7fbb977d9fc750a93cc784d37e app/testpmd: fix hotplug removal After removing rte_eth_devices from testpmd the vm_hotplug no longer recovered after removal of a device, because the port was closed before querying it. Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array") Signed-off-by: Paulis Gributs Acked-by: Xiaoyun Li --- diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 63da63eb3c..6cbe9ba3c8 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3197,14 +3197,16 @@ rmv_port_callback(void *arg) stop_port(port_id); no_link_check = org_no_link_check; - close_port(port_id); ret = eth_dev_info_get_print_err(port_id, &dev_info); if (ret != 0) TESTPMD_LOG(ERR, "Failed to get device info for port %d, not detaching\n", port_id); - else - detach_device(dev_info.device); /* might be already removed or have more ports */ + else { + struct rte_device *device = dev_info.device; + close_port(port_id); + detach_device(device); /* might be already removed or have more ports */ + } if (need_to_start) start_packet_forwarding(0); }