4 * Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in
15 * the documentation and/or other materials provided with the
17 * * Neither the name of Intel Corporation nor the names of its
18 * contributors may be used to endorse or promote products derived
19 * from this software without specific prior written permission.
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #include <sys/types.h>
40 #include <sys/queue.h>
46 #include <rte_common.h>
47 #include <rte_byteorder.h>
49 #include <rte_memory.h>
50 #include <rte_memcpy.h>
51 #include <rte_memzone.h>
53 #include <rte_per_lcore.h>
54 #include <rte_launch.h>
55 #include <rte_atomic.h>
56 #include <rte_cycles.h>
57 #include <rte_prefetch.h>
58 #include <rte_lcore.h>
59 #include <rte_per_lcore.h>
60 #include <rte_branch_prediction.h>
61 #include <rte_interrupts.h>
63 #include <rte_random.h>
64 #include <rte_debug.h>
65 #include <rte_ether.h>
66 #include <rte_ethdev.h>
67 #include <rte_mempool.h>
77 main(int argc
, char **argv
)
83 ret
= rte_eal_init(argc
, argv
);
89 /* Parse application arguments (after the EAL ones) */
90 ret
= app_parse_args(argc
, argv
);
99 /* Launch per-lcore init on every lcore */
100 rte_eal_mp_remote_launch(app_lcore_main_loop
, NULL
, CALL_MASTER
);
101 RTE_LCORE_FOREACH_SLAVE(lcore
) {
102 if (rte_eal_wait_lcore(lcore
) < 0)
110 app_lcore_main_loop(__attribute__((unused
)) void *arg
)
114 lcore
= rte_lcore_id();
116 if (lcore
== app
.core_rx
) {
117 switch (app
.pipeline_type
) {
118 case e_APP_PIPELINE_ACL
:
123 app_main_loop_rx_metadata();
128 if (lcore
== app
.core_worker
) {
129 switch (app
.pipeline_type
) {
130 case e_APP_PIPELINE_STUB
:
131 app_main_loop_worker_pipeline_stub();
134 case e_APP_PIPELINE_HASH_KEY8_EXT
:
135 case e_APP_PIPELINE_HASH_KEY8_LRU
:
136 case e_APP_PIPELINE_HASH_KEY16_EXT
:
137 case e_APP_PIPELINE_HASH_KEY16_LRU
:
138 case e_APP_PIPELINE_HASH_KEY32_EXT
:
139 case e_APP_PIPELINE_HASH_KEY32_LRU
:
140 case e_APP_PIPELINE_HASH_SPEC_KEY8_EXT
:
141 case e_APP_PIPELINE_HASH_SPEC_KEY8_LRU
:
142 case e_APP_PIPELINE_HASH_SPEC_KEY16_EXT
:
143 case e_APP_PIPELINE_HASH_SPEC_KEY16_LRU
:
144 case e_APP_PIPELINE_HASH_SPEC_KEY32_EXT
:
145 case e_APP_PIPELINE_HASH_SPEC_KEY32_LRU
:
146 /* cases for cuckoo hash table types */
147 case e_APP_PIPELINE_HASH_CUCKOO_KEY8
:
148 case e_APP_PIPELINE_HASH_CUCKOO_KEY16
:
149 case e_APP_PIPELINE_HASH_CUCKOO_KEY32
:
150 case e_APP_PIPELINE_HASH_CUCKOO_KEY48
:
151 case e_APP_PIPELINE_HASH_CUCKOO_KEY64
:
152 case e_APP_PIPELINE_HASH_CUCKOO_KEY80
:
153 case e_APP_PIPELINE_HASH_CUCKOO_KEY96
:
154 case e_APP_PIPELINE_HASH_CUCKOO_KEY112
:
155 case e_APP_PIPELINE_HASH_CUCKOO_KEY128
:
156 app_main_loop_worker_pipeline_hash();
159 case e_APP_PIPELINE_ACL
:
160 #ifndef RTE_LIBRTE_ACL
161 rte_exit(EXIT_FAILURE
, "ACL not present in build\n");
163 app_main_loop_worker_pipeline_acl();
167 case e_APP_PIPELINE_LPM
:
168 app_main_loop_worker_pipeline_lpm();
171 case e_APP_PIPELINE_LPM_IPV6
:
172 app_main_loop_worker_pipeline_lpm_ipv6();
175 case e_APP_PIPELINE_NONE
:
177 app_main_loop_worker();
182 if (lcore
== app
.core_tx
) {