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.
37 #ifndef APP_MBUF_ARRAY_SIZE
38 #define APP_MBUF_ARRAY_SIZE 256
41 struct app_mbuf_array {
42 struct rte_mbuf *array[APP_MBUF_ARRAY_SIZE];
47 #define APP_MAX_PORTS 4
57 uint32_t ports[APP_MAX_PORTS];
59 uint32_t port_rx_ring_size;
60 uint32_t port_tx_ring_size;
63 struct rte_ring *rings_rx[APP_MAX_PORTS];
64 struct rte_ring *rings_tx[APP_MAX_PORTS];
65 uint32_t ring_rx_size;
66 uint32_t ring_tx_size;
68 /* Internal buffers */
69 struct app_mbuf_array mbuf_rx;
70 struct app_mbuf_array mbuf_tx[APP_MAX_PORTS];
73 struct rte_mempool *pool;
74 uint32_t pool_buffer_size;
76 uint32_t pool_cache_size;
79 uint32_t burst_size_rx_read;
80 uint32_t burst_size_rx_write;
81 uint32_t burst_size_worker_read;
82 uint32_t burst_size_worker_write;
83 uint32_t burst_size_tx_read;
84 uint32_t burst_size_tx_write;
87 uint32_t pipeline_type;
88 } __rte_cache_aligned;
90 extern struct app_params app;
92 int app_parse_args(int argc, char **argv);
93 void app_print_usage(void);
95 int app_lcore_main_loop(void *arg);
99 e_APP_PIPELINE_NONE = 0,
102 e_APP_PIPELINE_HASH_KEY8_EXT,
103 e_APP_PIPELINE_HASH_KEY8_LRU,
104 e_APP_PIPELINE_HASH_KEY16_EXT,
105 e_APP_PIPELINE_HASH_KEY16_LRU,
106 e_APP_PIPELINE_HASH_KEY32_EXT,
107 e_APP_PIPELINE_HASH_KEY32_LRU,
109 e_APP_PIPELINE_HASH_SPEC_KEY8_EXT,
110 e_APP_PIPELINE_HASH_SPEC_KEY8_LRU,
111 e_APP_PIPELINE_HASH_SPEC_KEY16_EXT,
112 e_APP_PIPELINE_HASH_SPEC_KEY16_LRU,
113 e_APP_PIPELINE_HASH_SPEC_KEY32_EXT,
114 e_APP_PIPELINE_HASH_SPEC_KEY32_LRU,
118 e_APP_PIPELINE_LPM_IPV6,
120 e_APP_PIPELINE_HASH_CUCKOO_KEY8,
121 e_APP_PIPELINE_HASH_CUCKOO_KEY16,
122 e_APP_PIPELINE_HASH_CUCKOO_KEY32,
123 e_APP_PIPELINE_HASH_CUCKOO_KEY48,
124 e_APP_PIPELINE_HASH_CUCKOO_KEY64,
125 e_APP_PIPELINE_HASH_CUCKOO_KEY80,
126 e_APP_PIPELINE_HASH_CUCKOO_KEY96,
127 e_APP_PIPELINE_HASH_CUCKOO_KEY112,
128 e_APP_PIPELINE_HASH_CUCKOO_KEY128,
132 void app_main_loop_rx(void);
133 void app_main_loop_rx_metadata(void);
134 uint64_t test_hash(void *key,
139 void app_main_loop_worker(void);
140 void app_main_loop_worker_pipeline_stub(void);
141 void app_main_loop_worker_pipeline_hash(void);
142 void app_main_loop_worker_pipeline_acl(void);
143 void app_main_loop_worker_pipeline_lpm(void);
144 void app_main_loop_worker_pipeline_lpm_ipv6(void);
146 void app_main_loop_tx(void);
150 #define APP_FLUSH 0x3FF
153 #define APP_METADATA_OFFSET(offset) (sizeof(struct rte_mbuf) + (offset))
155 #endif /* _MAIN_H_ */