1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
12 #include <rte_sched.h>
14 #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1
17 * Configurable number of RX/TX ring descriptors
19 #define APP_INTERACTIVE_DEFAULT 0
21 #define APP_RX_DESC_DEFAULT 1024
22 #define APP_TX_DESC_DEFAULT 1024
24 #define APP_RING_SIZE (8*1024)
25 #define NB_MBUF (2*1024*1024)
27 #define MAX_PKT_RX_BURST 64
28 #define PKT_ENQUEUE 64
29 #define PKT_DEQUEUE 32
30 #define MAX_PKT_TX_BURST 64
32 #define RX_PTHRESH 8 /**< Default values of RX prefetch threshold reg. */
33 #define RX_HTHRESH 8 /**< Default values of RX host threshold reg. */
34 #define RX_WTHRESH 4 /**< Default values of RX write-back threshold reg. */
36 #define TX_PTHRESH 36 /**< Default values of TX prefetch threshold reg. */
37 #define TX_HTHRESH 0 /**< Default values of TX host threshold reg. */
38 #define TX_WTHRESH 0 /**< Default values of TX write-back threshold reg. */
40 #define BURST_TX_DRAIN_US 100
43 #if (RTE_MAX_LCORE > 64)
44 #define APP_MAX_LCORE 64
46 #define APP_MAX_LCORE RTE_MAX_LCORE
50 #define MAX_DATA_STREAMS (APP_MAX_LCORE/2)
51 #define MAX_SCHED_SUBPORTS 8
52 #define MAX_SCHED_PIPES 4096
54 #ifndef APP_COLLECT_STAT
55 #define APP_COLLECT_STAT 1
59 #define APP_STATS_ADD(stat,val) (stat) += (val)
61 #define APP_STATS_ADD(stat,val) do {(void) (val);} while (0)
64 #define APP_QAVG_NTIMES 10
65 #define APP_QAVG_PERIOD 100
78 struct rte_mbuf **m_table;
84 struct rte_ring *rx_ring;
85 struct rte_ring *tx_ring;
86 struct rte_sched_port *sched_port;
89 struct thread_stat stat;
91 } __rte_cache_aligned;
103 struct rte_ring *rx_ring;
104 struct rte_ring *tx_ring;
105 struct rte_sched_port *sched_port;
106 struct rte_mempool *mbuf_pool;
108 struct thread_conf rx_thread;
109 struct thread_conf wt_thread;
110 struct thread_conf tx_thread;
125 uint16_t qos_dequeue;
131 uint8_t pthresh; /**< Ring prefetch threshold. */
132 uint8_t hthresh; /**< Ring host threshold. */
133 uint8_t wthresh; /**< Ring writeback threshold. */
136 extern uint8_t interactive;
137 extern uint32_t qavg_period;
138 extern uint32_t qavg_ntimes;
139 extern uint32_t nb_pfc;
140 extern const char *cfg_profile;
142 extern struct flow_conf qos_conf[];
143 extern int app_pipe_to_profile[MAX_SCHED_SUBPORTS][MAX_SCHED_PIPES];
145 extern struct ring_conf ring_conf;
146 extern struct burst_conf burst_conf;
147 extern struct ring_thresh rx_thresh;
148 extern struct ring_thresh tx_thresh;
150 extern struct rte_sched_port_params port_params;
152 int app_parse_args(int argc, char **argv);
156 void app_rx_thread(struct thread_conf **qconf);
157 void app_tx_thread(struct thread_conf **qconf);
158 void app_worker_thread(struct thread_conf **qconf);
159 void app_mixed_thread(struct thread_conf **qconf);
162 int subport_stat(uint16_t port_id, uint32_t subport_id);
163 int pipe_stat(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id);
164 int qavg_q(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id,
165 uint8_t tc, uint8_t q);
166 int qavg_tcpipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id,
168 int qavg_pipe(uint16_t port_id, uint32_t subport_id, uint32_t pipe_id);
169 int qavg_tcsubport(uint16_t port_id, uint32_t subport_id, uint8_t tc);
170 int qavg_subport(uint16_t port_id, uint32_t subport_id);
176 #endif /* _MAIN_H_ */