DPDK  17.11.10
rte_mtr.h
Go to the documentation of this file.
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 
76 #include <stdint.h>
77 
78 #include <rte_common.h>
79 
80 #ifdef __cplusplus
81 extern "C" {
82 #endif
83 
92 };
93 
100 
103 
106 
109 
112 
115 
118 
121 };
122 
129 
132 
134  uint64_t n_pkts_dropped;
135 
137  uint64_t n_bytes_dropped;
138 };
139 
150 
153 
156 
159 };
160 
167 
169  union {
171  struct {
173  uint64_t cir;
174 
176  uint64_t cbs;
177 
179  uint64_t ebs;
180  } srtcm_rfc2697;
181 
183  struct {
185  uint64_t cir;
186 
188  uint64_t pir;
189 
191  uint64_t cbs;
192 
194  uint64_t pbs;
195  } trtcm_rfc2698;
196 
198  struct {
200  uint64_t cir;
201 
203  uint64_t eir;
204 
206  uint64_t cbs;
207 
209  uint64_t ebs;
210  } trtcm_rfc4115;
211  };
212 };
213 
220 
223 
226 
229 };
230 
239 
250 
264 
271 
274 
278  uint64_t stats_mask;
279 };
280 
286  uint32_t n_max;
287 
292  uint32_t n_shared_max;
293 
298 
303 
309 
315 
327 
338 
344 
350 
356 
362  uint64_t meter_rate_max;
363 
369 
375 
381 
387 
393 
397  uint64_t stats_mask;
398 };
399 
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 
434  const void *cause;
435  const char *message;
436 };
437 
450 int
451 rte_mtr_capabilities_get(uint16_t port_id,
452  struct rte_mtr_capabilities *cap,
453  struct rte_mtr_error *error);
454 
473 int
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 
494 int
495 rte_mtr_meter_profile_delete(uint16_t port_id,
496  uint32_t meter_profile_id,
497  struct rte_mtr_error *error);
498 
522 int
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 
545 int
546 rte_mtr_destroy(uint16_t port_id,
547  uint32_t mtr_id,
548  struct rte_mtr_error *error);
549 
572 int
573 rte_mtr_meter_disable(uint16_t port_id,
574  uint32_t mtr_id,
575  struct rte_mtr_error *error);
576 
593 int
594 rte_mtr_meter_enable(uint16_t port_id,
595  uint32_t mtr_id,
596  struct rte_mtr_error *error);
597 
612 int
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 
636 int
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 
662 int
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 
687 int
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 
718 int
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__ */
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)
int rte_mtr_stats_update(uint16_t port_id, uint32_t mtr_id, uint64_t stats_mask, struct rte_mtr_error *error)
int color_aware_srtcm_rfc2697_supported
Definition: rte_mtr.h:368
rte_mtr_policer_action
Definition: rte_mtr.h:217
uint64_t n_pkts[RTE_MTR_COLORS]
Definition: rte_mtr.h:128
uint32_t meter_srtcm_rfc2697_n_max
Definition: rte_mtr.h:343
struct rte_mtr_meter_profile::@70::@73 trtcm_rfc2698
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)
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 stats_mask
Definition: rte_mtr.h:397
rte_mtr_error_type
Definition: rte_mtr.h:406
rte_mtr_algorithm
Definition: rte_mtr.h:143
uint32_t meter_trtcm_rfc2698_n_max
Definition: rte_mtr.h:349
uint64_t n_pkts_dropped
Definition: rte_mtr.h:134
uint32_t n_shared_max
Definition: rte_mtr.h:292
enum rte_mtr_policer_action action[RTE_MTR_COLORS]
Definition: rte_mtr.h:273
enum rte_mtr_error_type type
Definition: rte_mtr.h:433
struct rte_mtr_meter_profile::@70::@74 trtcm_rfc4115
int rte_mtr_meter_disable(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
int policer_action_recolor_supported
Definition: rte_mtr.h:386
const char * message
Definition: rte_mtr.h:435
int rte_mtr_capabilities_get(uint16_t port_id, struct rte_mtr_capabilities *cap, struct rte_mtr_error *error)
int rte_mtr_meter_profile_update(uint16_t port_id, uint32_t mtr_id, uint32_t meter_profile_id, struct rte_mtr_error *error)
uint64_t n_bytes_dropped
Definition: rte_mtr.h:137
rte_mtr_color
Definition: rte_mtr.h:87
uint64_t meter_rate_max
Definition: rte_mtr.h:362
uint64_t n_bytes[RTE_MTR_COLORS]
Definition: rte_mtr.h:131
int rte_mtr_meter_enable(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
int rte_mtr_meter_profile_delete(uint16_t port_id, uint32_t meter_profile_id, struct rte_mtr_error *error)
int color_aware_trtcm_rfc2698_supported
Definition: rte_mtr.h:374
int color_aware_trtcm_rfc4115_supported
Definition: rte_mtr.h:380
struct rte_mtr_meter_profile::@70::@72 srtcm_rfc2697
int policer_action_drop_supported
Definition: rte_mtr.h:392
enum rte_mtr_algorithm alg
Definition: rte_mtr.h:166
int use_prev_mtr_color
Definition: rte_mtr.h:249
int rte_mtr_create(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_params *params, int shared, struct rte_mtr_error *error)
#define RTE_STD_C11
Definition: rte_common.h:66
int chaining_use_prev_mtr_color_supported
Definition: rte_mtr.h:326
uint32_t meter_profile_id
Definition: rte_mtr.h:238
int chaining_use_prev_mtr_color_enforced
Definition: rte_mtr.h:337
rte_mtr_stats_type
Definition: rte_mtr.h:97
int meter_enable
Definition: rte_mtr.h:270
int rte_mtr_meter_dscp_table_update(uint16_t port_id, uint32_t mtr_id, enum rte_mtr_color *dscp_table, struct rte_mtr_error *error)
const void * cause
Definition: rte_mtr.h:434
uint32_t shared_n_flows_per_mtr_max
Definition: rte_mtr.h:308
int rte_mtr_destroy(uint16_t port_id, uint32_t mtr_id, struct rte_mtr_error *error)
enum rte_mtr_color * dscp_table
Definition: rte_mtr.h:263
uint32_t meter_trtcm_rfc4115_n_max
Definition: rte_mtr.h:355
uint64_t stats_mask
Definition: rte_mtr.h:278
uint32_t chaining_n_mtrs_per_flow_max
Definition: rte_mtr.h:314