DPDK 25.03.0-rc0
rte_sched.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2014 Intel Corporation
3 */
4
5#ifndef __INCLUDE_RTE_SCHED_H__
6#define __INCLUDE_RTE_SCHED_H__
7
54#include <rte_mbuf.h>
55#include <rte_meter.h>
56
58#include "rte_red.h"
59#include "rte_pie.h"
60
61#ifdef __cplusplus
62extern "C" {
63#endif
64
73#define RTE_SCHED_QUEUES_PER_PIPE 16
74
79#define RTE_SCHED_BE_QUEUES_PER_PIPE 4
80
85#define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE \
86(RTE_SCHED_QUEUES_PER_PIPE - RTE_SCHED_BE_QUEUES_PER_PIPE + 1)
87
91#define RTE_SCHED_TRAFFIC_CLASS_BE (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1)
92
93/*
94 * Ethernet framing overhead. Overhead fields per Ethernet frame:
95 * 1. Preamble: 7 bytes;
96 * 2. Start of Frame Delimiter (SFD): 1 byte;
97 * 3. Frame Check Sequence (FCS): 4 bytes;
98 * 4. Inter Frame Gap (IFG): 12 bytes.
99 *
100 * The FCS is considered overhead only if not included in the packet
101 * length (field pkt_len of struct rte_mbuf).
102 *
103 * @see struct rte_sched_port_params
104 */
105#ifndef RTE_SCHED_FRAME_OVERHEAD_DEFAULT
106#define RTE_SCHED_FRAME_OVERHEAD_DEFAULT 24
107#endif
108
129};
130
131/*
132 * Pipe configuration parameters. The period and credits_per_period
133 * parameters are measured in bytes, with one byte meaning the time
134 * duration associated with the transmission of one byte on the
135 * physical medium of the output port, with pipe or pipe traffic class
136 * rate (measured as percentage of output port rate) determined as
137 * credits_per_period divided by period. One credit represents one
138 * byte.
139 */
140struct rte_sched_pipe_params {
142 uint64_t tb_rate;
143
145 uint64_t tb_size;
146
148 uint64_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
149
151 uint64_t tc_period;
152
154 uint8_t tc_ov_weight;
155
157 uint8_t wrr_weights[RTE_SCHED_BE_QUEUES_PER_PIPE];
158};
159
160/*
161 * Congestion Management configuration parameters.
162 */
163struct rte_sched_cman_params {
165 enum rte_sched_cman_mode cman_mode;
166
167 union {
170
173 };
174};
175
176/*
177 * Subport configuration parameters. The period and credits_per_period
178 * parameters are measured in bytes, with one byte meaning the time
179 * duration associated with the transmission of one byte on the
180 * physical medium of the output port, with pipe or pipe traffic class
181 * rate (measured as percentage of output port rate) determined as
182 * credits_per_period divided by period. One credit represents one
183 * byte.
184 */
185struct rte_sched_subport_params {
192 uint32_t n_pipes_per_subport_enabled;
193
199
203 struct rte_sched_pipe_params *pipe_profiles;
204
206 uint32_t n_pipe_profiles;
207
209 uint32_t n_max_pipe_profiles;
210
215 struct rte_sched_cman_params *cman_params;
216};
217
218struct rte_sched_subport_profile_params {
220 uint64_t tb_rate;
221
223 uint64_t tb_size;
224
226 uint64_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
227
229 uint64_t tc_period;
230};
231
236
239
242
245
248};
249
253 uint64_t n_pkts;
254
257
260
262 uint64_t n_bytes;
263
266};
267
271 const char *name;
272
275
277 uint64_t rate;
278
282 uint32_t mtu;
283
286
289
293 struct rte_sched_subport_profile_params *subport_profiles;
294
297
300
307};
308
309/*
310 * Configuration
311 */
312
321struct rte_sched_port *
323
331void
332rte_sched_port_free(struct rte_sched_port *port);
333
348int
349rte_sched_subport_pipe_profile_add(struct rte_sched_port *port,
350 uint32_t subport_id,
351 struct rte_sched_pipe_params *params,
352 uint32_t *pipe_profile_id);
353
368int
369rte_sched_port_subport_profile_add(struct rte_sched_port *port,
370 struct rte_sched_subport_profile_params *profile,
371 uint32_t *subport_profile_id);
372
391int
392rte_sched_subport_config(struct rte_sched_port *port,
393 uint32_t subport_id,
394 struct rte_sched_subport_params *params,
395 uint32_t subport_profile_id);
396
411int
412rte_sched_pipe_config(struct rte_sched_port *port,
413 uint32_t subport_id,
414 uint32_t pipe_id,
415 int32_t pipe_profile);
416
427uint32_t
429 struct rte_sched_subport_params **subport_params);
430
431/*
432 * Statistics
433 */
434
452int
453rte_sched_subport_read_stats(struct rte_sched_port *port,
454 uint32_t subport_id,
455 struct rte_sched_subport_stats *stats,
456 uint32_t *tc_ov);
457
474int
475rte_sched_queue_read_stats(struct rte_sched_port *port,
476 uint32_t queue_id,
477 struct rte_sched_queue_stats *stats,
478 uint16_t *qlen);
479
500void
501rte_sched_port_pkt_write(struct rte_sched_port *port,
502 struct rte_mbuf *pkt,
503 uint32_t subport, uint32_t pipe, uint32_t traffic_class,
504 uint32_t queue, enum rte_color color);
505
526void
527rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port,
528 const struct rte_mbuf *pkt,
529 uint32_t *subport, uint32_t *pipe,
530 uint32_t *traffic_class, uint32_t *queue);
531
532enum rte_color
533rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt);
534
553int
554rte_sched_port_enqueue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint32_t n_pkts);
555
573int
574rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint32_t n_pkts);
575
590int
591rte_sched_subport_tc_ov_config(struct rte_sched_port *port, uint32_t subport_id, bool tc_ov_enable);
592
593#ifdef __cplusplus
594}
595#endif
596
597#endif /* __INCLUDE_RTE_SCHED_H__ */
rte_color
Definition: rte_meter.h:32
@ RTE_COLORS
Definition: rte_meter.h:36
int rte_sched_pipe_config(struct rte_sched_port *port, uint32_t subport_id, uint32_t pipe_id, int32_t pipe_profile)
int rte_sched_port_enqueue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint32_t n_pkts)
void rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port, const struct rte_mbuf *pkt, uint32_t *subport, uint32_t *pipe, uint32_t *traffic_class, uint32_t *queue)
struct rte_sched_port * rte_sched_port_config(struct rte_sched_port_params *params)
int rte_sched_subport_pipe_profile_add(struct rte_sched_port *port, uint32_t subport_id, struct rte_sched_pipe_params *params, uint32_t *pipe_profile_id)
void rte_sched_port_pkt_write(struct rte_sched_port *port, struct rte_mbuf *pkt, uint32_t subport, uint32_t pipe, uint32_t traffic_class, uint32_t queue, enum rte_color color)
uint32_t rte_sched_port_get_memory_footprint(struct rte_sched_port_params *port_params, struct rte_sched_subport_params **subport_params)
#define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE
Definition: rte_sched.h:85
int rte_sched_subport_read_stats(struct rte_sched_port *port, uint32_t subport_id, struct rte_sched_subport_stats *stats, uint32_t *tc_ov)
int rte_sched_subport_tc_ov_config(struct rte_sched_port *port, uint32_t subport_id, bool tc_ov_enable)
int rte_sched_subport_config(struct rte_sched_port *port, uint32_t subport_id, struct rte_sched_subport_params *params, uint32_t subport_profile_id)
void rte_sched_port_free(struct rte_sched_port *port)
int rte_sched_queue_read_stats(struct rte_sched_port *port, uint32_t queue_id, struct rte_sched_queue_stats *stats, uint16_t *qlen)
#define RTE_SCHED_BE_QUEUES_PER_PIPE
Definition: rte_sched.h:79
int rte_sched_port_subport_profile_add(struct rte_sched_port *port, struct rte_sched_subport_profile_params *profile, uint32_t *subport_profile_id)
int rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint32_t n_pkts)
rte_sched_cman_mode
Definition: rte_sched.h:126
@ RTE_SCHED_CMAN_PIE
Definition: rte_sched.h:128
@ RTE_SCHED_CMAN_RED
Definition: rte_sched.h:127
uint32_t frame_overhead
Definition: rte_sched.h:285
uint32_t n_subport_profiles
Definition: rte_sched.h:296
struct rte_sched_subport_profile_params * subport_profiles
Definition: rte_sched.h:293
uint32_t n_subports_per_port
Definition: rte_sched.h:288
const char * name
Definition: rte_sched.h:271
uint32_t n_pipes_per_subport
Definition: rte_sched.h:306
uint32_t n_max_subport_profiles
Definition: rte_sched.h:299
uint64_t n_pkts_dropped
Definition: rte_sched.h:256
uint64_t n_pkts_cman_dropped
Definition: rte_sched.h:259
uint64_t n_bytes_dropped
Definition: rte_sched.h:265
uint64_t n_bytes_tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:241
uint64_t n_pkts_tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:235
uint64_t n_bytes_tc_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:244
uint64_t n_pkts_cman_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:247
uint64_t n_pkts_tc_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:238