Skip to contentSkip to conversation

app/testpmd: fix vm_hotplug after removal of rte_eth_devices

PATCH In review Paulis Gributs 3 participants 3 messages Jul 28, 2021 – Jul 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix vm_hotplug after removal of rte_eth_devices

After removing rte_eth_devices from testpmd the vm_hotplug no longer recovered after removal of a device, this patch fixes this issue.

Fixes 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")
---
 app/test-pmd/testpmd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
app/test-pmd/testpmd.c +5 -3
index 63da63eb3c..6cbe9ba3c8 100644
@@ -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);
 }
Signature · 1 line
2.25.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Gributs, Paulis <[email protected]>
Sent: Wednesday, July 28, 2021 21:49
To: Li, Xiaoyun <[email protected]>; Yigit, Ferruh <[email protected]>
Cc: [email protected]; [email protected]; Gributs, Paulis <[email protected]>
Subject: [PATCH] app/testpmd: fix vm_hotplug after removal of rte_eth_devices

After removing rte_eth_devices from testpmd the vm_hotplug no longer recovered after removal of a device, this patch fixes this issue.

Quoted 6 lines
Fixes 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")
---
 app/test-pmd/testpmd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
#2 lore raw
Quoted 11 lines
Quoted 9 lines

After removing rte_eth_devices from testpmd the vm_hotplug no longer recovered after removal of a device, this patch fixes this issue.

Fixes 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")
---
 app/test-pmd/testpmd.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Adding a bit of explanation:
"because the port was closed before querying it." About the title, vm_hotplug is nothing in testpmd, and the problem is not limited to VMs.

Applied with rewording.