DPDK  21.02.0
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_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)
int color_aware_srtcm_rfc2697_supported
Definition: rte_mtr.h:331
rte_mtr_policer_action
Definition: rte_mtr.h:180
uint32_t meter_srtcm_rfc2697_n_max
Definition: rte_mtr.h:306
__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)
uint64_t stats_mask
Definition: rte_mtr.h:360
rte_mtr_error_type
Definition: rte_mtr.h:369
rte_mtr_algorithm
Definition: rte_mtr.h:106
uint32_t meter_trtcm_rfc2698_n_max
Definition: rte_mtr.h:312
uint64_t n_pkts_dropped
Definition: rte_mtr.h:97
uint32_t n_shared_max
Definition: rte_mtr.h:255
struct rte_mtr_meter_profile::@172::@176 trtcm_rfc4115
enum rte_mtr_error_type type
Definition: rte_mtr.h:396
__rte_experimental int rte_mtr_meter_disable(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
enum rte_mtr_policer_action action[RTE_COLORS]
Definition: rte_mtr.h:236
int policer_action_recolor_supported
Definition: rte_mtr.h:349
const char * message
Definition: rte_mtr.h:398
__rte_experimental int rte_mtr_meter_profile_delete(uint16_t port_id, uint32_t meter_profile_id, struct rte_mtr_error *error)
__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)
uint64_t n_pkts[RTE_COLORS]
Definition: rte_mtr.h:91
__rte_experimental int rte_mtr_meter_enable(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
uint64_t n_bytes_dropped
Definition: rte_mtr.h:100
uint64_t n_bytes[RTE_COLORS]
Definition: rte_mtr.h:94
uint64_t meter_rate_max
Definition: rte_mtr.h:325
struct rte_mtr_meter_profile::@172::@175 trtcm_rfc2698
__rte_experimental int rte_mtr_stats_update(uint16_t port_id, uint32_t mtr_id, uint64_t stats_mask, struct rte_mtr_error *error)
struct rte_mtr_meter_profile::@172::@174 srtcm_rfc2697
int color_aware_trtcm_rfc2698_supported
Definition: rte_mtr.h:337
__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)
int color_aware_trtcm_rfc4115_supported
Definition: rte_mtr.h:343
int policer_action_drop_supported
Definition: rte_mtr.h:355
enum rte_mtr_algorithm alg
Definition: rte_mtr.h:129
rte_color
Definition: rte_meter.h:36
int use_prev_mtr_color
Definition: rte_mtr.h:212
#define RTE_STD_C11
Definition: rte_common.h:40
int chaining_use_prev_mtr_color_supported
Definition: rte_mtr.h:289
uint32_t meter_profile_id
Definition: rte_mtr.h:201
int chaining_use_prev_mtr_color_enforced
Definition: rte_mtr.h:300
__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_stats_type
Definition: rte_mtr.h:60
__rte_experimental int rte_mtr_capabilities_get(uint16_t port_id, struct rte_mtr_capabilities *cap, struct rte_mtr_error *error)
int meter_enable
Definition: rte_mtr.h:233
const void * cause
Definition: rte_mtr.h:397
uint32_t shared_n_flows_per_mtr_max
Definition: rte_mtr.h:271
enum rte_color * dscp_table
Definition: rte_mtr.h:226
__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)
uint32_t meter_trtcm_rfc4115_n_max
Definition: rte_mtr.h:318
uint64_t stats_mask
Definition: rte_mtr.h:241
__rte_experimental int rte_mtr_destroy(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
uint32_t chaining_n_mtrs_per_flow_max
Definition: rte_mtr.h:277