DPDK 22.11.5
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
8#ifdef __cplusplus
9extern "C" {
10#endif
11
59#include <rte_compat.h>
60#include <rte_mbuf.h>
61#include <rte_meter.h>
62
64#include "rte_red.h"
65#include "rte_pie.h"
66
75#define RTE_SCHED_QUEUES_PER_PIPE 16
76
81#define RTE_SCHED_BE_QUEUES_PER_PIPE 4
82
87#define RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE \
88(RTE_SCHED_QUEUES_PER_PIPE - RTE_SCHED_BE_QUEUES_PER_PIPE + 1)
89
93#define RTE_SCHED_TRAFFIC_CLASS_BE (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1)
94
95/*
96 * Ethernet framing overhead. Overhead fields per Ethernet frame:
97 * 1. Preamble: 7 bytes;
98 * 2. Start of Frame Delimiter (SFD): 1 byte;
99 * 3. Frame Check Sequence (FCS): 4 bytes;
100 * 4. Inter Frame Gap (IFG): 12 bytes.
101 *
102 * The FCS is considered overhead only if not included in the packet
103 * length (field pkt_len of struct rte_mbuf).
104 *
105 * @see struct rte_sched_port_params
106 */
107#ifndef RTE_SCHED_FRAME_OVERHEAD_DEFAULT
108#define RTE_SCHED_FRAME_OVERHEAD_DEFAULT 24
109#endif
110
131};
132
133/*
134 * Pipe configuration parameters. The period and credits_per_period
135 * parameters are measured in bytes, with one byte meaning the time
136 * duration associated with the transmission of one byte on the
137 * physical medium of the output port, with pipe or pipe traffic class
138 * rate (measured as percentage of output port rate) determined as
139 * credits_per_period divided by period. One credit represents one
140 * byte.
141 */
142struct rte_sched_pipe_params {
144 uint64_t tb_rate;
145
147 uint64_t tb_size;
148
150 uint64_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
151
153 uint64_t tc_period;
154
156 uint8_t tc_ov_weight;
157
159 uint8_t wrr_weights[RTE_SCHED_BE_QUEUES_PER_PIPE];
160};
161
162/*
163 * Congestion Management configuration parameters.
164 */
165struct rte_sched_cman_params {
167 enum rte_sched_cman_mode cman_mode;
168
169 union {
172
175 };
176};
177
178/*
179 * Subport configuration parameters. The period and credits_per_period
180 * parameters are measured in bytes, with one byte meaning the time
181 * duration associated with the transmission of one byte on the
182 * physical medium of the output port, with pipe or pipe traffic class
183 * rate (measured as percentage of output port rate) determined as
184 * credits_per_period divided by period. One credit represents one
185 * byte.
186 */
187struct rte_sched_subport_params {
194 uint32_t n_pipes_per_subport_enabled;
195
201
205 struct rte_sched_pipe_params *pipe_profiles;
206
208 uint32_t n_pipe_profiles;
209
211 uint32_t n_max_pipe_profiles;
212
217 struct rte_sched_cman_params *cman_params;
218};
219
220struct rte_sched_subport_profile_params {
222 uint64_t tb_rate;
223
225 uint64_t tb_size;
226
228 uint64_t tc_rate[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE];
229
231 uint64_t tc_period;
232};
233
238
241
244
247
250};
251
255 uint64_t n_pkts;
256
259
262
264 uint64_t n_bytes;
265
268};
269
273 const char *name;
274
277
279 uint64_t rate;
280
284 uint32_t mtu;
285
288
291
295 struct rte_sched_subport_profile_params *subport_profiles;
296
299
302
309};
310
311/*
312 * Configuration
313 *
314 ***/
315
324struct rte_sched_port *
326
334void
335rte_sched_port_free(struct rte_sched_port *port);
336
351int
352rte_sched_subport_pipe_profile_add(struct rte_sched_port *port,
353 uint32_t subport_id,
354 struct rte_sched_pipe_params *params,
355 uint32_t *pipe_profile_id);
356
374__rte_experimental
375int
376rte_sched_port_subport_profile_add(struct rte_sched_port *port,
377 struct rte_sched_subport_profile_params *profile,
378 uint32_t *subport_profile_id);
379
398int
399rte_sched_subport_config(struct rte_sched_port *port,
400 uint32_t subport_id,
401 struct rte_sched_subport_params *params,
402 uint32_t subport_profile_id);
403
418int
419rte_sched_pipe_config(struct rte_sched_port *port,
420 uint32_t subport_id,
421 uint32_t pipe_id,
422 int32_t pipe_profile);
423
434uint32_t
436 struct rte_sched_subport_params **subport_params);
437/*
438 * Statistics
439 *
440 ***/
441
459int
460rte_sched_subport_read_stats(struct rte_sched_port *port,
461 uint32_t subport_id,
462 struct rte_sched_subport_stats *stats,
463 uint32_t *tc_ov);
464
481int
482rte_sched_queue_read_stats(struct rte_sched_port *port,
483 uint32_t queue_id,
484 struct rte_sched_queue_stats *stats,
485 uint16_t *qlen);
486
507void
508rte_sched_port_pkt_write(struct rte_sched_port *port,
509 struct rte_mbuf *pkt,
510 uint32_t subport, uint32_t pipe, uint32_t traffic_class,
511 uint32_t queue, enum rte_color color);
512
533void
534rte_sched_port_pkt_read_tree_path(struct rte_sched_port *port,
535 const struct rte_mbuf *pkt,
536 uint32_t *subport, uint32_t *pipe,
537 uint32_t *traffic_class, uint32_t *queue);
538
539enum rte_color
540rte_sched_port_pkt_read_color(const struct rte_mbuf *pkt);
541
560int
561rte_sched_port_enqueue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint32_t n_pkts);
562
580int
581rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint32_t n_pkts);
582
597__rte_experimental
598int
599rte_sched_subport_tc_ov_config(struct rte_sched_port *port, uint32_t subport_id, bool tc_ov_enable);
600
601#ifdef __cplusplus
602}
603#endif
604
605#endif /* __INCLUDE_RTE_SCHED_H__ */
rte_color
Definition: rte_meter.h:35
@ RTE_COLORS
Definition: rte_meter.h:39
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:87
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)
__rte_experimental 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_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:81
__rte_experimental int rte_sched_subport_tc_ov_config(struct rte_sched_port *port, uint32_t subport_id, bool tc_ov_enable)
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:128
@ RTE_SCHED_CMAN_PIE
Definition: rte_sched.h:130
@ RTE_SCHED_CMAN_RED
Definition: rte_sched.h:129
uint32_t frame_overhead
Definition: rte_sched.h:287
uint32_t n_subport_profiles
Definition: rte_sched.h:298
struct rte_sched_subport_profile_params * subport_profiles
Definition: rte_sched.h:295
uint32_t n_subports_per_port
Definition: rte_sched.h:290
const char * name
Definition: rte_sched.h:273
uint32_t n_pipes_per_subport
Definition: rte_sched.h:308
uint32_t n_max_subport_profiles
Definition: rte_sched.h:301
uint64_t n_pkts_dropped
Definition: rte_sched.h:258
uint64_t n_pkts_cman_dropped
Definition: rte_sched.h:261
uint64_t n_bytes_dropped
Definition: rte_sched.h:267
uint64_t n_bytes_tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:243
uint64_t n_pkts_tc[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:237
uint64_t n_bytes_tc_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:246
uint64_t n_pkts_cman_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:249
uint64_t n_pkts_tc_dropped[RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE]
Definition: rte_sched.h:240