FD.io VPP  v21.06
Vector Packet Processing
policer.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __included_policer_h__
16 #define __included_policer_h__
17 
18 #include <stdbool.h>
19 
20 #include <vlib/vlib.h>
21 #include <vnet/vnet.h>
22 
23 #include <vnet/policer/xlate.h>
24 #include <vnet/policer/police.h>
25 
26 typedef struct
27 {
28  /* policer pool, aligned */
30 
31  /* config + template h/w policer instance parallel pools */
34 
35  /* Config by name hash */
37 
38  /* Policer by name hash */
40 
41  /* Policer by sw_if_index vector */
43 
44  /* convenience */
47 
49 
50  /* frame queue for thread handoff */
53 
55 
56 extern vlib_combined_counter_main_t policer_counters[];
57 
59 
60 typedef enum
61 {
66 
67 u8 *format_policer_instance (u8 * s, va_list * va);
69  qos_pol_cfg_params_st *cfg, u32 *policer_index,
70  u8 is_add);
71 int policer_bind_worker (u8 *name, u32 worker, bool bind);
73 
74 #endif /* __included_policer_h__ */
75 
76 /*
77  * fd.io coding-style-patch-verification: ON
78  *
79  * Local Variables:
80  * eval: (c-set-style "gnu")
81  * End:
82  */
uword * policer_index_by_name
Definition: policer.h:39
uword * policer_config_by_name
Definition: policer.h:36
clib_error_t * policer_add_del(vlib_main_t *vm, u8 *name, qos_pol_cfg_params_st *cfg, u32 *policer_index, u8 is_add)
Definition: policer.c:53
vnet_policer_next_t
Definition: policer.h:60
qos_pol_cfg_params_st * configs
Definition: policer.h:32
u8 * format_policer_instance(u8 *s, va_list *va)
Definition: policer.c:201
vnet_main_t * vnet_main
Definition: policer.h:46
string name[64]
Definition: fib.api:25
unsigned char u8
Definition: types.h:56
int policer_input(u8 *name, u32 sw_if_index, bool apply)
Definition: policer.c:169
unsigned int u32
Definition: types.h:88
u32 vlib_log_class_t
Definition: vlib.h:52
vlib_log_class_t log_class
Definition: policer.h:48
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:34
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
Definition: nat44_ei.c:3047
u32 * policer_index_by_sw_if_index
Definition: policer.h:42
vlib_main_t * vlib_main
Definition: policer.h:45
policer_t * policer_templates
Definition: policer.h:33
int policer_bind_worker(u8 *name, u32 worker, bool bind)
Definition: policer.c:138
static int apply(phash_main_t *pm, u32 tail, u32 rollback)
Definition: phash.c:408
policer_t * policers
Definition: policer.h:29
struct _vlib_node_registration vlib_node_registration_t
u64 uword
Definition: types.h:112
A collection of combined counters.
Definition: counter.h:203
vlib_node_registration_t policer_input_node
(constructor) VLIB_REGISTER_NODE (policer_input_node)
Definition: node_funcs.c:262
vnet_policer_main_t vnet_policer_main
Definition: policer.c:22