Skip to contentSkip to conversation

examples/kni: add dev close step when kni free

PATCH Applied Min Hu (Connor) 3 participants 3 messages Sep 14, 2021 – Oct 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 examples/kni: add dev close step when kni free

From: Huisong Li <[email protected]>

This patch adds dev_close() step to release network adapter resources when kni free.

---
 examples/kni/main.c | 1 +
 1 file changed, 1 insertion(+)
examples/kni/main.c +1 -0
index beabb3c848..2a993a0ca4 100644
@@ -1031,6 +1031,7 @@ kni_free_kni(uint16_t port_id)
 	if (ret != 0)
 		RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
 			port_id, rte_strerror(-ret));
+	rte_eth_dev_close(port_id);
 
 	return 0;
 }
Signature · 1 line
2.33.0
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Min Hu (Connor)

From: Huisong Li <[email protected]>

This patch adds dev_close() step to release network adapter resources when kni free.

---
 examples/kni/main.c | 1 +
 1 file changed, 1 insertion(+)
examples/kni/main.c +0 -0
index beabb3c848..2a993a0ca4 100644

examples/kni/main.c kni_free_kni(uint16_t port_id) · line 1037

Quoted 7 lines
examples/kni/main.c +1 -0
@@ -1031,6 +1031,7 @@ kni_free_kni(uint16_t port_id)
 	if (ret != 0)
 		RTE_LOG(ERR, APP, "Failed to stop port %d: %s\n",
 			port_id, rte_strerror(-ret));
+	rte_eth_dev_close(port_id);
 
 	return 0;
 }

Closing the port not directly related to the 'kni free', just both done before exiting the app, so I would update the patch title to something like:
examples/kni: close port before exit

#2 lore raw

21/09/2021 09:48, Ferruh Yigit:

Quoted 6 lines · Min Hu (Connor)
Quoted 5 lines

From: Huisong Li <[email protected]>

This patch adds dev_close() step to release network adapter resources when kni free.

Quoted 8 lines
Quoted 2 lines

Closing the port not directly related to the 'kni free', just both done before exiting the app, so I would update the patch title to something like:
examples/kni: close port before exit

Applied, with suggested title, thanks.