4 * Copyright(c) 2010-2014 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,
122 void app_main_loop_rx(void);
123 void app_main_loop_rx_metadata(void);
124 uint64_t test_hash(void *key, uint32_t key_size, uint64_t seed);
126 void app_main_loop_worker(void);
127 void app_main_loop_worker_pipeline_stub(void);
128 void app_main_loop_worker_pipeline_hash(void);
129 void app_main_loop_worker_pipeline_acl(void);
130 void app_main_loop_worker_pipeline_lpm(void);
131 void app_main_loop_worker_pipeline_lpm_ipv6(void);
133 void app_main_loop_tx(void);
137 #define APP_FLUSH 0x3FF
140 #endif /* _MAIN_H_ */