xref: /dpdk/app/test-pipeline/main.h (revision 0efea35a2bb0ae9df6e204151c7f96b5eb93e130)
1474572d2SBruce Richardson /* SPDX-License-Identifier: BSD-3-Clause
2474572d2SBruce Richardson  * Copyright(c) 2010-2016 Intel Corporation
3474572d2SBruce Richardson  */
4474572d2SBruce Richardson 
5474572d2SBruce Richardson #ifndef _MAIN_H_
6474572d2SBruce Richardson #define _MAIN_H_
7474572d2SBruce Richardson 
8474572d2SBruce Richardson #ifndef APP_MBUF_ARRAY_SIZE
9474572d2SBruce Richardson #define APP_MBUF_ARRAY_SIZE 256
10474572d2SBruce Richardson #endif
11474572d2SBruce Richardson 
12474572d2SBruce Richardson struct app_mbuf_array {
13474572d2SBruce Richardson 	struct rte_mbuf *array[APP_MBUF_ARRAY_SIZE];
14474572d2SBruce Richardson 	uint16_t n_mbufs;
15474572d2SBruce Richardson };
16474572d2SBruce Richardson 
17474572d2SBruce Richardson #ifndef APP_MAX_PORTS
18474572d2SBruce Richardson #define APP_MAX_PORTS 4
19474572d2SBruce Richardson #endif
20474572d2SBruce Richardson 
21*0efea35aSTyler Retzlaff struct __rte_cache_aligned app_params {
22474572d2SBruce Richardson 	/* CPU cores */
23474572d2SBruce Richardson 	uint32_t core_rx;
24474572d2SBruce Richardson 	uint32_t core_worker;
25474572d2SBruce Richardson 	uint32_t core_tx;
26474572d2SBruce Richardson 
27474572d2SBruce Richardson 	/* Ports*/
28474572d2SBruce Richardson 	uint32_t ports[APP_MAX_PORTS];
29474572d2SBruce Richardson 	uint32_t n_ports;
30474572d2SBruce Richardson 	uint32_t port_rx_ring_size;
31474572d2SBruce Richardson 	uint32_t port_tx_ring_size;
32474572d2SBruce Richardson 
33474572d2SBruce Richardson 	/* Rings */
34474572d2SBruce Richardson 	struct rte_ring *rings_rx[APP_MAX_PORTS];
35474572d2SBruce Richardson 	struct rte_ring *rings_tx[APP_MAX_PORTS];
36474572d2SBruce Richardson 	uint32_t ring_rx_size;
37474572d2SBruce Richardson 	uint32_t ring_tx_size;
38474572d2SBruce Richardson 
39474572d2SBruce Richardson 	/* Internal buffers */
40474572d2SBruce Richardson 	struct app_mbuf_array mbuf_rx;
41474572d2SBruce Richardson 	struct app_mbuf_array mbuf_tx[APP_MAX_PORTS];
42474572d2SBruce Richardson 
43474572d2SBruce Richardson 	/* Buffer pool */
44474572d2SBruce Richardson 	struct rte_mempool *pool;
45474572d2SBruce Richardson 	uint32_t pool_buffer_size;
46474572d2SBruce Richardson 	uint32_t pool_size;
47474572d2SBruce Richardson 	uint32_t pool_cache_size;
48474572d2SBruce Richardson 
49474572d2SBruce Richardson 	/* Burst sizes */
50474572d2SBruce Richardson 	uint32_t burst_size_rx_read;
51474572d2SBruce Richardson 	uint32_t burst_size_rx_write;
52474572d2SBruce Richardson 	uint32_t burst_size_worker_read;
53474572d2SBruce Richardson 	uint32_t burst_size_worker_write;
54474572d2SBruce Richardson 	uint32_t burst_size_tx_read;
55474572d2SBruce Richardson 	uint32_t burst_size_tx_write;
56474572d2SBruce Richardson 
57474572d2SBruce Richardson 	/* App behavior */
58474572d2SBruce Richardson 	uint32_t pipeline_type;
59*0efea35aSTyler Retzlaff };
60474572d2SBruce Richardson 
61474572d2SBruce Richardson extern struct app_params app;
62474572d2SBruce Richardson 
63f6897b23SFeifei Wang extern bool force_quit;
64f6897b23SFeifei Wang 
65474572d2SBruce Richardson int app_parse_args(int argc, char **argv);
66474572d2SBruce Richardson void app_print_usage(void);
67474572d2SBruce Richardson void app_init(void);
68474572d2SBruce Richardson int app_lcore_main_loop(void *arg);
69474572d2SBruce Richardson 
70474572d2SBruce Richardson /* Pipeline */
71474572d2SBruce Richardson enum {
72474572d2SBruce Richardson 	e_APP_PIPELINE_NONE = 0,
73474572d2SBruce Richardson 	e_APP_PIPELINE_STUB,
74474572d2SBruce Richardson 
75474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_KEY8_EXT,
76474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_KEY8_LRU,
77474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_KEY16_EXT,
78474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_KEY16_LRU,
79474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_KEY32_EXT,
80474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_KEY32_LRU,
81474572d2SBruce Richardson 
82474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_SPEC_KEY8_EXT,
83474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_SPEC_KEY8_LRU,
84474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_SPEC_KEY16_EXT,
85474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_SPEC_KEY16_LRU,
86474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_SPEC_KEY32_EXT,
87474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_SPEC_KEY32_LRU,
88474572d2SBruce Richardson 
89474572d2SBruce Richardson 	e_APP_PIPELINE_ACL,
90474572d2SBruce Richardson 	e_APP_PIPELINE_LPM,
91474572d2SBruce Richardson 	e_APP_PIPELINE_LPM_IPV6,
92474572d2SBruce Richardson 
93474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY8,
94474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY16,
95474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY32,
96474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY48,
97474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY64,
98474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY80,
99474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY96,
100474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY112,
101474572d2SBruce Richardson 	e_APP_PIPELINE_HASH_CUCKOO_KEY128,
102474572d2SBruce Richardson 	e_APP_PIPELINES
103474572d2SBruce Richardson };
104474572d2SBruce Richardson 
105474572d2SBruce Richardson void app_main_loop_rx(void);
106474572d2SBruce Richardson void app_main_loop_rx_metadata(void);
107474572d2SBruce Richardson uint64_t test_hash(void *key,
108474572d2SBruce Richardson 	void *key_mask,
109474572d2SBruce Richardson 	uint32_t key_size,
110474572d2SBruce Richardson 	uint64_t seed);
111474572d2SBruce Richardson 
112474572d2SBruce Richardson uint32_t test_hash_cuckoo(const void *key,
113474572d2SBruce Richardson 	uint32_t key_size,
114474572d2SBruce Richardson 	uint32_t seed);
115474572d2SBruce Richardson 
116474572d2SBruce Richardson void app_main_loop_worker(void);
117474572d2SBruce Richardson void app_main_loop_worker_pipeline_stub(void);
118474572d2SBruce Richardson void app_main_loop_worker_pipeline_hash(void);
119474572d2SBruce Richardson void app_main_loop_worker_pipeline_acl(void);
120474572d2SBruce Richardson void app_main_loop_worker_pipeline_lpm(void);
121474572d2SBruce Richardson void app_main_loop_worker_pipeline_lpm_ipv6(void);
122474572d2SBruce Richardson 
123474572d2SBruce Richardson void app_main_loop_tx(void);
124474572d2SBruce Richardson 
125474572d2SBruce Richardson #define APP_FLUSH 0
126474572d2SBruce Richardson #ifndef APP_FLUSH
127474572d2SBruce Richardson #define APP_FLUSH 0x3FF
128474572d2SBruce Richardson #endif
129474572d2SBruce Richardson 
130474572d2SBruce Richardson #define APP_METADATA_OFFSET(offset) (sizeof(struct rte_mbuf) + (offset))
131474572d2SBruce Richardson 
132474572d2SBruce Richardson #endif /* _MAIN_H_ */
133