DPDK  19.05.0
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 #include <rte_meter.h>
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
91 
94 
97 
100 
103 
106 
109 
112 };
113 
119  uint64_t n_pkts[RTE_COLORS];
120 
122  uint64_t n_bytes[RTE_COLORS];
123 
125  uint64_t n_pkts_dropped;
126 
128  uint64_t n_bytes_dropped;
129 };
130 
141 
144 
147 
150 };
151 
158 
160  union {
162  struct {
164  uint64_t cir;
165 
167  uint64_t cbs;
168 
170  uint64_t ebs;
171  } srtcm_rfc2697;
172 
174  struct {
176  uint64_t cir;
177 
179  uint64_t pir;
180 
182  uint64_t cbs;
183 
185  uint64_t pbs;
186  } trtcm_rfc2698;
187 
189  struct {
191  uint64_t cir;
192 
194  uint64_t eir;
195 
197  uint64_t cbs;
198 
200  uint64_t ebs;
201  } trtcm_rfc4115;
202  };
203 };
204 
211 
214 
217 
220 };
221 
230 
241 
255 
262 
265 
269  uint64_t stats_mask;
270 };
271 
277  uint32_t n_max;
278 
283  uint32_t n_shared_max;
284 
289 
294 
300 
306 
318 
329 
335 
341 
347 
353  uint64_t meter_rate_max;
354 
360 
366 
372 
378 
384 
388  uint64_t stats_mask;
389 };
390 
400  RTE_MTR_ERROR_TYPE_METER_PROFILE_ID,
401  RTE_MTR_ERROR_TYPE_METER_PROFILE,
402  RTE_MTR_ERROR_TYPE_MTR_ID,
403  RTE_MTR_ERROR_TYPE_MTR_PARAMS,
404  RTE_MTR_ERROR_TYPE_POLICER_ACTION_GREEN,
405  RTE_MTR_ERROR_TYPE_POLICER_ACTION_YELLOW,
406  RTE_MTR_ERROR_TYPE_POLICER_ACTION_RED,
407  RTE_MTR_ERROR_TYPE_STATS_MASK,
408  RTE_MTR_ERROR_TYPE_STATS,
409  RTE_MTR_ERROR_TYPE_SHARED,
410 };
411 
425  const void *cause;
426  const char *message;
427 };
428 
441 int __rte_experimental
442 rte_mtr_capabilities_get(uint16_t port_id,
443  struct rte_mtr_capabilities *cap,
444  struct rte_mtr_error *error);
445 
464 int __rte_experimental
465 rte_mtr_meter_profile_add(uint16_t port_id,
466  uint32_t meter_profile_id,
467  struct rte_mtr_meter_profile *profile,
468  struct rte_mtr_error *error);
469 
485 int __rte_experimental
486 rte_mtr_meter_profile_delete(uint16_t port_id,
487  uint32_t meter_profile_id,
488  struct rte_mtr_error *error);
489 
513 int __rte_experimental
514 rte_mtr_create(uint16_t port_id,
515  uint32_t mtr_id,
516  struct rte_mtr_params *params,
517  int shared,
518  struct rte_mtr_error *error);
519 
536 int __rte_experimental
537 rte_mtr_destroy(uint16_t port_id,
538  uint32_t mtr_id,
539  struct rte_mtr_error *error);
540 
563 int __rte_experimental
564 rte_mtr_meter_disable(uint16_t port_id,
565  uint32_t mtr_id,
566  struct rte_mtr_error *error);
567 
584 int __rte_experimental
585 rte_mtr_meter_enable(uint16_t port_id,
586  uint32_t mtr_id,
587  struct rte_mtr_error *error);
588 
603 int __rte_experimental
604 rte_mtr_meter_profile_update(uint16_t port_id,
605  uint32_t mtr_id,
606  uint32_t meter_profile_id,
607  struct rte_mtr_error *error);
608 
627 int __rte_experimental
628 rte_mtr_meter_dscp_table_update(uint16_t port_id,
629  uint32_t mtr_id,
630  enum rte_color *dscp_table,
631  struct rte_mtr_error *error);
632 
653 int __rte_experimental
654 rte_mtr_policer_actions_update(uint16_t port_id,
655  uint32_t mtr_id,
656  uint32_t action_mask,
657  enum rte_mtr_policer_action *actions,
658  struct rte_mtr_error *error);
659 
678 int __rte_experimental
679 rte_mtr_stats_update(uint16_t port_id,
680  uint32_t mtr_id,
681  uint64_t stats_mask,
682  struct rte_mtr_error *error);
683 
709 int __rte_experimental
710 rte_mtr_stats_read(uint16_t port_id,
711  uint32_t mtr_id,
712  struct rte_mtr_stats *stats,
713  uint64_t *stats_mask,
714  int clear,
715  struct rte_mtr_error *error);
716 
717 #ifdef __cplusplus
718 }
719 #endif
720 
721 #endif /* __INCLUDE_RTE_MTR_H__ */