]> git.droids-corp.org - dpdk.git/commitdiff
examples: add eal cleanup to examples
authorChengchang Tang <tangchengchang@huawei.com>
Thu, 15 Apr 2021 02:26:03 +0000 (10:26 +0800)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 21 Apr 2021 18:21:25 +0000 (20:21 +0200)
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: aec9c13c5257 ("eal: add function to release internal resources")
Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application")
Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
Fixes: 4ff457986f76 ("examples/l2fwd-event: add default poll mode routines")
Fixes: 08bd1a174461 ("examples/l3fwd-graph: add graph-based l3fwd skeleton")
Fixes: c5eebf85badc ("examples/ntb: add example for NTB")
Fixes: b77f66002812 ("examples/pipeline: add new example application")
Fixes: edbed86d1cc3 ("examples/vdpa: introduce a new sample for vDPA")
Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Fixes: f5188211c721 ("examples/vhost_crypto: add sample application")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
51 files changed:
examples/bbdev_app/main.c
examples/bond/main.c
examples/cmdline/main.c
examples/distributor/main.c
examples/ethtool/ethtool-app/main.c
examples/fips_validation/main.c
examples/flow_classify/flow_classify.c
examples/flow_filtering/main.c
examples/helloworld/main.c
examples/ioat/ioatfwd.c
examples/ip_fragmentation/main.c
examples/ip_reassembly/main.c
examples/ipsec-secgw/ipsec-secgw.c
examples/ipv4_multicast/main.c
examples/kni/main.c
examples/l2fwd-cat/l2fwd-cat.c
examples/l2fwd-crypto/main.c
examples/l2fwd-event/main.c
examples/l2fwd-jobstats/main.c
examples/l2fwd-keepalive/main.c
examples/l2fwd/main.c
examples/l3fwd-acl/main.c
examples/l3fwd-graph/main.c
examples/l3fwd/main.c
examples/link_status_interrupt/main.c
examples/multi_process/client_server_mp/mp_client/client.c
examples/multi_process/client_server_mp/mp_server/main.c
examples/multi_process/simple_mp/main.c
examples/multi_process/symmetric_mp/main.c
examples/ntb/ntb_fwd.c
examples/packet_ordering/main.c
examples/performance-thread/l3fwd-thread/main.c
examples/performance-thread/pthread_shim/main.c
examples/pipeline/main.c
examples/ptpclient/ptpclient.c
examples/qos_meter/main.c
examples/qos_sched/main.c
examples/rxtx_callbacks/main.c
examples/server_node_efd/node/node.c
examples/server_node_efd/server/main.c
examples/service_cores/main.c
examples/skeleton/basicfwd.c
examples/timer/main.c
examples/vdpa/main.c
examples/vhost/main.c
examples/vhost_blk/vhost_blk.c
examples/vhost_crypto/main.c
examples/vm_power_manager/guest_cli/main.c
examples/vm_power_manager/main.c
examples/vmdq/main.c
examples/vmdq_dcb/main.c

index 20cfd327fbc3a1b276a0e2d04f22cea4a9c36d4c..5251db0b16745c2a4988c9b4ead8f20cb0c0482f 100644 (file)
@@ -1195,5 +1195,8 @@ main(int argc, char **argv)
                ret |= rte_eal_wait_lcore(lcore_id);
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return ret;
 }
index 81a6fa976b278d7464d3789beb0ed68e9dcf927b..f48400e21156ee25cc6ea11a0c01b26a58116eb0 100644 (file)
@@ -876,5 +876,9 @@ main(int argc, char *argv[])
        prompt(NULL);
 
        rte_delay_ms(100);
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index bb7954245298e023d2c3badd53a8768104a52b1c..94002f0582d884fae2b308476febf0151e5e791c 100644 (file)
@@ -36,5 +36,8 @@ int main(int argc, char **argv)
        cmdline_interact(cl);
        cmdline_stdin_exit(cl);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index caa7c46cb1e885661fbb5862b800fe4c552c4d90..1b1029660e771cc51df2de2ede44413e050347c7 100644 (file)
@@ -932,5 +932,8 @@ main(int argc, char *argv[])
        rte_free(pd);
        rte_free(pr);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index c6023a1d41bd3f7cdd60664daca60eaace8258e4..21ed85c7d6c9f0564c7639860d975660a723589d 100644 (file)
@@ -299,5 +299,8 @@ int main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index b73691dd2378f95227fb0de33df13fff71e1437e..c175fe6ac2d7a220aaa1eb88392fbebae45078b7 100644 (file)
@@ -501,6 +501,9 @@ exit:
        fips_test_clear();
        cryptodev_fips_validate_app_uninit();
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return ret;
 
 }
index 335d7d2ad815a10fcb70717fa438e026dd44291b..5c3e111cfaffed354b62f3d031d36259af3f5f54 100644 (file)
@@ -853,5 +853,8 @@ main(int argc, char *argv[])
        /* Call lcore_main on the main core only. */
        lcore_main(cls_app);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index bc28468f1730a7bc640934d0a52d4fee59317e46..f1940bc88d03a48760d91459a12cd786163e67c5 100644 (file)
@@ -258,5 +258,10 @@ main(int argc, char **argv)
                rte_exit(EXIT_FAILURE, "error in creating flow");
        }
 
-       return main_loop();
+       ret = main_loop();
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
+       return ret;
 }
index 8a4cee60ff07418b8327b144f562fdaab19025bc..ac72145c736732cb2c2258deb6c529810ad65216 100644 (file)
@@ -43,5 +43,9 @@ main(int argc, char **argv)
        lcore_hello(NULL);
 
        rte_eal_mp_wait_lcore();
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 6502e4531ffcab4f8032735c5d8044a7cfe05bb7..845301a6db37fd26f9498dfeb6ad9b92a85fdb44 100644 (file)
@@ -1011,6 +1011,9 @@ main(int argc, char **argv)
                        rte_ring_free(cfg.ports[i].rx_to_tx_ring);
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        printf("Bye...\n");
        return 0;
 }
index 5a96841dfc3e2422688a0eec5f8401bf13709837..77a6a18d19148a88ca06f2ffe1d25d5e92759a9b 100644 (file)
@@ -1075,5 +1075,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 954a11512a8ff740119e8bc28d79fc725297f41b..ce8882a458837d062c368f727f78a5e24ca55ed8 100644 (file)
@@ -1201,5 +1201,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 59971dc7669b105de4019dd5a0aecd90a4c7e3eb..a9f9b5859be5ccea8ecce4376d7920169750abde 100644 (file)
@@ -3076,6 +3076,9 @@ main(int32_t argc, char **argv)
                rte_eth_dev_close(portid);
                printf(" Done\n");
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
        printf("Bye...\n");
 
        return 0;
index e18726a5d2b67fcc8a5c4d281b142a15a27957a8..fd6207a18b799959a4449be5bf99401e5f8eb757 100644 (file)
@@ -805,5 +805,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index fe93b8618a2c77e5c2261ab86265f648bdaf861c..beabb3c848aad03eb98ac837ab624f87fe97446b 100644 (file)
@@ -1140,5 +1140,8 @@ main(int argc, char** argv)
                        kni_port_params_array[i] = NULL;
                }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 2e632c5cb6a517991dda334b0f958c3f05f19189..02288a3824b27d55c46b0e467b1475c553fbac4d 100644 (file)
@@ -201,5 +201,8 @@ main(int argc, char *argv[])
        /* Call lcore_main on the main core only. */
        lcore_main();
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index a957df05db34a989842118332e659965028e337f..4f5161649234b6f9884002be08e29c0468a55df7 100644 (file)
@@ -2835,5 +2835,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 444ee4e4db7e300d20a6ecde426ecc6d9e924d20..0acfee4c92b63fd0ba2aec9634d2e4622fdf8c91 100644 (file)
@@ -716,6 +716,9 @@ main(int argc, char **argv)
                        printf(" Done\n");
                }
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
        printf("Bye...\n");
 
        return 0;
index 1151769aa9aade473ba73ab22344ca34d24838d4..58a722669b6de089a90cff24d1c5e23b4b43041d 100644 (file)
@@ -1022,5 +1022,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index e4c2b27933058cafd24b84a3ae881471dc03d23a..be6616288fa7a0639fffd81ea55ebe70127b35d3 100644 (file)
@@ -817,5 +817,9 @@ main(int argc, char **argv)
 
        if (ka_shm != NULL)
                rte_keepalive_shm_cleanup(ka_shm);
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index be5bf7bc904a1b00366d6e1fc9447b9b2f8f6cb7..32d405e65a238a73987f093deb81154ccbd191ca 100644 (file)
@@ -902,6 +902,9 @@ main(int argc, char **argv)
                rte_eth_dev_close(portid);
                printf(" Done\n");
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
        printf("Bye...\n");
 
        return ret;
index 4a1727437982429fa1c180d12608c82a8a86389c..a1f457b564b6d988589cda549aec1b74076013b4 100644 (file)
@@ -2258,5 +2258,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 127c5e8dab2e1871afc92d08cd412fd1d988e400..75c2e0ef3f3f409565faeb4b9f1660c150db318f 100644 (file)
@@ -1123,6 +1123,9 @@ main(int argc, char **argv)
                rte_eth_dev_close(portid);
                printf(" Done\n");
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
        printf("Bye...\n");
 
        return ret;
index 74413052b0c11acaae501361ddd81cd750c4cb95..4cb800aa158d00fefd8f778546b0867169cf82ab 100644 (file)
@@ -1405,6 +1405,10 @@ main(int argc, char **argv)
                        printf(" Done\n");
                }
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        printf("Bye...\n");
 
        return ret;
index 8ca3586e05211c7d2a20dcccaa0646f3ad505e47..d8ff5f133b3d0b3046d1ce66e198cfdf79a57ce0 100644 (file)
@@ -730,5 +730,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 361d90b54b2d3765e0b5082a49b79f96361c8189..6d4c2468164fb9dd38f067de79abc64f6863bb69 100644 (file)
@@ -268,4 +268,7 @@ main(int argc, char *argv[])
 
                need_flush = 1;
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
 }
index b18e12dd4b840312ab8ea4d8e3b5d79346055d4e..9bcee460fd24fedff2ab4922f36eaebb3b0cd305 100644 (file)
@@ -304,5 +304,9 @@ main(int argc, char *argv[])
        rte_eal_mp_remote_launch(sleep_lcore, NULL, SKIP_MAIN);
 
        do_packet_forwarding();
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 109b8bb45dcc0ebe1a4278e09f1ecd23ac04c7f4..a05404f7ed109f19512ef9c24321f55bf7f04cd5 100644 (file)
@@ -121,5 +121,9 @@ main(int argc, char **argv)
        cmdline_stdin_exit(cl);
 
        rte_eal_mp_wait_lcore();
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index ae7f5e0d5076db85dfe7b30029548f13b7e8b79e..79e5c61e404b3760e101d33af3a19f6c7f5ed0eb 100644 (file)
@@ -472,5 +472,8 @@ main(int argc, char **argv)
 
        rte_eal_mp_remote_launch(lcore_main, NULL, CALL_MAIN);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 54b7f08964067d4f13368d787ac949ac14fd2a92..e9a38871064759f1c7ca8cbc3428a3b938d06209 100644 (file)
@@ -1498,5 +1498,8 @@ main(int argc, char **argv)
                start_pkt_fwd();
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index bcbda05f5eae305ae03401de867b30efa4df6e9b..d2fe9f6b50d8734017c2271e68360ef9af8c834d 100644 (file)
@@ -783,5 +783,9 @@ main(int argc, char **argv)
        }
 
        print_stats();
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index b16c19bc96b7a591154447d643b43688955f89ce..2f593abf263d5dbdd0ebc7415c0135c183dbbd2c 100644 (file)
@@ -3781,5 +3781,8 @@ main(int argc, char **argv)
                }
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 4ce3622e471d4269f296a9c8914a73fe5cea3564..257de50692a9e73b01a1941e8e5d60eb374c2290 100644 (file)
@@ -263,5 +263,9 @@ int main(int argc, char **argv)
        RTE_LCORE_FOREACH_WORKER(lcore_id) {
                rte_eal_wait_lcore(lcore_id);
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index fb57ef31fef5c8a0c850b4aa15469f1408d04f90..8ea19f9dd5844eb8c011852110bdbdbe25afa32e 100644 (file)
@@ -190,4 +190,7 @@ main(int argc, char **argv)
 
                conn_poll_for_msg(conn);
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
 }
index 878d1a0b999cc7b1c4a5cacb8633d7dc8dfa1163..173451eedcbed171f602f1fd45834e1d02783cb0 100644 (file)
@@ -784,5 +784,8 @@ main(int argc, char *argv[])
        /* Call lcore_main on the main core only. */
        lcore_main();
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index f2d9c28828ab014310946c8c64565936d476f9ed..6e724f37835ac0236a4e17f2c243545719121559 100644 (file)
@@ -460,5 +460,8 @@ main(int argc, char **argv)
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index a6071b991c76e2539aa6c263c628a38166f908ec..dc6a17a6464ae716d0d3ae3396e23edd36f26a3d 100644 (file)
@@ -218,5 +218,8 @@ main(int argc, char **argv)
                }
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 35c6c398070ce33dac4572f668a2fd5d9578bbb5..b57b2fc6bcd7990509701d51180deefd8f085780 100644 (file)
@@ -338,5 +338,9 @@ main(int argc, char *argv[])
 
        /* call lcore_main on main core only */
        lcore_main();
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 67a55808bf1e6aabbc073b2f5c9892cb91ac106a..e68606e0ca4739a38e1993893ad6d24c3864ccdf 100644 (file)
@@ -383,4 +383,7 @@ main(int argc, char *argv[])
 
                need_flush = 1;
        }
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
 }
index 4728960eaf22bae572b952989aea75f0ff54d04a..39b7b6370f948236a863a729016d4a53cd27275c 100644 (file)
@@ -334,5 +334,9 @@ main(int argc, char *argv[])
        rte_eal_mp_remote_launch(sleep_lcore, NULL, SKIP_MAIN);
 
        do_packet_forwarding();
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 0b3d8c807384c6d9853b8fa71e8351b0b0b1d982..2b57a52b1618136be9d6311550cc1d09788ca14c 100644 (file)
@@ -220,5 +220,8 @@ main(int argc, char **argv)
                        i = 0;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 4b2b6ab4ff785e93d5ff658c406abbd779ac8700..a31b2882ae011a3278b00b7331f1f81323fc88de 100644 (file)
@@ -205,5 +205,8 @@ main(int argc, char *argv[])
        /* Call lcore_main on the main core only. */
        lcore_main();
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 5a57e482909f050ec155a1f07e0e0ead475940d5..d67301e3c4e4b7ec779216e8beb4398d995688f4 100644 (file)
@@ -117,5 +117,8 @@ main(int argc, char **argv)
        /* call it on main lcore too */
        (void) lcore_mainloop(NULL);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 97e967b9a21924db9680c2d673895ac5723d813e..097a267b8cb16d48ccf663088cc3f058bf218af9 100644 (file)
@@ -576,5 +576,8 @@ main(int argc, char *argv[])
                vdpa_sample_quit();
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 2ca7d98c5829a7f564f8f86981aa88ead4066280..ff48ba270d22a6617805e7a3341f19beb14df0a3 100644 (file)
@@ -1781,6 +1781,8 @@ main(int argc, char *argv[])
        RTE_LCORE_FOREACH_WORKER(lcore_id)
                rte_eal_wait_lcore(lcore_id);
 
-       return 0;
+       /* clean up the EAL */
+       rte_eal_cleanup();
 
+       return 0;
 }
index 54f81b334d8564d2683479560899a0bcb2f9c851..fe2b4e480373ad3646e82d3d09110d3499e42846 100644 (file)
@@ -907,5 +907,8 @@ int main(int argc, char *argv[])
        while (1)
                sleep(1);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 7ed38fedf288fb2f8be8a92dcb17d63a6938652f..dea7dcbd0771b8031fc29e828fbb2ce7de6fe71c 100644 (file)
@@ -469,6 +469,9 @@ free_resource(void)
        }
 
        memset(&options, 0, sizeof(options));
+
+       /* clean up the EAL */
+       rte_eal_cleanup();
 }
 
 int
index 4e17f7fb90511283b072bc61ec3ca091d600e472..b8fa65ef1536bb1b2aa4745b025f986ed64a380e 100644 (file)
@@ -200,5 +200,8 @@ main(int argc, char **argv)
        }
        run_cli(NULL);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 799d7b9bc30c8eed5ce0400dbb62b87e15ea2884..7d5bf685542636fc593c84dfb39721c4aad23269 100644 (file)
@@ -468,5 +468,8 @@ main(int argc, char **argv)
 
        free(ci->cd);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 3cb890fa2b2b0f391e0adf4fc973e81608170b83..a19f7db739525f216983d915716530b467e60376 100644 (file)
@@ -659,5 +659,8 @@ main(int argc, char *argv[])
                        return -1;
        }
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }
index 1a74364638064fc376ec077d7e49e2a58e8eeff1..ba992802e965c2528cff5504b55fcbeb2aba7021 100644 (file)
@@ -707,5 +707,8 @@ main(int argc, char *argv[])
        /* call on main too */
        (void) lcore_main((void*)i);
 
+       /* clean up the EAL */
+       rte_eal_cleanup();
+
        return 0;
 }