1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation
11 #include <sys/queue.h>
17 #include <rte_common.h>
18 #include <rte_byteorder.h>
20 #include <rte_memory.h>
21 #include <rte_memcpy.h>
23 #include <rte_per_lcore.h>
24 #include <rte_launch.h>
25 #include <rte_atomic.h>
26 #include <rte_cycles.h>
27 #include <rte_prefetch.h>
28 #include <rte_lcore.h>
29 #include <rte_branch_prediction.h>
30 #include <rte_interrupts.h>
32 #include <rte_random.h>
33 #include <rte_debug.h>
34 #include <rte_ether.h>
35 #include <rte_ethdev.h>
36 #include <rte_mempool.h>
46 main(int argc, char **argv)
52 ret = rte_eal_init(argc, argv);
58 /* Parse application arguments (after the EAL ones) */
59 ret = app_parse_args(argc, argv);
68 /* Launch per-lcore init on every lcore */
69 rte_eal_mp_remote_launch(app_lcore_main_loop, NULL, CALL_MASTER);
70 RTE_LCORE_FOREACH_SLAVE(lcore) {
71 if (rte_eal_wait_lcore(lcore) < 0)
79 app_lcore_main_loop(__attribute__((unused)) void *arg)
83 lcore = rte_lcore_id();
85 if (lcore == app.core_rx) {
86 switch (app.pipeline_type) {
87 case e_APP_PIPELINE_ACL:
92 app_main_loop_rx_metadata();
97 if (lcore == app.core_worker) {
98 switch (app.pipeline_type) {
99 case e_APP_PIPELINE_STUB:
100 app_main_loop_worker_pipeline_stub();
103 case e_APP_PIPELINE_HASH_KEY8_EXT:
104 case e_APP_PIPELINE_HASH_KEY8_LRU:
105 case e_APP_PIPELINE_HASH_KEY16_EXT:
106 case e_APP_PIPELINE_HASH_KEY16_LRU:
107 case e_APP_PIPELINE_HASH_KEY32_EXT:
108 case e_APP_PIPELINE_HASH_KEY32_LRU:
109 case e_APP_PIPELINE_HASH_SPEC_KEY8_EXT:
110 case e_APP_PIPELINE_HASH_SPEC_KEY8_LRU:
111 case e_APP_PIPELINE_HASH_SPEC_KEY16_EXT:
112 case e_APP_PIPELINE_HASH_SPEC_KEY16_LRU:
113 case e_APP_PIPELINE_HASH_SPEC_KEY32_EXT:
114 case e_APP_PIPELINE_HASH_SPEC_KEY32_LRU:
115 /* cases for cuckoo hash table types */
116 case e_APP_PIPELINE_HASH_CUCKOO_KEY8:
117 case e_APP_PIPELINE_HASH_CUCKOO_KEY16:
118 case e_APP_PIPELINE_HASH_CUCKOO_KEY32:
119 case e_APP_PIPELINE_HASH_CUCKOO_KEY48:
120 case e_APP_PIPELINE_HASH_CUCKOO_KEY64:
121 case e_APP_PIPELINE_HASH_CUCKOO_KEY80:
122 case e_APP_PIPELINE_HASH_CUCKOO_KEY96:
123 case e_APP_PIPELINE_HASH_CUCKOO_KEY112:
124 case e_APP_PIPELINE_HASH_CUCKOO_KEY128:
125 app_main_loop_worker_pipeline_hash();
128 case e_APP_PIPELINE_ACL:
129 #ifndef RTE_LIBRTE_ACL
130 rte_exit(EXIT_FAILURE, "ACL not present in build\n");
132 app_main_loop_worker_pipeline_acl();
136 case e_APP_PIPELINE_LPM:
137 app_main_loop_worker_pipeline_lpm();
140 case e_APP_PIPELINE_LPM_IPV6:
141 app_main_loop_worker_pipeline_lpm_ipv6();
144 case e_APP_PIPELINE_NONE:
146 app_main_loop_worker();
151 if (lcore == app.core_tx) {