]> git.proxmox.com Git - ceph.git/blob - ceph/src/spdk/dpdk/lib/librte_ethdev/rte_mtr.h
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / spdk / dpdk / lib / librte_ethdev / rte_mtr.h
1 /*-
2 * BSD LICENSE
3 *
4 * Copyright 2017 Intel Corporation
5 * Copyright 2017 NXP
6 * Copyright 2017 Cavium
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * * Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
17 * distribution.
18 * * Neither the name of Intel Corporation nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 #ifndef __INCLUDE_RTE_MTR_H__
36 #define __INCLUDE_RTE_MTR_H__
37
38 /**
39 * @file
40 * RTE Generic Traffic Metering and Policing API
41 *
42 * This interface provides the ability to configure the traffic metering and
43 * policing (MTR) in a generic way.
44 *
45 * The processing done for each input packet hitting a MTR object is:
46 * A) Traffic metering: The packet is assigned a color (the meter output
47 * color), based on the previous history of the flow reflected in the
48 * current state of the MTR object, according to the specific traffic
49 * metering algorithm. The traffic metering algorithm can typically work
50 * in color aware mode, in which case the input packet already has an
51 * initial color (the input color), or in color blind mode, which is
52 * equivalent to considering all input packets initially colored as green.
53 * B) Policing: There is a separate policer action configured for each meter
54 * output color, which can:
55 * a) Drop the packet.
56 * b) Keep the same packet color: the policer output color matches the
57 * meter output color (essentially a no-op action).
58 * c) Recolor the packet: the policer output color is different than
59 * the meter output color.
60 * The policer output color is the output color of the packet, which is
61 * set in the packet meta-data (i.e. struct rte_mbuf::sched::color).
62 * C) Statistics: The set of counters maintained for each MTR object is
63 * configurable and subject to the implementation support. This set
64 * includes the number of packets and bytes dropped or passed for each
65 * output color.
66 *
67 * Once successfully created, an MTR object is linked to one or several flows
68 * through the meter action of the flow API.
69 * A) Whether an MTR object is private to a flow or potentially shared by
70 * several flows has to be specified at creation time.
71 * B) Several meter actions can be potentially registered for the same flow.
72 *
73 * @warning
74 * @b EXPERIMENTAL: this API may change without prior notice
75 */
76 #include <stdint.h>
77 #include <rte_compat.h>
78 #include <rte_common.h>
79
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83
84 /**
85 * Color
86 */
87 enum rte_mtr_color {
88 RTE_MTR_GREEN = 0, /**< Green */
89 RTE_MTR_YELLOW, /**< Yellow */
90 RTE_MTR_RED, /**< Red */
91 RTE_MTR_COLORS /**< Number of colors. */
92 };
93
94 /**
95 * Statistics counter type
96 */
97 enum rte_mtr_stats_type {
98 /** Number of packets passed as green by the policer. */
99 RTE_MTR_STATS_N_PKTS_GREEN = 1 << 0,
100
101 /** Number of packets passed as yellow by the policer. */
102 RTE_MTR_STATS_N_PKTS_YELLOW = 1 << 1,
103
104 /** Number of packets passed as red by the policer. */
105 RTE_MTR_STATS_N_PKTS_RED = 1 << 2,
106
107 /** Number of packets dropped by the policer. */
108 RTE_MTR_STATS_N_PKTS_DROPPED = 1 << 3,
109
110 /** Number of bytes passed as green by the policer. */
111 RTE_MTR_STATS_N_BYTES_GREEN = 1 << 4,
112
113 /** Number of bytes passed as yellow by the policer. */
114 RTE_MTR_STATS_N_BYTES_YELLOW = 1 << 5,
115
116 /** Number of bytes passed as red by the policer. */
117 RTE_MTR_STATS_N_BYTES_RED = 1 << 6,
118
119 /** Number of bytes dropped by the policer. */
120 RTE_MTR_STATS_N_BYTES_DROPPED = 1 << 7,
121 };
122
123 /**
124 * Statistics counters
125 */
126 struct rte_mtr_stats {
127 /** Number of packets passed by the policer (per color). */
128 uint64_t n_pkts[RTE_MTR_COLORS];
129
130 /** Number of bytes passed by the policer (per color). */
131 uint64_t n_bytes[RTE_MTR_COLORS];
132
133 /** Number of packets dropped by the policer. */
134 uint64_t n_pkts_dropped;
135
136 /** Number of bytes passed by the policer. */
137 uint64_t n_bytes_dropped;
138 };
139
140 /**
141 * Traffic metering algorithms
142 */
143 enum rte_mtr_algorithm {
144 /** No traffic metering performed, the output color is the same as the
145 * input color for every input packet. The meter of the MTR object is
146 * working in pass-through mode, having same effect as meter disable.
147 * @see rte_mtr_meter_disable()
148 */
149 RTE_MTR_NONE = 0,
150
151 /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
152 RTE_MTR_SRTCM_RFC2697,
153
154 /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
155 RTE_MTR_TRTCM_RFC2698,
156
157 /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
158 RTE_MTR_TRTCM_RFC4115,
159 };
160
161 /**
162 * Meter profile
163 */
164 struct rte_mtr_meter_profile {
165 /** Traffic metering algorithm. */
166 enum rte_mtr_algorithm alg;
167
168 RTE_STD_C11
169 union {
170 /** Items only valid when *alg* is set to srTCM - RFC 2697. */
171 struct {
172 /** Committed Information Rate (CIR) (bytes/second). */
173 uint64_t cir;
174
175 /** Committed Burst Size (CBS) (bytes). */
176 uint64_t cbs;
177
178 /** Excess Burst Size (EBS) (bytes). */
179 uint64_t ebs;
180 } srtcm_rfc2697;
181
182 /** Items only valid when *alg* is set to trTCM - RFC 2698. */
183 struct {
184 /** Committed Information Rate (CIR) (bytes/second). */
185 uint64_t cir;
186
187 /** Peak Information Rate (PIR) (bytes/second). */
188 uint64_t pir;
189
190 /** Committed Burst Size (CBS) (byes). */
191 uint64_t cbs;
192
193 /** Peak Burst Size (PBS) (bytes). */
194 uint64_t pbs;
195 } trtcm_rfc2698;
196
197 /** Items only valid when *alg* is set to trTCM - RFC 4115. */
198 struct {
199 /** Committed Information Rate (CIR) (bytes/second). */
200 uint64_t cir;
201
202 /** Excess Information Rate (EIR) (bytes/second). */
203 uint64_t eir;
204
205 /** Committed Burst Size (CBS) (byes). */
206 uint64_t cbs;
207
208 /** Excess Burst Size (EBS) (bytes). */
209 uint64_t ebs;
210 } trtcm_rfc4115;
211 };
212 };
213
214 /**
215 * Policer actions
216 */
217 enum rte_mtr_policer_action {
218 /** Recolor the packet as green. */
219 MTR_POLICER_ACTION_COLOR_GREEN = 0,
220
221 /** Recolor the packet as yellow. */
222 MTR_POLICER_ACTION_COLOR_YELLOW,
223
224 /** Recolor the packet as red. */
225 MTR_POLICER_ACTION_COLOR_RED,
226
227 /** Drop the packet. */
228 MTR_POLICER_ACTION_DROP,
229 };
230
231 /**
232 * Parameters for each traffic metering & policing object
233 *
234 * @see enum rte_mtr_stats_type
235 */
236 struct rte_mtr_params {
237 /** Meter profile ID. */
238 uint32_t meter_profile_id;
239
240 /** Meter input color in case of MTR object chaining. When non-zero: if
241 * a previous MTR object is enabled in the same flow, then the color
242 * determined by the latest MTR object in the same flow is used as the
243 * input color by the current MTR object, otherwise the current MTR
244 * object uses the *dscp_table* to determine the input color. When zero:
245 * the color determined by any previous MTR object in same flow is
246 * ignored by the current MTR object, which uses the *dscp_table* to
247 * determine the input color.
248 */
249 int use_prev_mtr_color;
250
251 /** Meter input color. When non-NULL: it points to a pre-allocated and
252 * pre-populated table with exactly 64 elements providing the input
253 * color for each value of the IPv4/IPv6 Differentiated Services Code
254 * Point (DSCP) input packet field. When NULL: it is equivalent to
255 * setting this parameter to an all-green populated table (i.e. table
256 * with all the 64 elements set to green color). The color blind mode
257 * is configured by setting *use_prev_mtr_color* to 0 and *dscp_table*
258 * to either NULL or to an all-green populated table. When
259 * *use_prev_mtr_color* is non-zero value or when *dscp_table* contains
260 * at least one yellow or red color element, then the color aware mode
261 * is configured.
262 */
263 enum rte_mtr_color *dscp_table;
264
265 /** Non-zero to enable the meter, zero to disable the meter at the time
266 * of MTR object creation. Ignored when the meter profile indicated by
267 * *meter_profile_id* is set to NONE.
268 * @see rte_mtr_meter_disable()
269 */
270 int meter_enable;
271
272 /** Policer actions (per meter output color). */
273 enum rte_mtr_policer_action action[RTE_MTR_COLORS];
274
275 /** Set of stats counters to be enabled.
276 * @see enum rte_mtr_stats_type
277 */
278 uint64_t stats_mask;
279 };
280
281 /**
282 * MTR capabilities
283 */
284 struct rte_mtr_capabilities {
285 /** Maximum number of MTR objects. */
286 uint32_t n_max;
287
288 /** Maximum number of MTR objects that can be shared by multiple flows.
289 * The value of zero indicates that shared MTR objects are not
290 * supported. The maximum value is *n_max*.
291 */
292 uint32_t n_shared_max;
293
294 /** When non-zero, this flag indicates that all the MTR objects that
295 * cannot be shared by multiple flows have identical capability set.
296 */
297 int identical;
298
299 /** When non-zero, this flag indicates that all the MTR objects that
300 * can be shared by multiple flows have identical capability set.
301 */
302 int shared_identical;
303
304 /** Maximum number of flows that can share the same MTR object. The
305 * value of zero is invalid. The value of 1 means that shared MTR
306 * objects not supported.
307 */
308 uint32_t shared_n_flows_per_mtr_max;
309
310 /** Maximum number of MTR objects that can be part of the same flow. The
311 * value of zero is invalid. The value of 1 indicates that MTR object
312 * chaining is not supported. The maximum value is *n_max*.
313 */
314 uint32_t chaining_n_mtrs_per_flow_max;
315
316 /**
317 * When non-zero, it indicates that the packet color identified by one
318 * MTR object can be used as the packet input color by any subsequent
319 * MTR object from the same flow. When zero, it indicates that the color
320 * determined by one MTR object is always ignored by any subsequent MTR
321 * object from the same flow. Only valid when MTR chaining is supported,
322 * i.e. *chaining_n_mtrs_per_flow_max* is greater than 1. When non-zero,
323 * it also means that the color aware mode is supported by at least one
324 * metering algorithm.
325 */
326 int chaining_use_prev_mtr_color_supported;
327
328 /**
329 * When non-zero, it indicates that the packet color identified by one
330 * MTR object is always used as the packet input color by any subsequent
331 * MTR object that is part of the same flow. When zero, it indicates
332 * that whether the color determined by one MTR object is either ignored
333 * or used as the packet input color by any subsequent MTR object from
334 * the same flow is individually configurable for each MTR object. Only
335 * valid when *chaining_use_prev_mtr_color_supported* is non-zero.
336 */
337 int chaining_use_prev_mtr_color_enforced;
338
339 /** Maximum number of MTR objects that can have their meter configured
340 * to run the srTCM RFC 2697 algorithm. The value of 0 indicates this
341 * metering algorithm is not supported. The maximum value is *n_max*.
342 */
343 uint32_t meter_srtcm_rfc2697_n_max;
344
345 /** Maximum number of MTR objects that can have their meter configured
346 * to run the trTCM RFC 2698 algorithm. The value of 0 indicates this
347 * metering algorithm is not supported. The maximum value is *n_max*.
348 */
349 uint32_t meter_trtcm_rfc2698_n_max;
350
351 /** Maximum number of MTR objects that can have their meter configured
352 * to run the trTCM RFC 4115 algorithm. The value of 0 indicates this
353 * metering algorithm is not supported. The maximum value is *n_max*.
354 */
355 uint32_t meter_trtcm_rfc4115_n_max;
356
357 /** Maximum traffic rate that can be metered by a single MTR object. For
358 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
359 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
360 * value for the sum of PIR and EIR rates.
361 */
362 uint64_t meter_rate_max;
363
364 /**
365 * When non-zero, it indicates that color aware mode is supported for
366 * the srTCM RFC 2697 metering algorithm.
367 */
368 int color_aware_srtcm_rfc2697_supported;
369
370 /**
371 * When non-zero, it indicates that color aware mode is supported for
372 * the trTCM RFC 2698 metering algorithm.
373 */
374 int color_aware_trtcm_rfc2698_supported;
375
376 /**
377 * When non-zero, it indicates that color aware mode is supported for
378 * the trTCM RFC 4115 metering algorithm.
379 */
380 int color_aware_trtcm_rfc4115_supported;
381
382 /** When non-zero, it indicates that the policer packet recolor actions
383 * are supported.
384 * @see enum rte_mtr_policer_action
385 */
386 int policer_action_recolor_supported;
387
388 /** When non-zero, it indicates that the policer packet drop action is
389 * supported.
390 * @see enum rte_mtr_policer_action
391 */
392 int policer_action_drop_supported;
393
394 /** Set of supported statistics counter types.
395 * @see enum rte_mtr_stats_type
396 */
397 uint64_t stats_mask;
398 };
399
400 /**
401 * Verbose error types.
402 *
403 * Most of them provide the type of the object referenced by struct
404 * rte_mtr_error::cause.
405 */
406 enum rte_mtr_error_type {
407 RTE_MTR_ERROR_TYPE_NONE, /**< No error. */
408 RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
409 RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
410 RTE_MTR_ERROR_TYPE_METER_PROFILE,
411 RTE_MTR_ERROR_TYPE_MTR_ID,
412 RTE_MTR_ERROR_TYPE_MTR_PARAMS,
413 RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
414 RTE_MTR_ERROR_TYPE_POLICER_ACTION_YELLOW,
415 RTE_MTR_ERROR_TYPE_POLICER_ACTION_RED,
416 RTE_MTR_ERROR_TYPE_STATS_MASK,
417 RTE_MTR_ERROR_TYPE_STATS,
418 RTE_MTR_ERROR_TYPE_SHARED,
419 };
420
421 /**
422 * Verbose error structure definition.
423 *
424 * This object is normally allocated by applications and set by PMDs, the
425 * message points to a constant string which does not need to be freed by
426 * the application, however its pointer can be considered valid only as long
427 * as its associated DPDK port remains configured. Closing the underlying
428 * device or unloading the PMD invalidates it.
429 *
430 * Both cause and message may be NULL regardless of the error type.
431 */
432 struct rte_mtr_error {
433 enum rte_mtr_error_type type; /**< Cause field and error type. */
434 const void *cause; /**< Object responsible for the error. */
435 const char *message; /**< Human-readable error message. */
436 };
437
438 /**
439 * MTR capabilities get
440 *
441 * @param[in] port_id
442 * The port identifier of the Ethernet device.
443 * @param[out] cap
444 * MTR capabilities. Needs to be pre-allocated and valid.
445 * @param[out] error
446 * Error details. Filled in only on error, when not NULL.
447 * @return
448 * 0 on success, non-zero error code otherwise.
449 */
450 int __rte_experimental
451 rte_mtr_capabilities_get(uint16_t port_id,
452 struct rte_mtr_capabilities *cap,
453 struct rte_mtr_error *error);
454
455 /**
456 * Meter profile add
457 *
458 * Create a new meter profile with ID set to *meter_profile_id*. The new profile
459 * is used to create one or several MTR objects.
460 *
461 * @param[in] port_id
462 * The port identifier of the Ethernet device.
463 * @param[in] meter_profile_id
464 * ID for the new meter profile. Needs to be unused by any of the existing
465 * meter profiles added for the current port.
466 * @param[in] profile
467 * Meter profile parameters. Needs to be pre-allocated and valid.
468 * @param[out] error
469 * Error details. Filled in only on error, when not NULL.
470 * @return
471 * 0 on success, non-zero error code otherwise.
472 */
473 int __rte_experimental
474 rte_mtr_meter_profile_add(uint16_t port_id,
475 uint32_t meter_profile_id,
476 struct rte_mtr_meter_profile *profile,
477 struct rte_mtr_error *error);
478
479 /**
480 * Meter profile delete
481 *
482 * Delete an existing meter profile. This operation fails when there is
483 * currently at least one user (i.e. MTR object) of this profile.
484 *
485 * @param[in] port_id
486 * The port identifier of the Ethernet device.
487 * @param[in] meter_profile_id
488 * Meter profile ID. Needs to be the valid.
489 * @param[out] error
490 * Error details. Filled in only on error, when not NULL.
491 * @return
492 * 0 on success, non-zero error code otherwise.
493 */
494 int __rte_experimental
495 rte_mtr_meter_profile_delete(uint16_t port_id,
496 uint32_t meter_profile_id,
497 struct rte_mtr_error *error);
498
499 /**
500 * MTR object create
501 *
502 * Create a new MTR object for the current port. This object is run as part of
503 * associated flow action for traffic metering and policing.
504 *
505 * @param[in] port_id
506 * The port identifier of the Ethernet device.
507 * @param[in] mtr_id
508 * MTR object ID. Needs to be unused by any of the existing MTR objects.
509 * created for the current port.
510 * @param[in] params
511 * MTR object params. Needs to be pre-allocated and valid.
512 * @param[in] shared
513 * Non-zero when this MTR object can be shared by multiple flows, zero when
514 * this MTR object can be used by a single flow.
515 * @param[out] error
516 * Error details. Filled in only on error, when not NULL.
517 * @return
518 * 0 on success, non-zero error code otherwise.
519 *
520 * @see enum rte_flow_action_type::RTE_FLOW_ACTION_TYPE_METER
521 */
522 int __rte_experimental
523 rte_mtr_create(uint16_t port_id,
524 uint32_t mtr_id,
525 struct rte_mtr_params *params,
526 int shared,
527 struct rte_mtr_error *error);
528
529 /**
530 * MTR object destroy
531 *
532 * Delete an existing MTR object. This operation fails when there is currently
533 * at least one user (i.e. flow) of this MTR object.
534 *
535 * @param[in] port_id
536 * The port identifier of the Ethernet device.
537 * @param[in] mtr_id
538 * MTR object ID. Needs to be valid.
539 * created for the current port.
540 * @param[out] error
541 * Error details. Filled in only on error, when not NULL.
542 * @return
543 * 0 on success, non-zero error code otherwise.
544 */
545 int __rte_experimental
546 rte_mtr_destroy(uint16_t port_id,
547 uint32_t mtr_id,
548 struct rte_mtr_error *error);
549
550 /**
551 * MTR object meter disable
552 *
553 * Disable the meter of an existing MTR object. In disabled state, the meter of
554 * the current MTR object works in pass-through mode, meaning that for each
555 * input packet the meter output color is always the same as the input color. In
556 * particular, when the meter of the current MTR object is configured in color
557 * blind mode, the input color is always green, so the meter output color is
558 * also always green. Note that the policer and the statistics of the current
559 * MTR object are working as usual while the meter is disabled. No action is
560 * taken and this function returns successfully when the meter of the current
561 * MTR object is already disabled.
562 *
563 * @param[in] port_id
564 * The port identifier of the Ethernet device.
565 * @param[in] mtr_id
566 * MTR object ID.
567 * @param[out] error
568 * Error details. Filled in only on error, when not NULL.
569 * @return
570 * 0 on success, non-zero error code otherwise.
571 */
572 int __rte_experimental
573 rte_mtr_meter_disable(uint16_t port_id,
574 uint32_t mtr_id,
575 struct rte_mtr_error *error);
576
577 /**
578 * MTR object meter enable
579 *
580 * Enable the meter of an existing MTR object. If the MTR object has its meter
581 * already enabled, then no action is taken and this function returns
582 * successfully.
583 *
584 * @param[in] port_id
585 * The port identifier of the Ethernet device.
586 * @param[in] mtr_id
587 * MTR object ID.
588 * @param[out] error
589 * Error details. Filled in only on error, when not NULL.
590 * @return
591 * 0 on success, non-zero error code otherwise.
592 */
593 int __rte_experimental
594 rte_mtr_meter_enable(uint16_t port_id,
595 uint32_t mtr_id,
596 struct rte_mtr_error *error);
597
598 /**
599 * MTR object meter profile update
600 *
601 * @param[in] port_id
602 * The port identifier of the Ethernet device.
603 * @param[in] mtr_id
604 * MTR object ID. Needs to be valid.
605 * @param[in] meter_profile_id
606 * Meter profile ID for the current MTR object. Needs to be valid.
607 * @param[out] error
608 * Error details. Filled in only on error, when not NULL.
609 * @return
610 * 0 on success, non-zero error code otherwise.
611 */
612 int __rte_experimental
613 rte_mtr_meter_profile_update(uint16_t port_id,
614 uint32_t mtr_id,
615 uint32_t meter_profile_id,
616 struct rte_mtr_error *error);
617
618 /**
619 * MTR object DSCP table update
620 *
621 * @param[in] port_id
622 * The port identifier of the Ethernet device.
623 * @param[in] mtr_id
624 * MTR object ID. Needs to be valid.
625 * @param[in] dscp_table
626 * When non-NULL: it points to a pre-allocated and pre-populated table with
627 * exactly 64 elements providing the input color for each value of the
628 * IPv4/IPv6 Differentiated Services Code Point (DSCP) input packet field.
629 * When NULL: it is equivalent to setting this parameter to an “all-green”
630 * populated table (i.e. table with all the 64 elements set to green color).
631 * @param[out] error
632 * Error details. Filled in only on error, when not NULL.
633 * @return
634 * 0 on success, non-zero error code otherwise.
635 */
636 int __rte_experimental
637 rte_mtr_meter_dscp_table_update(uint16_t port_id,
638 uint32_t mtr_id,
639 enum rte_mtr_color *dscp_table,
640 struct rte_mtr_error *error);
641
642 /**
643 * MTR object policer actions update
644 *
645 * @param[in] port_id
646 * The port identifier of the Ethernet device.
647 * @param[in] mtr_id
648 * MTR object ID. Needs to be valid.
649 * @param[in] action_mask
650 * Bit mask indicating which policer actions need to be updated. One or more
651 * policer actions can be updated in a single function invocation. To update
652 * the policer action associated with color C, bit (1 << C) needs to be set in
653 * *action_mask* and element at position C in the *actions* array needs to be
654 * valid.
655 * @param[in] actions
656 * Pre-allocated and pre-populated array of policer actions.
657 * @param[out] error
658 * Error details. Filled in only on error, when not NULL.
659 * @return
660 * 0 on success, non-zero error code otherwise.
661 */
662 int __rte_experimental
663 rte_mtr_policer_actions_update(uint16_t port_id,
664 uint32_t mtr_id,
665 uint32_t action_mask,
666 enum rte_mtr_policer_action *actions,
667 struct rte_mtr_error *error);
668
669 /**
670 * MTR object enabled statistics counters update
671 *
672 * @param[in] port_id
673 * The port identifier of the Ethernet device.
674 * @param[in] mtr_id
675 * MTR object ID. Needs to be valid.
676 * @param[in] stats_mask
677 * Mask of statistics counter types to be enabled for the current MTR object.
678 * Any statistics counter type not included in this set is to be disabled for
679 * the current MTR object.
680 * @param[out] error
681 * Error details. Filled in only on error, when not NULL.
682 * @return
683 * 0 on success, non-zero error code otherwise.
684 *
685 * @see enum rte_mtr_stats_type
686 */
687 int __rte_experimental
688 rte_mtr_stats_update(uint16_t port_id,
689 uint32_t mtr_id,
690 uint64_t stats_mask,
691 struct rte_mtr_error *error);
692
693 /**
694 * MTR object statistics counters read
695 *
696 * @param[in] port_id
697 * The port identifier of the Ethernet device.
698 * @param[in] mtr_id
699 * MTR object ID. Needs to be valid.
700 * @param[out] stats
701 * When non-NULL, it contains the current value for the statistics counters
702 * enabled for the current MTR object.
703 * @param[out] stats_mask
704 * When non-NULL, it contains the mask of statistics counter types that are
705 * currently enabled for this MTR object, indicating which of the counters
706 * retrieved with the *stats* structure are valid.
707 * @param[in] clear
708 * When this parameter has a non-zero value, the statistics counters are
709 * cleared (i.e. set to zero) immediately after they have been read,
710 * otherwise the statistics counters are left untouched.
711 * @param[out] error
712 * Error details. Filled in only on error, when not NULL.
713 * @return
714 * 0 on success, non-zero error code otherwise.
715 *
716 * @see enum rte_mtr_stats_type
717 */
718 int __rte_experimental
719 rte_mtr_stats_read(uint16_t port_id,
720 uint32_t mtr_id,
721 struct rte_mtr_stats *stats,
722 uint64_t *stats_mask,
723 int clear,
724 struct rte_mtr_error *error);
725
726 #ifdef __cplusplus
727 }
728 #endif
729
730 #endif /* __INCLUDE_RTE_MTR_H__ */