1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright 2017 Intel Corporation
4 * Copyright 2017 Cavium
7 #ifndef __INCLUDE_RTE_MTR_H__
8 #define __INCLUDE_RTE_MTR_H__
12 * RTE Generic Traffic Metering and Policing API
14 * This interface provides the ability to configure the traffic metering and
15 * policing (MTR) in a generic way.
17 * The processing done for each input packet hitting a MTR object is:
18 * A) Traffic metering: The packet is assigned a color (the meter output
19 * color), based on the previous history of the flow reflected in the
20 * current state of the MTR object, according to the specific traffic
21 * metering algorithm. The traffic metering algorithm can typically work
22 * in color aware mode, in which case the input packet already has an
23 * initial color (the input color), or in color blind mode, which is
24 * equivalent to considering all input packets initially colored as green.
25 * B) Policing: There is a separate policer action configured for each meter
26 * output color, which can:
28 * b) Keep the same packet color: the policer output color matches the
29 * meter output color (essentially a no-op action).
30 * c) Recolor the packet: the policer output color is different than
31 * the meter output color.
32 * The policer output color is the output color of the packet, which is
33 * set in the packet meta-data (i.e. struct rte_mbuf::sched::color).
34 * C) Statistics: The set of counters maintained for each MTR object is
35 * configurable and subject to the implementation support. This set
36 * includes the number of packets and bytes dropped or passed for each
39 * Once successfully created, an MTR object is linked to one or several flows
40 * through the meter action of the flow API.
41 * A) Whether an MTR object is private to a flow or potentially shared by
42 * several flows has to be specified at creation time.
43 * B) Several meter actions can be potentially registered for the same flow.
46 * @b EXPERIMENTAL: this API may change without prior notice
49 #include <rte_compat.h>
50 #include <rte_common.h>
51 #include <rte_meter.h>
59 * Statistics counter type
61 enum rte_mtr_stats_type {
62 /** Number of packets passed as green by the policer. */
63 RTE_MTR_STATS_N_PKTS_GREEN = 1 << 0,
65 /** Number of packets passed as yellow by the policer. */
66 RTE_MTR_STATS_N_PKTS_YELLOW = 1 << 1,
68 /** Number of packets passed as red by the policer. */
69 RTE_MTR_STATS_N_PKTS_RED = 1 << 2,
71 /** Number of packets dropped by the policer. */
72 RTE_MTR_STATS_N_PKTS_DROPPED = 1 << 3,
74 /** Number of bytes passed as green by the policer. */
75 RTE_MTR_STATS_N_BYTES_GREEN = 1 << 4,
77 /** Number of bytes passed as yellow by the policer. */
78 RTE_MTR_STATS_N_BYTES_YELLOW = 1 << 5,
80 /** Number of bytes passed as red by the policer. */
81 RTE_MTR_STATS_N_BYTES_RED = 1 << 6,
83 /** Number of bytes dropped by the policer. */
84 RTE_MTR_STATS_N_BYTES_DROPPED = 1 << 7,
90 struct rte_mtr_stats {
91 /** Number of packets passed by the policer (per color). */
92 uint64_t n_pkts[RTE_COLORS];
94 /** Number of bytes passed by the policer (per color). */
95 uint64_t n_bytes[RTE_COLORS];
97 /** Number of packets dropped by the policer. */
98 uint64_t n_pkts_dropped;
100 /** Number of bytes passed by the policer. */
101 uint64_t n_bytes_dropped;
105 * Traffic metering algorithms
107 enum rte_mtr_algorithm {
108 /** No traffic metering performed, the output color is the same as the
109 * input color for every input packet. The meter of the MTR object is
110 * working in pass-through mode, having same effect as meter disable.
111 * @see rte_mtr_meter_disable()
115 /** Single Rate Three Color Marker (srTCM) - IETF RFC 2697. */
116 RTE_MTR_SRTCM_RFC2697,
118 /** Two Rate Three Color Marker (trTCM) - IETF RFC 2698. */
119 RTE_MTR_TRTCM_RFC2698,
121 /** Two Rate Three Color Marker (trTCM) - IETF RFC 4115. */
122 RTE_MTR_TRTCM_RFC4115,
128 struct rte_mtr_meter_profile {
129 /** Traffic metering algorithm. */
130 enum rte_mtr_algorithm alg;
134 /** Items only valid when *alg* is set to srTCM - RFC 2697. */
137 * Committed Information Rate (CIR)
138 * (bytes per second or packets per second).
142 /** Committed Burst Size (CBS) (bytes or packets). */
145 /** Excess Burst Size (EBS) (bytes or packets). */
149 /** Items only valid when *alg* is set to trTCM - RFC 2698. */
152 * Committed Information Rate (CIR)
153 * (bytes per second or packets per second).
158 * Peak Information Rate (PIR)
159 * (bytes per second or packets per second).
163 /** Committed Burst Size (CBS) (bytes or packets). */
166 /** Peak Burst Size (PBS) (bytes or packets). */
170 /** Items only valid when *alg* is set to trTCM - RFC 4115. */
173 * Committed Information Rate (CIR)
174 * (bytes per second or packets per second).
179 * Excess Information Rate (EIR)
180 * (bytes per second or packets per second).
184 /** Committed Burst Size (CBS) (bytes or packets). */
187 /** Excess Burst Size (EBS) (bytes or packets). */
193 * When zero, the byte mode is enabled for the current profile, so the
194 * *rate* and *size* fields are specified in bytes per second
195 * and bytes, respectively.
196 * When non-zero, the packet mode is enabled for the current profile,
197 * so the *rate* and *size* fields are specified in packets per second
198 * and packets, respectively.
206 struct rte_mtr_meter_policy_params {
208 * Policy action list per color.
209 * actions[i] potentially represents a chain of rte_flow actions
210 * terminated by the END action, exactly as specified by the rte_flow
211 * API for the flow definition, and not just a single action.
213 const struct rte_flow_action *actions[RTE_COLORS];
217 * Parameters for each traffic metering & policing object
219 * @see enum rte_mtr_stats_type
221 struct rte_mtr_params {
222 /** Meter profile ID. */
223 uint32_t meter_profile_id;
225 /** Meter input color in case of MTR object chaining. When non-zero: if
226 * a previous MTR object is enabled in the same flow, then the color
227 * determined by the latest MTR object in the same flow is used as the
228 * input color by the current MTR object, otherwise the current MTR
229 * object uses the *dscp_table* to determine the input color. When zero:
230 * the color determined by any previous MTR object in same flow is
231 * ignored by the current MTR object, which uses the *dscp_table* to
232 * determine the input color.
234 int use_prev_mtr_color;
236 /** Meter input color. When non-NULL: it points to a pre-allocated and
237 * pre-populated table with exactly 64 elements providing the input
238 * color for each value of the IPv4/IPv6 Differentiated Services Code
239 * Point (DSCP) input packet field. When NULL: it is equivalent to
240 * setting this parameter to an all-green populated table (i.e. table
241 * with all the 64 elements set to green color). The color blind mode
242 * is configured by setting *use_prev_mtr_color* to 0 and *dscp_table*
243 * to either NULL or to an all-green populated table. When
244 * *use_prev_mtr_color* is non-zero value or when *dscp_table* contains
245 * at least one yellow or red color element, then the color aware mode
248 enum rte_color *dscp_table;
250 /** Non-zero to enable the meter, zero to disable the meter at the time
251 * of MTR object creation. Ignored when the meter profile indicated by
252 * *meter_profile_id* is set to NONE.
253 * @see rte_mtr_meter_disable()
257 /** Set of stats counters to be enabled.
258 * @see enum rte_mtr_stats_type
262 /** Meter policy ID. */
263 uint32_t meter_policy_id;
269 struct rte_mtr_capabilities {
270 /** Maximum number of MTR objects. */
273 /** Maximum number of MTR objects that can be shared by multiple flows.
274 * The value of zero indicates that shared MTR objects are not
275 * supported. The maximum value is *n_max*.
277 uint32_t n_shared_max;
279 /** When non-zero, this flag indicates that all the MTR objects that
280 * cannot be shared by multiple flows have identical capability set.
284 /** When non-zero, this flag indicates that all the MTR objects that
285 * can be shared by multiple flows have identical capability set.
287 int shared_identical;
289 /** Maximum number of flows that can share the same MTR object. The
290 * value of zero is invalid. The value of 1 means that shared MTR
291 * objects not supported.
293 uint32_t shared_n_flows_per_mtr_max;
295 /** Maximum number of MTR objects that can be part of the same flow. The
296 * value of zero is invalid. The value of 1 indicates that MTR object
297 * chaining is not supported. The maximum value is *n_max*.
299 uint32_t chaining_n_mtrs_per_flow_max;
302 * When non-zero, it indicates that the packet color identified by one
303 * MTR object can be used as the packet input color by any subsequent
304 * MTR object from the same flow. When zero, it indicates that the color
305 * determined by one MTR object is always ignored by any subsequent MTR
306 * object from the same flow. Only valid when MTR chaining is supported,
307 * i.e. *chaining_n_mtrs_per_flow_max* is greater than 1. When non-zero,
308 * it also means that the color aware mode is supported by at least one
309 * metering algorithm.
311 int chaining_use_prev_mtr_color_supported;
314 * When non-zero, it indicates that the packet color identified by one
315 * MTR object is always used as the packet input color by any subsequent
316 * MTR object that is part of the same flow. When zero, it indicates
317 * that whether the color determined by one MTR object is either ignored
318 * or used as the packet input color by any subsequent MTR object from
319 * the same flow is individually configurable for each MTR object. Only
320 * valid when *chaining_use_prev_mtr_color_supported* is non-zero.
322 int chaining_use_prev_mtr_color_enforced;
324 /** Maximum number of MTR objects that can have their meter configured
325 * to run the srTCM RFC 2697 algorithm. The value of 0 indicates this
326 * metering algorithm is not supported. The maximum value is *n_max*.
328 uint32_t meter_srtcm_rfc2697_n_max;
330 /** Maximum number of MTR objects that can have their meter configured
331 * to run the trTCM RFC 2698 algorithm. The value of 0 indicates this
332 * metering algorithm is not supported. The maximum value is *n_max*.
334 uint32_t meter_trtcm_rfc2698_n_max;
336 /** Maximum number of MTR objects that can have their meter configured
337 * to run the trTCM RFC 4115 algorithm. The value of 0 indicates this
338 * metering algorithm is not supported. The maximum value is *n_max*.
340 uint32_t meter_trtcm_rfc4115_n_max;
342 /** Maximum traffic rate that can be metered by a single MTR object. For
343 * srTCM RFC 2697, this is the maximum CIR rate. For trTCM RFC 2698,
344 * this is the maximum PIR rate. For trTCM RFC 4115, this is the maximum
345 * value for the sum of PIR and EIR rates.
347 uint64_t meter_rate_max;
350 * Maximum number of policy objects that can have.
351 * The value of 0 is invalid. Policy must be supported for meter.
352 * The maximum value is *n_max*.
354 uint64_t meter_policy_n_max;
357 * When non-zero, it indicates that color aware mode is supported for
358 * the srTCM RFC 2697 metering algorithm.
360 int color_aware_srtcm_rfc2697_supported;
363 * When non-zero, it indicates that color aware mode is supported for
364 * the trTCM RFC 2698 metering algorithm.
366 int color_aware_trtcm_rfc2698_supported;
369 * When non-zero, it indicates that color aware mode is supported for
370 * the trTCM RFC 4115 metering algorithm.
372 int color_aware_trtcm_rfc4115_supported;
375 * srTCM rfc2697 byte mode supported.
376 * When non-zero, it indicates that byte mode is supported for
377 * the srTCM RFC 2697 metering algorithm.
379 int srtcm_rfc2697_byte_mode_supported;
382 * srTCM rfc2697 packet mode supported.
383 * When non-zero, it indicates that packet mode is supported for
384 * the srTCM RFC 2697 metering algorithm.
386 int srtcm_rfc2697_packet_mode_supported;
389 * trTCM rfc2698 byte mode supported.
390 * When non-zero, it indicates that byte mode is supported for
391 * the trTCM RFC 2698 metering algorithm.
393 int trtcm_rfc2698_byte_mode_supported;
396 * trTCM rfc2698 packet mode supported.
397 * When non-zero, it indicates that packet mode is supported for
398 * the trTCM RFC 2698 metering algorithm.
400 int trtcm_rfc2698_packet_mode_supported;
403 * trTCM rfc4115 byte mode supported.
404 * When non-zero, it indicates that byte mode is supported for
405 * the trTCM RFC 4115 metering algorithm.
407 int trtcm_rfc4115_byte_mode_supported;
410 * trTCM rfc4115 packet mode supported.
411 * When non-zero, it indicates that packet mode is supported for
412 * the trTCM RFC 4115 metering algorithm.
414 int trtcm_rfc4115_packet_mode_supported;
416 /** Set of supported statistics counter types.
417 * @see enum rte_mtr_stats_type
423 * Verbose error types.
425 * Most of them provide the type of the object referenced by struct
426 * rte_mtr_error::cause.
428 enum rte_mtr_error_type {
429 RTE_MTR_ERROR_TYPE_NONE, /**< No error. */
430 RTE_MTR_ERROR_TYPE_UNSPECIFIED, /**< Cause unspecified. */
431 RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
432 RTE_MTR_ERROR_TYPE_METER_PROFILE,
433 RTE_MTR_ERROR_TYPE_METER_PROFILE_PACKET_MODE,
434 RTE_MTR_ERROR_TYPE_MTR_ID,
435 RTE_MTR_ERROR_TYPE_MTR_PARAMS,
436 RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
437 RTE_MTR_ERROR_TYPE_POLICER_ACTION_YELLOW,
438 RTE_MTR_ERROR_TYPE_POLICER_ACTION_RED,
439 RTE_MTR_ERROR_TYPE_STATS_MASK,
440 RTE_MTR_ERROR_TYPE_STATS,
441 RTE_MTR_ERROR_TYPE_SHARED,
442 RTE_MTR_ERROR_TYPE_METER_POLICY_ID,
443 RTE_MTR_ERROR_TYPE_METER_POLICY,
447 * Verbose error structure definition.
449 * This object is normally allocated by applications and set by PMDs, the
450 * message points to a constant string which does not need to be freed by
451 * the application, however its pointer can be considered valid only as long
452 * as its associated DPDK port remains configured. Closing the underlying
453 * device or unloading the PMD invalidates it.
455 * Both cause and message may be NULL regardless of the error type.
457 struct rte_mtr_error {
458 enum rte_mtr_error_type type; /**< Cause field and error type. */
459 const void *cause; /**< Object responsible for the error. */
460 const char *message; /**< Human-readable error message. */
464 * MTR capabilities get
467 * The port identifier of the Ethernet device.
469 * MTR capabilities. Needs to be pre-allocated and valid.
471 * Error details. Filled in only on error, when not NULL.
473 * 0 on success, non-zero error code otherwise.
477 rte_mtr_capabilities_get(uint16_t port_id,
478 struct rte_mtr_capabilities *cap,
479 struct rte_mtr_error *error);
484 * Create a new meter profile with ID set to *meter_profile_id*. The new profile
485 * is used to create one or several MTR objects.
488 * The port identifier of the Ethernet device.
489 * @param[in] meter_profile_id
490 * ID for the new meter profile. Needs to be unused by any of the existing
491 * meter profiles added for the current port.
493 * Meter profile parameters. Needs to be pre-allocated and valid.
495 * Error details. Filled in only on error, when not NULL.
497 * 0 on success, non-zero error code otherwise.
501 rte_mtr_meter_profile_add(uint16_t port_id,
502 uint32_t meter_profile_id,
503 struct rte_mtr_meter_profile *profile,
504 struct rte_mtr_error *error);
507 * Meter profile delete
509 * Delete an existing meter profile. This operation fails when there is
510 * currently at least one user (i.e. MTR object) of this profile.
513 * The port identifier of the Ethernet device.
514 * @param[in] meter_profile_id
515 * Meter profile ID. Needs to be the valid.
517 * Error details. Filled in only on error, when not NULL.
519 * 0 on success, non-zero error code otherwise.
523 rte_mtr_meter_profile_delete(uint16_t port_id,
524 uint32_t meter_profile_id,
525 struct rte_mtr_error *error);
528 * Check whether a meter policy can be created on a given port.
530 * The meter policy is validated for correctness and
531 * whether it could be accepted by the device given sufficient resources.
532 * The policy is checked against the current capability information
533 * meter_policy_n_max configuration.
534 * The policy may also optionally be validated against existing
535 * device policy resources.
536 * This function has no effect on the target device.
539 * The port identifier of the Ethernet device.
541 * Associated action list per color.
542 * list NULL is legal and means no special action.
543 * (list terminated by the END action).
545 * Error details. Filled in only on error, when not NULL.
547 * 0 on success, non-zero error code otherwise.
551 rte_mtr_meter_policy_validate(uint16_t port_id,
552 struct rte_mtr_meter_policy_params *policy,
553 struct rte_mtr_error *error);
558 * Create a new meter policy. The new policy
559 * is used to create single or multiple MTR objects.
560 * The same policy can be used to create multiple MTR objects.
563 * The port identifier of the Ethernet device.
564 * @param[in] policy_id
565 * Policy identifier for the new meter policy.
567 * Associated actions per color.
568 * list NULL is legal and means no special action.
569 * Non-NULL list must be terminated.
570 * (list terminated by the END action).
572 * Error details. Filled in only on error, when not NULL.
574 * 0 on success, non-zero error code otherwise.
578 rte_mtr_meter_policy_add(uint16_t port_id,
580 struct rte_mtr_meter_policy_params *policy,
581 struct rte_mtr_error *error);
584 * Define meter policy action list:
585 * GREEN - GREEN, YELLOW - YELLOW, RED - RED
587 #define rte_mtr_policy_pass_color(policy) \
588 struct rte_mtr_meter_policy_params policy = \
590 .actions[RTE_COLOR_GREEN] = (struct rte_flow_action[]) { \
592 .type = RTE_FLOW_ACTION_TYPE_METER_COLOR, \
593 .conf = &(struct rte_flow_action_meter_color) { \
594 .color = RTE_COLOR_GREEN, \
598 .type = RTE_FLOW_ACTION_TYPE_END, \
601 .actions[RTE_COLOR_YELLOW] = (struct rte_flow_action[]) { \
603 .type = RTE_FLOW_ACTION_TYPE_METER_COLOR, \
604 .conf = &(struct rte_flow_action_meter_color) { \
605 .color = RTE_COLOR_YELLOW, \
609 .type = RTE_FLOW_ACTION_TYPE_END, \
612 .actions[RTE_COLOR_RED] = (struct rte_flow_action[]) { \
614 .type = RTE_FLOW_ACTION_TYPE_METER_COLOR, \
615 .conf = &(struct rte_flow_action_meter_color) { \
616 .color = RTE_COLOR_RED, \
620 .type = RTE_FLOW_ACTION_TYPE_END, \
626 * Define meter policy action list:
627 * GREEN - Do nothing, YELLOW - Do nothing, RED - DROP
629 #define rte_mtr_policy_drop_red(policy) \
630 struct rte_mtr_meter_policy_params policy = \
632 .actions[RTE_COLOR_GREEN] = NULL, \
633 .actions[RTE_COLOR_YELLOW] = NULL, \
634 .actions[RTE_COLOR_RED] = (struct rte_flow_action[]) { \
636 .type = RTE_FLOW_ACTION_TYPE_DROP, \
639 .type = RTE_FLOW_ACTION_TYPE_END, \
645 * Meter policy delete
647 * Delete an existing meter policy. This operation fails when there is
648 * currently at least one user (i.e. MTR object) of this policy.
651 * The port identifier of the Ethernet device.
652 * @param[in] policy_id
655 * Error details. Filled in only on error, when not NULL.
657 * 0 on success, non-zero error code otherwise.
661 rte_mtr_meter_policy_delete(uint16_t port_id,
663 struct rte_mtr_error *error);
668 * Create a new MTR object for the current port. This object is run as part of
669 * associated flow action for traffic metering and policing.
672 * The port identifier of the Ethernet device.
674 * MTR object ID. Needs to be unused by any of the existing MTR objects.
675 * created for the current port.
677 * MTR object params. Needs to be pre-allocated and valid.
679 * Non-zero when this MTR object can be shared by multiple flows, zero when
680 * this MTR object can be used by a single flow.
682 * Error details. Filled in only on error, when not NULL.
684 * 0 on success, non-zero error code otherwise.
686 * @see enum rte_flow_action_type::RTE_FLOW_ACTION_TYPE_METER
690 rte_mtr_create(uint16_t port_id,
692 struct rte_mtr_params *params,
694 struct rte_mtr_error *error);
699 * Delete an existing MTR object. This operation fails when there is currently
700 * at least one user (i.e. flow) of this MTR object.
703 * The port identifier of the Ethernet device.
705 * MTR object ID. Needs to be valid.
706 * created for the current port.
708 * Error details. Filled in only on error, when not NULL.
710 * 0 on success, non-zero error code otherwise.
714 rte_mtr_destroy(uint16_t port_id,
716 struct rte_mtr_error *error);
719 * MTR object meter disable
721 * Disable the meter of an existing MTR object. In disabled state, the meter of
722 * the current MTR object works in pass-through mode, meaning that for each
723 * input packet the meter output color is always the same as the input color. In
724 * particular, when the meter of the current MTR object is configured in color
725 * blind mode, the input color is always green, so the meter output color is
726 * also always green. Note that the policer and the statistics of the current
727 * MTR object are working as usual while the meter is disabled. No action is
728 * taken and this function returns successfully when the meter of the current
729 * MTR object is already disabled.
732 * The port identifier of the Ethernet device.
736 * Error details. Filled in only on error, when not NULL.
738 * 0 on success, non-zero error code otherwise.
742 rte_mtr_meter_disable(uint16_t port_id,
744 struct rte_mtr_error *error);
747 * MTR object meter enable
749 * Enable the meter of an existing MTR object. If the MTR object has its meter
750 * already enabled, then no action is taken and this function returns
754 * The port identifier of the Ethernet device.
758 * Error details. Filled in only on error, when not NULL.
760 * 0 on success, non-zero error code otherwise.
764 rte_mtr_meter_enable(uint16_t port_id,
766 struct rte_mtr_error *error);
769 * MTR object meter profile update
772 * The port identifier of the Ethernet device.
774 * MTR object ID. Needs to be valid.
775 * @param[in] meter_profile_id
776 * Meter profile ID for the current MTR object. Needs to be valid.
778 * Error details. Filled in only on error, when not NULL.
780 * 0 on success, non-zero error code otherwise.
784 rte_mtr_meter_profile_update(uint16_t port_id,
786 uint32_t meter_profile_id,
787 struct rte_mtr_error *error);
790 * MTR object meter policy update
793 * The port identifier of the Ethernet device.
795 * MTR object ID. Needs to be valid.
796 * @param[in] meter_policy_id
797 * Meter policy ID for the current MTR object. Needs to be valid.
799 * Error details. Filled in only on error, when not NULL.
801 * 0 on success, non-zero error code otherwise.
805 rte_mtr_meter_policy_update(uint16_t port_id,
807 uint32_t meter_policy_id,
808 struct rte_mtr_error *error);
811 * MTR object DSCP table update
814 * The port identifier of the Ethernet device.
816 * MTR object ID. Needs to be valid.
817 * @param[in] dscp_table
818 * When non-NULL: it points to a pre-allocated and pre-populated table with
819 * exactly 64 elements providing the input color for each value of the
820 * IPv4/IPv6 Differentiated Services Code Point (DSCP) input packet field.
821 * When NULL: it is equivalent to setting this parameter to an "all-green"
822 * populated table (i.e. table with all the 64 elements set to green color).
824 * Error details. Filled in only on error, when not NULL.
826 * 0 on success, non-zero error code otherwise.
830 rte_mtr_meter_dscp_table_update(uint16_t port_id,
832 enum rte_color *dscp_table,
833 struct rte_mtr_error *error);
836 * MTR object enabled statistics counters update
839 * The port identifier of the Ethernet device.
841 * MTR object ID. Needs to be valid.
842 * @param[in] stats_mask
843 * Mask of statistics counter types to be enabled for the current MTR object.
844 * Any statistics counter type not included in this set is to be disabled for
845 * the current MTR object.
847 * Error details. Filled in only on error, when not NULL.
849 * 0 on success, non-zero error code otherwise.
851 * @see enum rte_mtr_stats_type
855 rte_mtr_stats_update(uint16_t port_id,
858 struct rte_mtr_error *error);
861 * MTR object statistics counters read
864 * The port identifier of the Ethernet device.
866 * MTR object ID. Needs to be valid.
868 * When non-NULL, it contains the current value for the statistics counters
869 * enabled for the current MTR object.
870 * @param[out] stats_mask
871 * When non-NULL, it contains the mask of statistics counter types that are
872 * currently enabled for this MTR object, indicating which of the counters
873 * retrieved with the *stats* structure are valid.
875 * When this parameter has a non-zero value, the statistics counters are
876 * cleared (i.e. set to zero) immediately after they have been read,
877 * otherwise the statistics counters are left untouched.
879 * Error details. Filled in only on error, when not NULL.
881 * 0 on success, non-zero error code otherwise.
883 * @see enum rte_mtr_stats_type
887 rte_mtr_stats_read(uint16_t port_id,
889 struct rte_mtr_stats *stats,
890 uint64_t *stats_mask,
892 struct rte_mtr_error *error);
898 #endif /* __INCLUDE_RTE_MTR_H__ */