examples: add eal cleanup to examples

According to the programming guide, the rte_eal_init should be used pairs
with rte_eal_cleanup.

This patch add rte_eal_cleanup to examples to encourage new users of
DPDK to use it.

Fixes: aec9c13c52 ("eal: add function to release internal resources")
Fixes: 3d0fad56b7 ("examples/fips_validation: add crypto FIPS application")
Fixes: c8e6ceeceb ("examples/ioat: add new sample app for ioat driver")
Fixes: 4ff457986f ("examples/l2fwd-event: add default poll mode routines")
Fixes: 08bd1a1744 ("examples/l3fwd-graph: add graph-based l3fwd skeleton")
Fixes: c5eebf85ba ("examples/ntb: add example for NTB")
Fixes: b77f660028 ("examples/pipeline: add new example application")
Fixes: edbed86d1c ("examples/vdpa: introduce a new sample for vDPA")
Fixes: c19beb3f38 ("examples/vhost_blk: introduce vhost storage sample")
Fixes: f5188211c7 ("examples/vhost_crypto: add sample application")
Cc: stable@dpdk.org

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
This commit is contained in:
Chengchang Tang 2021-04-15 10:26:03 +08:00 committed by Thomas Monjalon
parent 027c931be8
commit 10aa375704
51 changed files with 166 additions and 2 deletions

View File

@ -1195,5 +1195,8 @@ main(int argc, char **argv)
ret |= rte_eal_wait_lcore(lcore_id); ret |= rte_eal_wait_lcore(lcore_id);
} }
/* clean up the EAL */
rte_eal_cleanup();
return ret; return ret;
} }

View File

@ -876,5 +876,9 @@ main(int argc, char *argv[])
prompt(NULL); prompt(NULL);
rte_delay_ms(100); rte_delay_ms(100);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -36,5 +36,8 @@ int main(int argc, char **argv)
cmdline_interact(cl); cmdline_interact(cl);
cmdline_stdin_exit(cl); cmdline_stdin_exit(cl);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -932,5 +932,8 @@ main(int argc, char *argv[])
rte_free(pd); rte_free(pd);
rte_free(pr); rte_free(pr);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -299,5 +299,8 @@ int main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -501,6 +501,9 @@ main(int argc, char *argv[])
fips_test_clear(); fips_test_clear();
cryptodev_fips_validate_app_uninit(); cryptodev_fips_validate_app_uninit();
/* clean up the EAL */
rte_eal_cleanup();
return ret; return ret;
} }

View File

@ -853,5 +853,8 @@ main(int argc, char *argv[])
/* Call lcore_main on the main core only. */ /* Call lcore_main on the main core only. */
lcore_main(cls_app); lcore_main(cls_app);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -258,5 +258,10 @@ main(int argc, char **argv)
rte_exit(EXIT_FAILURE, "error in creating flow"); rte_exit(EXIT_FAILURE, "error in creating flow");
} }
return main_loop(); ret = main_loop();
/* clean up the EAL */
rte_eal_cleanup();
return ret;
} }

View File

@ -43,5 +43,9 @@ main(int argc, char **argv)
lcore_hello(NULL); lcore_hello(NULL);
rte_eal_mp_wait_lcore(); rte_eal_mp_wait_lcore();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -1011,6 +1011,9 @@ main(int argc, char **argv)
rte_ring_free(cfg.ports[i].rx_to_tx_ring); rte_ring_free(cfg.ports[i].rx_to_tx_ring);
} }
/* clean up the EAL */
rte_eal_cleanup();
printf("Bye...\n"); printf("Bye...\n");
return 0; return 0;
} }

View File

@ -1075,5 +1075,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -1201,5 +1201,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -3076,6 +3076,9 @@ main(int32_t argc, char **argv)
rte_eth_dev_close(portid); rte_eth_dev_close(portid);
printf(" Done\n"); printf(" Done\n");
} }
/* clean up the EAL */
rte_eal_cleanup();
printf("Bye...\n"); printf("Bye...\n");
return 0; return 0;

View File

@ -805,5 +805,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -1140,5 +1140,8 @@ main(int argc, char** argv)
kni_port_params_array[i] = NULL; kni_port_params_array[i] = NULL;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -201,5 +201,8 @@ main(int argc, char *argv[])
/* Call lcore_main on the main core only. */ /* Call lcore_main on the main core only. */
lcore_main(); lcore_main();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -2835,5 +2835,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -716,6 +716,9 @@ main(int argc, char **argv)
printf(" Done\n"); printf(" Done\n");
} }
} }
/* clean up the EAL */
rte_eal_cleanup();
printf("Bye...\n"); printf("Bye...\n");
return 0; return 0;

View File

@ -1022,5 +1022,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -817,5 +817,9 @@ main(int argc, char **argv)
if (ka_shm != NULL) if (ka_shm != NULL)
rte_keepalive_shm_cleanup(ka_shm); rte_keepalive_shm_cleanup(ka_shm);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -902,6 +902,9 @@ main(int argc, char **argv)
rte_eth_dev_close(portid); rte_eth_dev_close(portid);
printf(" Done\n"); printf(" Done\n");
} }
/* clean up the EAL */
rte_eal_cleanup();
printf("Bye...\n"); printf("Bye...\n");
return ret; return ret;

View File

@ -2258,5 +2258,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -1123,6 +1123,9 @@ main(int argc, char **argv)
rte_eth_dev_close(portid); rte_eth_dev_close(portid);
printf(" Done\n"); printf(" Done\n");
} }
/* clean up the EAL */
rte_eal_cleanup();
printf("Bye...\n"); printf("Bye...\n");
return ret; return ret;

View File

@ -1405,6 +1405,10 @@ main(int argc, char **argv)
printf(" Done\n"); printf(" Done\n");
} }
} }
/* clean up the EAL */
rte_eal_cleanup();
printf("Bye...\n"); printf("Bye...\n");
return ret; return ret;

View File

@ -730,5 +730,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -268,4 +268,7 @@ main(int argc, char *argv[])
need_flush = 1; need_flush = 1;
} }
/* clean up the EAL */
rte_eal_cleanup();
} }

View File

@ -304,5 +304,9 @@ main(int argc, char *argv[])
rte_eal_mp_remote_launch(sleep_lcore, NULL, SKIP_MAIN); rte_eal_mp_remote_launch(sleep_lcore, NULL, SKIP_MAIN);
do_packet_forwarding(); do_packet_forwarding();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -121,5 +121,9 @@ main(int argc, char **argv)
cmdline_stdin_exit(cl); cmdline_stdin_exit(cl);
rte_eal_mp_wait_lcore(); rte_eal_mp_wait_lcore();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -472,5 +472,8 @@ main(int argc, char **argv)
rte_eal_mp_remote_launch(lcore_main, NULL, CALL_MAIN); rte_eal_mp_remote_launch(lcore_main, NULL, CALL_MAIN);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -1498,5 +1498,8 @@ main(int argc, char **argv)
start_pkt_fwd(); start_pkt_fwd();
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -783,5 +783,9 @@ main(int argc, char **argv)
} }
print_stats(); print_stats();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -3781,5 +3781,8 @@ main(int argc, char **argv)
} }
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -263,5 +263,9 @@ int main(int argc, char **argv)
RTE_LCORE_FOREACH_WORKER(lcore_id) { RTE_LCORE_FOREACH_WORKER(lcore_id) {
rte_eal_wait_lcore(lcore_id); rte_eal_wait_lcore(lcore_id);
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -190,4 +190,7 @@ main(int argc, char **argv)
conn_poll_for_msg(conn); conn_poll_for_msg(conn);
} }
/* clean up the EAL */
rte_eal_cleanup();
} }

View File

@ -784,5 +784,8 @@ main(int argc, char *argv[])
/* Call lcore_main on the main core only. */ /* Call lcore_main on the main core only. */
lcore_main(); lcore_main();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -460,5 +460,8 @@ main(int argc, char **argv)
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -218,5 +218,8 @@ main(int argc, char **argv)
} }
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -338,5 +338,9 @@ main(int argc, char *argv[])
/* call lcore_main on main core only */ /* call lcore_main on main core only */
lcore_main(); lcore_main();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -383,4 +383,7 @@ main(int argc, char *argv[])
need_flush = 1; need_flush = 1;
} }
/* clean up the EAL */
rte_eal_cleanup();
} }

View File

@ -334,5 +334,9 @@ main(int argc, char *argv[])
rte_eal_mp_remote_launch(sleep_lcore, NULL, SKIP_MAIN); rte_eal_mp_remote_launch(sleep_lcore, NULL, SKIP_MAIN);
do_packet_forwarding(); do_packet_forwarding();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -220,5 +220,8 @@ main(int argc, char **argv)
i = 0; i = 0;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -205,5 +205,8 @@ main(int argc, char *argv[])
/* Call lcore_main on the main core only. */ /* Call lcore_main on the main core only. */
lcore_main(); lcore_main();
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -117,5 +117,8 @@ main(int argc, char **argv)
/* call it on main lcore too */ /* call it on main lcore too */
(void) lcore_mainloop(NULL); (void) lcore_mainloop(NULL);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -576,5 +576,8 @@ main(int argc, char *argv[])
vdpa_sample_quit(); vdpa_sample_quit();
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -1781,6 +1781,8 @@ main(int argc, char *argv[])
RTE_LCORE_FOREACH_WORKER(lcore_id) RTE_LCORE_FOREACH_WORKER(lcore_id)
rte_eal_wait_lcore(lcore_id); rte_eal_wait_lcore(lcore_id);
return 0; /* clean up the EAL */
rte_eal_cleanup();
return 0;
} }

View File

@ -907,5 +907,8 @@ int main(int argc, char *argv[])
while (1) while (1)
sleep(1); sleep(1);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -469,6 +469,9 @@ free_resource(void)
} }
memset(&options, 0, sizeof(options)); memset(&options, 0, sizeof(options));
/* clean up the EAL */
rte_eal_cleanup();
} }
int int

View File

@ -200,5 +200,8 @@ main(int argc, char **argv)
} }
run_cli(NULL); run_cli(NULL);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -468,5 +468,8 @@ main(int argc, char **argv)
free(ci->cd); free(ci->cd);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -659,5 +659,8 @@ main(int argc, char *argv[])
return -1; return -1;
} }
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }

View File

@ -707,5 +707,8 @@ main(int argc, char *argv[])
/* call on main too */ /* call on main too */
(void) lcore_main((void*)i); (void) lcore_main((void*)i);
/* clean up the EAL */
rte_eal_cleanup();
return 0; return 0;
} }