xref: /dpdk/examples/ip_pipeline/tmgr.h (revision 54a298e5f7f41c5883233dcd0f66fc57d7b351a2)
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 #include <rte_red.h>
13 
14 #include "common.h"
15 
16 #ifndef TMGR_PIPE_SUBPORT_MAX
17 #define TMGR_PIPE_SUBPORT_MAX                              4096
18 #endif
19 
20 #ifndef TMGR_SUBPORT_PROFILE_MAX
21 #define TMGR_SUBPORT_PROFILE_MAX                           256
22 #endif
23 
24 #ifndef TMGR_PIPE_PROFILE_MAX
25 #define TMGR_PIPE_PROFILE_MAX                              256
26 #endif
27 
28 struct tmgr_port {
29 	TAILQ_ENTRY(tmgr_port) node;
30 	char name[NAME_SIZE];
31 	struct rte_sched_port *s;
32 	uint32_t n_subports_per_port;
33 	uint32_t n_pipes_per_subport;
34 };
35 
36 TAILQ_HEAD(tmgr_port_list, tmgr_port);
37 
38 int
39 tmgr_init(void);
40 
41 struct tmgr_port *
42 tmgr_port_find(const char *name);
43 
44 struct tmgr_port_params {
45 	uint64_t rate;
46 	uint32_t n_subports_per_port;
47 	uint32_t n_pipes_per_subport;
48 	uint32_t frame_overhead;
49 	uint32_t mtu;
50 	uint32_t cpu_id;
51 };
52 
53 int
54 tmgr_subport_profile_add(struct rte_sched_subport_profile_params *sp);
55 
56 int
57 tmgr_pipe_profile_add(struct rte_sched_pipe_params *p);
58 
59 struct tmgr_port *
60 tmgr_port_create(const char *name, struct tmgr_port_params *params);
61 
62 int
63 tmgr_subport_config(const char *port_name,
64 	uint32_t subport_id,
65 	uint32_t subport_profile_id);
66 
67 int
68 tmgr_pipe_config(const char *port_name,
69 	uint32_t subport_id,
70 	uint32_t pipe_id_first,
71 	uint32_t pipe_id_last,
72 	uint32_t pipe_profile_id);
73 
74 #endif /* _INCLUDE_TMGR_H_ */
75