DPDK  19.11.1
rte_mtr.h
Go to the documentation of this file.
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 
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 
63 
66 
69 
72 
75 
78 
81 
84 };
85 
89 struct rte_mtr_stats {
91  uint64_t n_pkts[RTE_COLORS];
92 
94  uint64_t n_bytes[RTE_COLORS];
95 
97  uint64_t n_pkts_dropped;
98 
100  uint64_t n_bytes_dropped;
101 };
102 
113 
116 
119 
122 };
123 
130 
132  union {
134  struct {
136  uint64_t cir;
137 
139  uint64_t cbs;
140 
142  uint64_t ebs;
143  } srtcm_rfc2697;
144 
146  struct {
148  uint64_t cir;
149 
151  uint64_t pir;
152 
154  uint64_t cbs;
155 
157  uint64_t pbs;
158  } trtcm_rfc2698;
159 
161  struct {
163  uint64_t cir;
164 
166  uint64_t eir;
167 
169  uint64_t cbs;
170 
172  uint64_t ebs;
173  } trtcm_rfc4115;
174  };
175 };
176 
183 
186 
189 
192 };
193 
202 
213 
227 
234 
237 
241  uint64_t stats_mask;
242 };
243 
249  uint32_t n_max;
250 
255  uint32_t n_shared_max;
256 
261 
266 
272 
278 
290 
301 
307 
313 
319 
325  uint64_t meter_rate_max;
326 
332 
338 
344 
350 
356 
360  uint64_t stats_mask;
361 };
362 
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 
397  const void *cause;
398  const char *message;
399 };
400 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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 
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__ */
rte_mtr_capabilities::chaining_use_prev_mtr_color_supported
int chaining_use_prev_mtr_color_supported
Definition: rte_mtr.h:289
RTE_MTR_STATS_N_PKTS_DROPPED
@ RTE_MTR_STATS_N_PKTS_DROPPED
Definition: rte_mtr.h:71
rte_mtr_params::stats_mask
uint64_t stats_mask
Definition: rte_mtr.h:241
RTE_MTR_STATS_N_BYTES_RED
@ RTE_MTR_STATS_N_BYTES_RED
Definition: rte_mtr.h:80
rte_mtr_capabilities::color_aware_trtcm_rfc4115_supported
int color_aware_trtcm_rfc4115_supported
Definition: rte_mtr.h:343
rte_mtr_capabilities::identical
int identical
Definition: rte_mtr.h:260
rte_mtr_error
Definition: rte_mtr.h:395
RTE_MTR_ERROR_TYPE_UNSPECIFIED
@ RTE_MTR_ERROR_TYPE_UNSPECIFIED
Definition: rte_mtr.h:371
RTE_MTR_STATS_N_PKTS_RED
@ RTE_MTR_STATS_N_PKTS_RED
Definition: rte_mtr.h:68
rte_meter.h
rte_mtr_meter_profile::pbs
uint64_t pbs
Definition: rte_mtr.h:157
rte_mtr_error::message
const char * message
Definition: rte_mtr.h:398
rte_mtr_destroy
__rte_experimental int rte_mtr_destroy(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
rte_mtr_capabilities::meter_rate_max
uint64_t meter_rate_max
Definition: rte_mtr.h:325
rte_mtr_capabilities::stats_mask
uint64_t stats_mask
Definition: rte_mtr.h:360
rte_mtr_stats_update
__rte_experimental int rte_mtr_stats_update(uint16_t port_id, uint32_t mtr_id, uint64_t stats_mask, struct rte_mtr_error *error)
rte_mtr_stats
Definition: rte_mtr.h:89
rte_mtr_meter_profile::trtcm_rfc4115
struct rte_mtr_meter_profile::@149::@153 trtcm_rfc4115
rte_mtr_capabilities::color_aware_trtcm_rfc2698_supported
int color_aware_trtcm_rfc2698_supported
Definition: rte_mtr.h:337
rte_mtr_stats_type
rte_mtr_stats_type
Definition: rte_mtr.h:60
rte_mtr_params::use_prev_mtr_color
int use_prev_mtr_color
Definition: rte_mtr.h:212
rte_mtr_capabilities::color_aware_srtcm_rfc2697_supported
int color_aware_srtcm_rfc2697_supported
Definition: rte_mtr.h:331
rte_mtr_error::type
enum rte_mtr_error_type type
Definition: rte_mtr.h:396
rte_mtr_capabilities::n_max
uint32_t n_max
Definition: rte_mtr.h:249
rte_mtr_params
Definition: rte_mtr.h:199
RTE_MTR_STATS_N_PKTS_GREEN
@ RTE_MTR_STATS_N_PKTS_GREEN
Definition: rte_mtr.h:62
rte_mtr_policer_actions_update
__rte_experimental int rte_mtr_policer_actions_update(uint16_t port_id, uint32_t mtr_id, uint32_t action_mask, enum rte_mtr_policer_action *actions, struct rte_mtr_error *error)
rte_color
rte_color
Definition: rte_meter.h:36
MTR_POLICER_ACTION_DROP
@ MTR_POLICER_ACTION_DROP
Definition: rte_mtr.h:191
rte_mtr_params::action
enum rte_mtr_policer_action action[RTE_COLORS]
Definition: rte_mtr.h:236
rte_mtr_capabilities::meter_srtcm_rfc2697_n_max
uint32_t meter_srtcm_rfc2697_n_max
Definition: rte_mtr.h:306
rte_mtr_meter_dscp_table_update
__rte_experimental int rte_mtr_meter_dscp_table_update(uint16_t port_id, uint32_t mtr_id, enum rte_color *dscp_table, struct rte_mtr_error *error)
rte_mtr_capabilities::chaining_use_prev_mtr_color_enforced
int chaining_use_prev_mtr_color_enforced
Definition: rte_mtr.h:300
rte_mtr_meter_profile::cbs
uint64_t cbs
Definition: rte_mtr.h:139
RTE_MTR_SRTCM_RFC2697
@ RTE_MTR_SRTCM_RFC2697
Definition: rte_mtr.h:115
rte_mtr_meter_disable
__rte_experimental int rte_mtr_meter_disable(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
rte_mtr_error_type
rte_mtr_error_type
Definition: rte_mtr.h:369
rte_mtr_meter_profile::ebs
uint64_t ebs
Definition: rte_mtr.h:142
MTR_POLICER_ACTION_COLOR_YELLOW
@ MTR_POLICER_ACTION_COLOR_YELLOW
Definition: rte_mtr.h:185
rte_mtr_capabilities::meter_trtcm_rfc2698_n_max
uint32_t meter_trtcm_rfc2698_n_max
Definition: rte_mtr.h:312
rte_mtr_meter_profile::eir
uint64_t eir
Definition: rte_mtr.h:166
rte_mtr_meter_profile::alg
enum rte_mtr_algorithm alg
Definition: rte_mtr.h:129
rte_mtr_meter_profile_update
__rte_experimental int rte_mtr_meter_profile_update(uint16_t port_id, uint32_t mtr_id, uint32_t meter_profile_id, struct rte_mtr_error *error)
rte_mtr_meter_profile::pir
uint64_t pir
Definition: rte_mtr.h:151
rte_mtr_meter_profile::srtcm_rfc2697
struct rte_mtr_meter_profile::@149::@151 srtcm_rfc2697
MTR_POLICER_ACTION_COLOR_RED
@ MTR_POLICER_ACTION_COLOR_RED
Definition: rte_mtr.h:188
rte_mtr_policer_action
rte_mtr_policer_action
Definition: rte_mtr.h:180
MTR_POLICER_ACTION_COLOR_GREEN
@ MTR_POLICER_ACTION_COLOR_GREEN
Definition: rte_mtr.h:182
rte_mtr_capabilities::meter_trtcm_rfc4115_n_max
uint32_t meter_trtcm_rfc4115_n_max
Definition: rte_mtr.h:318
rte_mtr_capabilities::policer_action_recolor_supported
int policer_action_recolor_supported
Definition: rte_mtr.h:349
rte_common.h
rte_mtr_algorithm
rte_mtr_algorithm
Definition: rte_mtr.h:106
rte_mtr_meter_profile::trtcm_rfc2698
struct rte_mtr_meter_profile::@149::@152 trtcm_rfc2698
rte_mtr_capabilities::shared_n_flows_per_mtr_max
uint32_t shared_n_flows_per_mtr_max
Definition: rte_mtr.h:271
RTE_MTR_TRTCM_RFC4115
@ RTE_MTR_TRTCM_RFC4115
Definition: rte_mtr.h:121
rte_mtr_capabilities::shared_identical
int shared_identical
Definition: rte_mtr.h:265
RTE_MTR_STATS_N_BYTES_GREEN
@ RTE_MTR_STATS_N_BYTES_GREEN
Definition: rte_mtr.h:74
rte_mtr_capabilities::n_shared_max
uint32_t n_shared_max
Definition: rte_mtr.h:255
rte_mtr_stats_read
__rte_experimental int rte_mtr_stats_read(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_stats *stats, uint64_t *stats_mask, int clear, struct rte_mtr_error *error)
rte_mtr_stats::n_pkts_dropped
uint64_t n_pkts_dropped
Definition: rte_mtr.h:97
RTE_STD_C11
#define RTE_STD_C11
Definition: rte_common.h:40
rte_mtr_capabilities
Definition: rte_mtr.h:247
rte_mtr_error::cause
const void * cause
Definition: rte_mtr.h:397
rte_mtr_params::meter_enable
int meter_enable
Definition: rte_mtr.h:233
RTE_MTR_NONE
@ RTE_MTR_NONE
Definition: rte_mtr.h:112
rte_mtr_create
__rte_experimental int rte_mtr_create(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_params *params, int shared, struct rte_mtr_error *error)
RTE_MTR_STATS_N_PKTS_YELLOW
@ RTE_MTR_STATS_N_PKTS_YELLOW
Definition: rte_mtr.h:65
rte_mtr_meter_profile
Definition: rte_mtr.h:127
rte_mtr_meter_profile_delete
__rte_experimental int rte_mtr_meter_profile_delete(uint16_t port_id, uint32_t meter_profile_id, struct rte_mtr_error *error)
RTE_MTR_TRTCM_RFC2698
@ RTE_MTR_TRTCM_RFC2698
Definition: rte_mtr.h:118
rte_mtr_meter_profile::cir
uint64_t cir
Definition: rte_mtr.h:136
rte_mtr_capabilities::chaining_n_mtrs_per_flow_max
uint32_t chaining_n_mtrs_per_flow_max
Definition: rte_mtr.h:277
RTE_MTR_ERROR_TYPE_NONE
@ RTE_MTR_ERROR_TYPE_NONE
Definition: rte_mtr.h:370
rte_mtr_params::dscp_table
enum rte_color * dscp_table
Definition: rte_mtr.h:226
rte_mtr_stats::n_bytes_dropped
uint64_t n_bytes_dropped
Definition: rte_mtr.h:100
rte_mtr_meter_enable
__rte_experimental int rte_mtr_meter_enable(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
RTE_COLORS
@ RTE_COLORS
Definition: rte_meter.h:40
rte_mtr_meter_profile_add
__rte_experimental int rte_mtr_meter_profile_add(uint16_t port_id, uint32_t meter_profile_id, struct rte_mtr_meter_profile *profile, struct rte_mtr_error *error)
rte_mtr_capabilities::policer_action_drop_supported
int policer_action_drop_supported
Definition: rte_mtr.h:355
rte_mtr_capabilities_get
__rte_experimental int rte_mtr_capabilities_get(uint16_t port_id, struct rte_mtr_capabilities *cap, struct rte_mtr_error *error)
rte_mtr_params::meter_profile_id
uint32_t meter_profile_id
Definition: rte_mtr.h:201
rte_mtr_stats::n_pkts
uint64_t n_pkts[RTE_COLORS]
Definition: rte_mtr.h:91
rte_mtr_stats::n_bytes
uint64_t n_bytes[RTE_COLORS]
Definition: rte_mtr.h:94
RTE_MTR_STATS_N_BYTES_DROPPED
@ RTE_MTR_STATS_N_BYTES_DROPPED
Definition: rte_mtr.h:83
RTE_MTR_STATS_N_BYTES_YELLOW
@ RTE_MTR_STATS_N_BYTES_YELLOW
Definition: rte_mtr.h:77