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