]> git.proxmox.com Git - ceph.git/blame - ceph/src/spdk/dpdk/app/test-pipeline/main.c
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / spdk / dpdk / app / test-pipeline / main.c
CommitLineData
11fdf7f2
TL
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2016 Intel Corporation
7c673cae
FG
3 */
4
5#include <stdio.h>
6#include <stdlib.h>
7#include <stdint.h>
8#include <inttypes.h>
9#include <sys/types.h>
10#include <string.h>
11#include <sys/queue.h>
12#include <stdarg.h>
13#include <errno.h>
14#include <getopt.h>
15#include <unistd.h>
16
17#include <rte_common.h>
18#include <rte_byteorder.h>
19#include <rte_log.h>
20#include <rte_memory.h>
21#include <rte_memcpy.h>
7c673cae
FG
22#include <rte_eal.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>
7c673cae
FG
29#include <rte_branch_prediction.h>
30#include <rte_interrupts.h>
31#include <rte_pci.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>
37#include <rte_mbuf.h>
38#include <rte_ip.h>
39#include <rte_tcp.h>
40#include <rte_lpm.h>
41#include <rte_lpm6.h>
42
43#include "main.h"
44
45int
46main(int argc, char **argv)
47{
48 uint32_t lcore;
49 int ret;
50
51 /* Init EAL */
52 ret = rte_eal_init(argc, argv);
53 if (ret < 0)
54 return -1;
55 argc -= ret;
56 argv += ret;
57
58 /* Parse application arguments (after the EAL ones) */
59 ret = app_parse_args(argc, argv);
60 if (ret < 0) {
61 app_print_usage();
62 return -1;
63 }
64
65 /* Init */
66 app_init();
67
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)
72 return -1;
73 }
74
75 return 0;
76}
77
78int
f67539c2 79app_lcore_main_loop(__rte_unused void *arg)
7c673cae
FG
80{
81 unsigned lcore;
82
83 lcore = rte_lcore_id();
84
85 if (lcore == app.core_rx) {
86 switch (app.pipeline_type) {
87 case e_APP_PIPELINE_ACL:
88 app_main_loop_rx();
89 return 0;
90
91 default:
92 app_main_loop_rx_metadata();
93 return 0;
94 }
95 }
96
97 if (lcore == app.core_worker) {
98 switch (app.pipeline_type) {
99 case e_APP_PIPELINE_STUB:
100 app_main_loop_worker_pipeline_stub();
101 return 0;
102
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();
126 return 0;
127
128 case e_APP_PIPELINE_ACL:
129#ifndef RTE_LIBRTE_ACL
130 rte_exit(EXIT_FAILURE, "ACL not present in build\n");
131#else
132 app_main_loop_worker_pipeline_acl();
133 return 0;
134#endif
135
136 case e_APP_PIPELINE_LPM:
137 app_main_loop_worker_pipeline_lpm();
138 return 0;
139
140 case e_APP_PIPELINE_LPM_IPV6:
141 app_main_loop_worker_pipeline_lpm_ipv6();
142 return 0;
143
144 case e_APP_PIPELINE_NONE:
145 default:
146 app_main_loop_worker();
147 return 0;
148 }
149 }
150
151 if (lcore == app.core_tx) {
152 app_main_loop_tx();
153 return 0;
154 }
155
156 return 0;
157}