aboutsummaryrefslogtreecommitdiff
path: root/platform/linux-generic/include/odp/api/plat/traffic_mngr_types.h
blob: b766afecd94f4c4fdd51626ad9cac0fc03a201fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/* Copyright (c) 2015, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

/**
 * @file
 *
 * ODP traffic mngr
 */

#ifndef ODP_TRAFFIC_MNGR_TYPES_H_
#define ODP_TRAFFIC_MNGR_TYPES_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <odp/api/std_types.h>
#include <odp/api/plat/strong_types.h>

/** @addtogroup odp_traffic_mngr
 *  Macros and operations on a TM system.
 *  @{
 */

/** The ODP_TM_MAX_NUM_SYSTEMS constant specifies the maximum number of TM
 * systems that may be created.  On some platforms this might be much more
 * limited to as little as one hardware TM system.
 */
#define ODP_TM_MAX_NUM_SYSTEMS   64

/** The ODP_TM_MAX_PRIORITIES constant specifies the largest range of
 * priorities that any TM system can support.  All strict priority values MUST
 * in the range 0..ODP_TM_MAX_PRIORITIES-1.
 */
#define ODP_TM_MAX_PRIORITIES  16

/** The ODP_TM MAX_LEVELS constant specifies the largest range of
 * tm_node levels that any TM system can support.  Hence all tm_node level
 * values MUST be in the range 0..ODP_TM_MAX_LEVELS-1.  Smaller tm_node
 * levels are associated with tm_nodes closer to the TM system egress.
 */
#define ODP_TM_MAX_LEVELS  8

/**
 * The smallest SCHED weight is 1 (i.e. 0 is not a legal WFQ/WRR value).
 */
#define ODP_TM_MIN_SCHED_WEIGHT  1

/** The ODP_TM_MAX_SCHED_WEIGHT constant is the largest weight any TM system
 * can support (at least from a configuration standpoint).  A given TM system
 * could have a smaller value.
 */
#define ODP_TM_MAX_SCHED_WEIGHT  255

/** The ODP_TM_MAX_TM_QUEUES constant is the largest number of tm_queues
 * that can handled by any one TM system.
 */
#define ODP_TM_MAX_TM_QUEUES  (16 * 1024 * 1024)

/** The ODP_TM_MAX_NUM_OUTPUTS constant is the largest number of outputs that
 * can be configured for any one TM system.
 */
#define ODP_TM_MAX_NUM_OUTPUTS  256

/** The ODP_TM_MAX_NUM_TM_NODES constant is the largest number of tm_nodes that
 * can be in existence for any one TM system.
 */
#define ODP_TM_MAX_NUM_TM_NODES  (1024 * 1024)

/** The ODP_TM_MAX_TM_NODE_FANIN constant is the largest number of fan-in
 * "inputs" that can be simultaneously connected to a single tm_node.
 * *TBD* Does this need to be as large as ODP_TM_MAX_TM_QUEUES? *TBD*
 */
#define ODP_TM_MAX_TM_NODE_FANIN  (1024 * 1024)

/** The ODP_TM_MIN_SHAPER_BW constant is the smallest amount of bandwidth that
 * can a shaper's peak or commit rate can be set to.  It is in units of
 * 1000 bytes/second so that it and the ODP_TM_MAX_SHAPER_BW can both fit in
 * 32 bits.
 */
#define ODP_TM_MIN_SHAPER_BW  1

/** The ODP_TM_MAX_SHAPER_BW constant is the largest amound of bandwidth that
 * any shaper's peak or commit rate can be set to.  It is in units of
 * 1000 bytes/second so that it and the ODP_TM_MIN_SHAPER_BW can both fit in
 * 32 bits.
 */
#define ODP_TM_MAX_SHAPER_BW  12500000

/** The ODP_NUM_SHAPER_COLORS constant just counts the number of enumeration
 * values defined in the odp_tm_shaper_color_t type.
 */
#define ODP_NUM_SHAPER_COLORS  3

/** The INVALID_PRIORITY constant is used when one needs to indicate an
 * invalid priority value.
 */
#define ODP_TM_INVALID_PRIORITY  255

/** The odp_tm_percent_t type is used when specifying fields that are
 * percentages.  It is a fixed point integer whose units are 1/100 of a
 * percent.  Hence 100% is represented as the integer value 10000.  Note
 * that because it is often used as a ratio of the current queue value and
 * maximum queue threshold, it can be > 100%, but in any event will never
 * be larger than 500% (i.e. it MUST be capped at 50000).
 */
typedef uint16_t odp_tm_percent_t;

/** The odp_tm_handle_t type is a generic type that can stand for any of the
 * other ODP_TM handle types.
 */
typedef uint64_t odp_tm_handle_t;

/** Each odp_tm_t value represents a specific TM system.  Almost all
 * functions in this API require a odp_tm_t value - either directly
 * as a function parameter or indirectly by having another ODP TM handle value
 * as a function parameter.
 */
typedef odp_tm_handle_t odp_tm_t;

/** Each odp_tm_queue_t value is an opaque ODP handle representing a specific
 * tm_queue within a specific TM system.
 */
typedef odp_tm_handle_t odp_tm_queue_t;

/** Each odp_tm_node_t value is an opaque ODP handle representing a specific
 * tm_node within a specific TM system.
 */
typedef odp_tm_handle_t odp_tm_node_t;

/** Each odp_tm_shaper_t value is an opaque ODP handle representing a specific
 * shaper profile usable across all TM systems described by this API.  A given
 * shaper profile can then be attached to any tm_queue or tm_node.
 */
typedef odp_tm_handle_t odp_tm_shaper_t;

/** Each odp_tm_sched_t value is an opaque ODP handle representing a specific
 * tm_node scheduler profile usable across all TM systems described by this
 * API.  A given tm_node scheduler profile can then be attached to any tm_node.
 */
typedef odp_tm_handle_t odp_tm_sched_t;

/** Each odp_tm_threshold_t value is an opaque ODP handle representing a
 * specific queue threshold profile usable across all TM systems described by
 * this API.  A given queue threshold profile can then be attached to any
 * tm_queue or tm_node.
 */
typedef odp_tm_handle_t odp_tm_threshold_t;

/** Each odp_tm_wred_t value is an opaque ODP handle representing a specific
 * WRED profile usable across all TM systems described by this API.  A given
 * WRED profile can then be attached to any tm_queue or tm_node.
 */
typedef odp_tm_handle_t odp_tm_wred_t;

/** The ODP_TM_INVALID constant can be used with any ODP TM handle type and
 * indicates that this value does NOT represent a valid TM object.
 */
#define ODP_TM_INVALID  0

/**
 * @def ODP_TM_ROOT
 * Constant that is used to refer to the egress/root node of the TM subsystem's
 * tree/hierarchy of nodes.
 */
#define ODP_TM_ROOT  ((odp_tm_handle_t)-1)

/** Get printable format of odp_queue_t */
static inline uint64_t odp_tm_handle_to_u64(odp_tm_handle_t hdl)
{
	return hdl;
}

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif