[PATCH] examples/ntb: remove redundant logic for dev close

Junfeng Guo junfeng.guo at intel.com
Wed Jun 14 07:14:23 CEST 2023


During EAL cleanup stage, all bus devices are cleaned up properly.
Based on this, there is no need to do extra device close process,
which may call the dev ops '*dev->dev_ops->dev_close' twice.

If this dev ops for ntb was called twice, the interrupt handle for
EAL will be disabled twice and will lead to error for the seconde
time. Like this: "EAL: Error disabling MSI-X interrupts for fd xx"

Thus, this patch just remove the redundant logic for device close.
Ports will be closed at rte_eal_cleanup() in the main loop.

Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
Cc: stable at dpdk.org

Signed-off-by: Junfeng Guo <junfeng.guo at intel.com>
---
 examples/ntb/ntb_fwd.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c
index 585aad9d70..3385b4b73c 100644
--- a/examples/ntb/ntb_fwd.c
+++ b/examples/ntb/ntb_fwd.c
@@ -177,13 +177,11 @@ cmd_quit_parsed(__rte_unused void *parsed_result,
 	rte_eal_mp_wait_lcore();
 	in_test = 0;
 
-	/* Stop traffic and Close port. */
+	/* Stop traffic only. */
 	rte_rawdev_stop(dev_id);
-	rte_rawdev_close(dev_id);
-	if (eth_port_id < RTE_MAX_ETHPORTS && fwd_mode == IOFWD) {
+	if (eth_port_id < RTE_MAX_ETHPORTS && fwd_mode == IOFWD)
 		rte_eth_dev_stop(eth_port_id);
-		rte_eth_dev_close(eth_port_id);
-	}
+	/* Ports will be closed at rte_eal_cleanup() in the main loop. */
 
 	cmdline_quit(cl);
 }
-- 
2.34.1



More information about the stable mailing list