xref: /dpdk/examples/ip_pipeline/tmgr.h (revision 089e5ed727a15da2729cfee9b63533dd120bd04c)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2018 Intel Corporation
3  */
4 
5 #ifndef _INCLUDE_TMGR_H_
6 #define _INCLUDE_TMGR_H_
7 
8 #include <stdint.h>
9 #include <sys/queue.h>
10 
11 #include <rte_sched.h>
12 
13 #include "common.h"
14 
15 #ifndef TMGR_SUBPORT_PROFILE_MAX
16 #define TMGR_SUBPORT_PROFILE_MAX                           256
17 #endif
18 
19 #ifndef TMGR_PIPE_PROFILE_MAX
20 #define TMGR_PIPE_PROFILE_MAX                              256
21 #endif
22 
23 struct tmgr_port {
24 	TAILQ_ENTRY(tmgr_port) node;
25 	char name[NAME_SIZE];
26 	struct rte_sched_port *s;
27 	uint32_t n_subports_per_port;
28 	uint32_t n_pipes_per_subport;
29 };
30 
31 TAILQ_HEAD(tmgr_port_list, tmgr_port);
32 
33 int
34 tmgr_init(void);
35 
36 struct tmgr_port *
37 tmgr_port_find(const char *name);
38 
39 struct tmgr_port_params {
40 	uint32_t rate;
41 	uint32_t n_subports_per_port;
42 	uint32_t frame_overhead;
43 	uint32_t mtu;
44 	uint32_t cpu_id;
45 	uint32_t n_pipes_per_subport;
46 	uint16_t qsize[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
47 };
48 
49 int
50 tmgr_subport_profile_add(struct rte_sched_subport_params *p);
51 
52 int
53 tmgr_pipe_profile_add(struct rte_sched_pipe_params *p);
54 
55 struct tmgr_port *
56 tmgr_port_create(const char *name, struct tmgr_port_params *params);
57 
58 int
59 tmgr_subport_config(const char *port_name,
60 	uint32_t subport_id,
61 	uint32_t subport_profile_id);
62 
63 int
64 tmgr_pipe_config(const char *port_name,
65 	uint32_t subport_id,
66 	uint32_t pipe_id_first,
67 	uint32_t pipe_id_last,
68 	uint32_t pipe_profile_id);
69 
70 #endif /* _INCLUDE_TMGR_H_ */
71