[v1,03/17] examples/vdpa: fix devices cleanup

Message ID 20220606114650.209612-4-lizh@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series [v1,01/17] vdpa/mlx5: fix usage of capability for max number of virtqs |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Li Zhang June 6, 2022, 11:46 a.m. UTC
  From: Yajun Wu <yajunw@nvidia.com>

Move rte_eal_cleanup to function vdpa_sample_quit which
handling all example app quit.
Otherwise rte_eal_cleanup won't be called on receiving signal
like SIGINT(control + c).

Fixes: 10aa3757 ("examples: add eal cleanup to examples")
Cc: stable@dpdk.org

Signed-off-by: Yajun Wu <yajunw@nvidia.com>
---
 examples/vdpa/main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Patch

diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 7e11ef4e26..62e32b633d 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -286,6 +286,8 @@  vdpa_sample_quit(void)
 		if (vports[i].ifname[0] != '\0')
 			close_vdpa(&vports[i]);
 	}
+	/* clean up the EAL */
+	rte_eal_cleanup();
 }
 
 static void
@@ -632,8 +634,5 @@  main(int argc, char *argv[])
 		vdpa_sample_quit();
 	}
 
-	/* clean up the EAL */
-	rte_eal_cleanup();
-
 	return 0;
 }