DPDK 22.11.4
rte_tm_driver.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
3 */
4
5#ifndef __INCLUDE_RTE_TM_DRIVER_H__
6#define __INCLUDE_RTE_TM_DRIVER_H__
7
17#include <stdint.h>
18
19#include <rte_errno.h>
20#include "rte_ethdev.h"
21#include "ethdev_driver.h"
22#include "rte_tm.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
29typedef int (*rte_tm_node_type_get_t)(struct rte_eth_dev *dev,
30 uint32_t node_id,
31 int *is_leaf,
32 struct rte_tm_error *error);
33
35typedef int (*rte_tm_capabilities_get_t)(struct rte_eth_dev *dev,
36 struct rte_tm_capabilities *cap,
37 struct rte_tm_error *error);
38
40typedef int (*rte_tm_level_capabilities_get_t)(struct rte_eth_dev *dev,
41 uint32_t level_id,
42 struct rte_tm_level_capabilities *cap,
43 struct rte_tm_error *error);
44
46typedef int (*rte_tm_node_capabilities_get_t)(struct rte_eth_dev *dev,
47 uint32_t node_id,
48 struct rte_tm_node_capabilities *cap,
49 struct rte_tm_error *error);
50
52typedef int (*rte_tm_wred_profile_add_t)(struct rte_eth_dev *dev,
53 uint32_t wred_profile_id,
54 struct rte_tm_wred_params *profile,
55 struct rte_tm_error *error);
56
58typedef int (*rte_tm_wred_profile_delete_t)(struct rte_eth_dev *dev,
59 uint32_t wred_profile_id,
60 struct rte_tm_error *error);
61
63typedef int (*rte_tm_shared_wred_context_add_update_t)(
64 struct rte_eth_dev *dev,
65 uint32_t shared_wred_context_id,
66 uint32_t wred_profile_id,
67 struct rte_tm_error *error);
68
70typedef int (*rte_tm_shared_wred_context_delete_t)(
71 struct rte_eth_dev *dev,
72 uint32_t shared_wred_context_id,
73 struct rte_tm_error *error);
74
76typedef int (*rte_tm_shaper_profile_add_t)(struct rte_eth_dev *dev,
77 uint32_t shaper_profile_id,
78 struct rte_tm_shaper_params *profile,
79 struct rte_tm_error *error);
80
82typedef int (*rte_tm_shaper_profile_delete_t)(struct rte_eth_dev *dev,
83 uint32_t shaper_profile_id,
84 struct rte_tm_error *error);
85
87typedef int (*rte_tm_shared_shaper_add_update_t)(struct rte_eth_dev *dev,
88 uint32_t shared_shaper_id,
89 uint32_t shaper_profile_id,
90 struct rte_tm_error *error);
91
93typedef int (*rte_tm_shared_shaper_delete_t)(struct rte_eth_dev *dev,
94 uint32_t shared_shaper_id,
95 struct rte_tm_error *error);
96
98typedef int (*rte_tm_node_add_t)(struct rte_eth_dev *dev,
99 uint32_t node_id,
100 uint32_t parent_node_id,
101 uint32_t priority,
102 uint32_t weight,
103 uint32_t level_id,
104 struct rte_tm_node_params *params,
105 struct rte_tm_error *error);
106
108typedef int (*rte_tm_node_delete_t)(struct rte_eth_dev *dev,
109 uint32_t node_id,
110 struct rte_tm_error *error);
111
113typedef int (*rte_tm_node_suspend_t)(struct rte_eth_dev *dev,
114 uint32_t node_id,
115 struct rte_tm_error *error);
116
118typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev,
119 uint32_t node_id,
120 struct rte_tm_error *error);
121
123typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev,
124 int clear_on_fail,
125 struct rte_tm_error *error);
126
128typedef int (*rte_tm_node_parent_update_t)(struct rte_eth_dev *dev,
129 uint32_t node_id,
130 uint32_t parent_node_id,
131 uint32_t priority,
132 uint32_t weight,
133 struct rte_tm_error *error);
134
136typedef int (*rte_tm_node_shaper_update_t)(struct rte_eth_dev *dev,
137 uint32_t node_id,
138 uint32_t shaper_profile_id,
139 struct rte_tm_error *error);
140
142typedef int (*rte_tm_node_shared_shaper_update_t)(struct rte_eth_dev *dev,
143 uint32_t node_id,
144 uint32_t shared_shaper_id,
145 int32_t add,
146 struct rte_tm_error *error);
147
149typedef int (*rte_tm_node_stats_update_t)(struct rte_eth_dev *dev,
150 uint32_t node_id,
151 uint64_t stats_mask,
152 struct rte_tm_error *error);
153
155typedef int (*rte_tm_node_wfq_weight_mode_update_t)(
156 struct rte_eth_dev *dev,
157 uint32_t node_id,
158 int *wfq_weight_mode,
159 uint32_t n_sp_priorities,
160 struct rte_tm_error *error);
161
163typedef int (*rte_tm_node_cman_update_t)(struct rte_eth_dev *dev,
164 uint32_t node_id,
165 enum rte_tm_cman_mode cman,
166 struct rte_tm_error *error);
167
169typedef int (*rte_tm_node_wred_context_update_t)(
170 struct rte_eth_dev *dev,
171 uint32_t node_id,
172 uint32_t wred_profile_id,
173 struct rte_tm_error *error);
174
176typedef int (*rte_tm_node_shared_wred_context_update_t)(
177 struct rte_eth_dev *dev,
178 uint32_t node_id,
179 uint32_t shared_wred_context_id,
180 int add,
181 struct rte_tm_error *error);
182
184typedef int (*rte_tm_node_stats_read_t)(struct rte_eth_dev *dev,
185 uint32_t node_id,
186 struct rte_tm_node_stats *stats,
187 uint64_t *stats_mask,
188 int clear,
189 struct rte_tm_error *error);
190
192typedef int (*rte_tm_mark_vlan_dei_t)(struct rte_eth_dev *dev,
193 int mark_green,
194 int mark_yellow,
195 int mark_red,
196 struct rte_tm_error *error);
197
199typedef int (*rte_tm_mark_ip_ecn_t)(struct rte_eth_dev *dev,
200 int mark_green,
201 int mark_yellow,
202 int mark_red,
203 struct rte_tm_error *error);
204
206typedef int (*rte_tm_mark_ip_dscp_t)(struct rte_eth_dev *dev,
207 int mark_green,
208 int mark_yellow,
209 int mark_red,
210 struct rte_tm_error *error);
211
212struct rte_tm_ops {
214 rte_tm_node_type_get_t node_type_get;
215
217 rte_tm_capabilities_get_t capabilities_get;
219 rte_tm_level_capabilities_get_t level_capabilities_get;
221 rte_tm_node_capabilities_get_t node_capabilities_get;
222
224 rte_tm_wred_profile_add_t wred_profile_add;
226 rte_tm_wred_profile_delete_t wred_profile_delete;
228 rte_tm_shared_wred_context_add_update_t
229 shared_wred_context_add_update;
231 rte_tm_shared_wred_context_delete_t
232 shared_wred_context_delete;
233
235 rte_tm_shaper_profile_add_t shaper_profile_add;
237 rte_tm_shaper_profile_delete_t shaper_profile_delete;
239 rte_tm_shared_shaper_add_update_t shared_shaper_add_update;
241 rte_tm_shared_shaper_delete_t shared_shaper_delete;
242
244 rte_tm_node_add_t node_add;
246 rte_tm_node_delete_t node_delete;
248 rte_tm_node_suspend_t node_suspend;
250 rte_tm_node_resume_t node_resume;
252 rte_tm_hierarchy_commit_t hierarchy_commit;
253
255 rte_tm_node_parent_update_t node_parent_update;
257 rte_tm_node_shaper_update_t node_shaper_update;
259 rte_tm_node_shared_shaper_update_t node_shared_shaper_update;
261 rte_tm_node_stats_update_t node_stats_update;
263 rte_tm_node_wfq_weight_mode_update_t node_wfq_weight_mode_update;
265 rte_tm_node_cman_update_t node_cman_update;
267 rte_tm_node_wred_context_update_t node_wred_context_update;
269 rte_tm_node_shared_wred_context_update_t
270 node_shared_wred_context_update;
272 rte_tm_node_stats_read_t node_stats_read;
273
275 rte_tm_mark_vlan_dei_t mark_vlan_dei;
277 rte_tm_mark_ip_ecn_t mark_ip_ecn;
279 rte_tm_mark_ip_dscp_t mark_ip_dscp;
280};
281
301static inline int
303 int code,
304 enum rte_tm_error_type type,
305 const void *cause,
306 const char *message)
307{
308 if (error) {
309 *error = (struct rte_tm_error){
310 .type = type,
311 .cause = cause,
312 .message = message,
313 };
314 }
315 rte_errno = code;
316 return code;
317}
318
331const struct rte_tm_ops *
332rte_tm_ops_get(uint16_t port_id, struct rte_tm_error *error);
333
334#ifdef __cplusplus
335}
336#endif
337
338#endif /* __INCLUDE_RTE_TM_DRIVER_H__ */
#define rte_errno
Definition: rte_errno.h:29
rte_tm_error_type
Definition: rte_tm.h:1177
rte_tm_cman_mode
Definition: rte_tm.h:961
const struct rte_tm_ops * rte_tm_ops_get(uint16_t port_id, struct rte_tm_error *error)
static int rte_tm_error_set(struct rte_tm_error *error, int code, enum rte_tm_error_type type, const void *cause, const char *message)
const char * message
Definition: rte_tm.h:1228
enum rte_tm_error_type type
Definition: rte_tm.h:1226
const void * cause
Definition: rte_tm.h:1227