DPDK  18.05.1
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 #include <rte_compat.h>
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 __rte_experimental
451 rte_mtr_capabilities_get(uint16_t port_id,
452  struct rte_mtr_capabilities *cap,
453  struct rte_mtr_error *error);
454 
473 int __rte_experimental
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 __rte_experimental
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 __rte_experimental
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 __rte_experimental
546 rte_mtr_destroy(uint16_t port_id,
547  uint32_t mtr_id,
548  struct rte_mtr_error *error);
549 
572 int __rte_experimental
573 rte_mtr_meter_disable(uint16_t port_id,
574  uint32_t mtr_id,
575  struct rte_mtr_error *error);
576 
593 int __rte_experimental
594 rte_mtr_meter_enable(uint16_t port_id,
595  uint32_t mtr_id,
596  struct rte_mtr_error *error);
597 
612 int __rte_experimental
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 __rte_experimental
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 __rte_experimental
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 __rte_experimental
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 __rte_experimental
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__ */