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