1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Intel Corporation
5 #ifndef __INCLUDE_RTE_TM_DRIVER_H__
6 #define __INCLUDE_RTE_TM_DRIVER_H__
10 * RTE Generic Traffic Manager API (Driver Side)
12 * This file provides implementation helpers for internal use by PMDs, they
13 * are not intended to be exposed to applications and are not subject to ABI
19 #include <rte_errno.h>
20 #include "rte_ethdev.h"
27 /** @internal Traffic manager node ID validate and type get */
28 typedef int (*rte_tm_node_type_get_t)(struct rte_eth_dev *dev,
31 struct rte_tm_error *error);
33 /** @internal Traffic manager capabilities get */
34 typedef int (*rte_tm_capabilities_get_t)(struct rte_eth_dev *dev,
35 struct rte_tm_capabilities *cap,
36 struct rte_tm_error *error);
38 /** @internal Traffic manager level capabilities get */
39 typedef int (*rte_tm_level_capabilities_get_t)(struct rte_eth_dev *dev,
41 struct rte_tm_level_capabilities *cap,
42 struct rte_tm_error *error);
44 /** @internal Traffic manager node capabilities get */
45 typedef int (*rte_tm_node_capabilities_get_t)(struct rte_eth_dev *dev,
47 struct rte_tm_node_capabilities *cap,
48 struct rte_tm_error *error);
50 /** @internal Traffic manager WRED profile add */
51 typedef int (*rte_tm_wred_profile_add_t)(struct rte_eth_dev *dev,
52 uint32_t wred_profile_id,
53 struct rte_tm_wred_params *profile,
54 struct rte_tm_error *error);
56 /** @internal Traffic manager WRED profile delete */
57 typedef int (*rte_tm_wred_profile_delete_t)(struct rte_eth_dev *dev,
58 uint32_t wred_profile_id,
59 struct rte_tm_error *error);
61 /** @internal Traffic manager shared WRED context add */
62 typedef int (*rte_tm_shared_wred_context_add_update_t)(
63 struct rte_eth_dev *dev,
64 uint32_t shared_wred_context_id,
65 uint32_t wred_profile_id,
66 struct rte_tm_error *error);
68 /** @internal Traffic manager shared WRED context delete */
69 typedef int (*rte_tm_shared_wred_context_delete_t)(
70 struct rte_eth_dev *dev,
71 uint32_t shared_wred_context_id,
72 struct rte_tm_error *error);
74 /** @internal Traffic manager shaper profile add */
75 typedef int (*rte_tm_shaper_profile_add_t)(struct rte_eth_dev *dev,
76 uint32_t shaper_profile_id,
77 struct rte_tm_shaper_params *profile,
78 struct rte_tm_error *error);
80 /** @internal Traffic manager shaper profile delete */
81 typedef int (*rte_tm_shaper_profile_delete_t)(struct rte_eth_dev *dev,
82 uint32_t shaper_profile_id,
83 struct rte_tm_error *error);
85 /** @internal Traffic manager shared shaper add/update */
86 typedef int (*rte_tm_shared_shaper_add_update_t)(struct rte_eth_dev *dev,
87 uint32_t shared_shaper_id,
88 uint32_t shaper_profile_id,
89 struct rte_tm_error *error);
91 /** @internal Traffic manager shared shaper delete */
92 typedef int (*rte_tm_shared_shaper_delete_t)(struct rte_eth_dev *dev,
93 uint32_t shared_shaper_id,
94 struct rte_tm_error *error);
96 /** @internal Traffic manager node add */
97 typedef int (*rte_tm_node_add_t)(struct rte_eth_dev *dev,
99 uint32_t parent_node_id,
103 struct rte_tm_node_params *params,
104 struct rte_tm_error *error);
106 /** @internal Traffic manager node delete */
107 typedef int (*rte_tm_node_delete_t)(struct rte_eth_dev *dev,
109 struct rte_tm_error *error);
111 /** @internal Traffic manager node suspend */
112 typedef int (*rte_tm_node_suspend_t)(struct rte_eth_dev *dev,
114 struct rte_tm_error *error);
116 /** @internal Traffic manager node resume */
117 typedef int (*rte_tm_node_resume_t)(struct rte_eth_dev *dev,
119 struct rte_tm_error *error);
121 /** @internal Traffic manager hierarchy commit */
122 typedef int (*rte_tm_hierarchy_commit_t)(struct rte_eth_dev *dev,
124 struct rte_tm_error *error);
126 /** @internal Traffic manager node parent update */
127 typedef int (*rte_tm_node_parent_update_t)(struct rte_eth_dev *dev,
129 uint32_t parent_node_id,
132 struct rte_tm_error *error);
134 /** @internal Traffic manager node shaper update */
135 typedef int (*rte_tm_node_shaper_update_t)(struct rte_eth_dev *dev,
137 uint32_t shaper_profile_id,
138 struct rte_tm_error *error);
140 /** @internal Traffic manager node shaper update */
141 typedef int (*rte_tm_node_shared_shaper_update_t)(struct rte_eth_dev *dev,
143 uint32_t shared_shaper_id,
145 struct rte_tm_error *error);
147 /** @internal Traffic manager node stats update */
148 typedef int (*rte_tm_node_stats_update_t)(struct rte_eth_dev *dev,
151 struct rte_tm_error *error);
153 /** @internal Traffic manager node WFQ weight mode update */
154 typedef int (*rte_tm_node_wfq_weight_mode_update_t)(
155 struct rte_eth_dev *dev,
157 int *wfq_weight_mode,
158 uint32_t n_sp_priorities,
159 struct rte_tm_error *error);
161 /** @internal Traffic manager node congestion management mode update */
162 typedef int (*rte_tm_node_cman_update_t)(struct rte_eth_dev *dev,
164 enum rte_tm_cman_mode cman,
165 struct rte_tm_error *error);
167 /** @internal Traffic manager node WRED context update */
168 typedef int (*rte_tm_node_wred_context_update_t)(
169 struct rte_eth_dev *dev,
171 uint32_t wred_profile_id,
172 struct rte_tm_error *error);
174 /** @internal Traffic manager node WRED context update */
175 typedef int (*rte_tm_node_shared_wred_context_update_t)(
176 struct rte_eth_dev *dev,
178 uint32_t shared_wred_context_id,
180 struct rte_tm_error *error);
182 /** @internal Traffic manager read stats counters for specific node */
183 typedef int (*rte_tm_node_stats_read_t)(struct rte_eth_dev *dev,
185 struct rte_tm_node_stats *stats,
186 uint64_t *stats_mask,
188 struct rte_tm_error *error);
190 /** @internal Traffic manager packet marking - VLAN DEI */
191 typedef int (*rte_tm_mark_vlan_dei_t)(struct rte_eth_dev *dev,
195 struct rte_tm_error *error);
197 /** @internal Traffic manager packet marking - IPv4/IPv6 ECN */
198 typedef int (*rte_tm_mark_ip_ecn_t)(struct rte_eth_dev *dev,
202 struct rte_tm_error *error);
204 /** @internal Traffic manager packet marking - IPv4/IPv6 DSCP */
205 typedef int (*rte_tm_mark_ip_dscp_t)(struct rte_eth_dev *dev,
209 struct rte_tm_error *error);
212 /** Traffic manager node type get */
213 rte_tm_node_type_get_t node_type_get;
215 /** Traffic manager capabilities_get */
216 rte_tm_capabilities_get_t capabilities_get;
217 /** Traffic manager level capabilities_get */
218 rte_tm_level_capabilities_get_t level_capabilities_get;
219 /** Traffic manager node capabilities get */
220 rte_tm_node_capabilities_get_t node_capabilities_get;
222 /** Traffic manager WRED profile add */
223 rte_tm_wred_profile_add_t wred_profile_add;
224 /** Traffic manager WRED profile delete */
225 rte_tm_wred_profile_delete_t wred_profile_delete;
226 /** Traffic manager shared WRED context add/update */
227 rte_tm_shared_wred_context_add_update_t
228 shared_wred_context_add_update;
229 /** Traffic manager shared WRED context delete */
230 rte_tm_shared_wred_context_delete_t
231 shared_wred_context_delete;
233 /** Traffic manager shaper profile add */
234 rte_tm_shaper_profile_add_t shaper_profile_add;
235 /** Traffic manager shaper profile delete */
236 rte_tm_shaper_profile_delete_t shaper_profile_delete;
237 /** Traffic manager shared shaper add/update */
238 rte_tm_shared_shaper_add_update_t shared_shaper_add_update;
239 /** Traffic manager shared shaper delete */
240 rte_tm_shared_shaper_delete_t shared_shaper_delete;
242 /** Traffic manager node add */
243 rte_tm_node_add_t node_add;
244 /** Traffic manager node delete */
245 rte_tm_node_delete_t node_delete;
246 /** Traffic manager node suspend */
247 rte_tm_node_suspend_t node_suspend;
248 /** Traffic manager node resume */
249 rte_tm_node_resume_t node_resume;
250 /** Traffic manager hierarchy commit */
251 rte_tm_hierarchy_commit_t hierarchy_commit;
253 /** Traffic manager node parent update */
254 rte_tm_node_parent_update_t node_parent_update;
255 /** Traffic manager node shaper update */
256 rte_tm_node_shaper_update_t node_shaper_update;
257 /** Traffic manager node shared shaper update */
258 rte_tm_node_shared_shaper_update_t node_shared_shaper_update;
259 /** Traffic manager node stats update */
260 rte_tm_node_stats_update_t node_stats_update;
261 /** Traffic manager node WFQ weight mode update */
262 rte_tm_node_wfq_weight_mode_update_t node_wfq_weight_mode_update;
263 /** Traffic manager node congestion management mode update */
264 rte_tm_node_cman_update_t node_cman_update;
265 /** Traffic manager node WRED context update */
266 rte_tm_node_wred_context_update_t node_wred_context_update;
267 /** Traffic manager node shared WRED context update */
268 rte_tm_node_shared_wred_context_update_t
269 node_shared_wred_context_update;
270 /** Traffic manager read statistics counters for current node */
271 rte_tm_node_stats_read_t node_stats_read;
273 /** Traffic manager packet marking - VLAN DEI */
274 rte_tm_mark_vlan_dei_t mark_vlan_dei;
275 /** Traffic manager packet marking - IPv4/IPv6 ECN */
276 rte_tm_mark_ip_ecn_t mark_ip_ecn;
277 /** Traffic manager packet marking - IPv4/IPv6 DSCP */
278 rte_tm_mark_ip_dscp_t mark_ip_dscp;
282 * Initialize generic error structure.
284 * This function also sets rte_errno to a given value.
287 * Pointer to error structure (may be NULL).
289 * Related error code (rte_errno).
291 * Cause field and error type.
293 * Object responsible for the error.
295 * Human-readable error message.
301 rte_tm_error_set(struct rte_tm_error *error,
303 enum rte_tm_error_type type,
308 *error = (struct rte_tm_error){
319 * Get generic traffic manager operations structure from a port
322 * The port identifier of the Ethernet device.
327 * The traffic manager operations structure associated with port_id on
328 * success, NULL otherwise.
330 const struct rte_tm_ops *
331 rte_tm_ops_get(uint16_t port_id, struct rte_tm_error *error);
337 #endif /* __INCLUDE_RTE_TM_DRIVER_H__ */