policer: add api to bind policer to worker
[vpp.git] / src / vnet / policer / policer.api
1 /*
2  * Copyright (c) 2015-2020 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
16 option version = "2.0.0";
17
18 import "vnet/policer/policer_types.api";
19
20 /** \brief policer bind: Associate/disassociate a policer with a worker thread.
21     @param client_index - opaque cookie to identify the sender
22     @param context - sender context, to match reply w/ request
23     @param name - policer name to bind
24     @param worker_index - the worker thread to bind to
25     @param bind_enable - Associate/disassociate
26 */
27 autoreply define policer_bind
28 {
29   u32 client_index;
30   u32 context;
31
32   string name[64];
33   u32 worker_index;
34   bool bind_enable;
35 };
36
37 /** \brief Add/del policer
38     @param client_index - opaque cookie to identify the sender
39     @param context - sender context, to match reply w/ request
40     @param is_add - add policer if non-zero, else delete
41     @param name - policer name
42     @param cir - CIR
43     @param eir - EIR
44     @param cb - Committed Burst
45     @param eb - Excess or Peak Burst
46     @param rate_type - rate type
47     @param round_type - rounding type
48     @param type - policer algorithm
49     @param color_aware - 0=color-blind, 1=color-aware
50     @param conform_action - conform action
51     @param exceed_action - exceed action type
52     @param violate_action - violate action type
53 */
54 define policer_add_del
55 {
56   u32 client_index;
57   u32 context;
58
59   bool is_add;
60   string name[64];
61   u32 cir;
62   u32 eir;
63   u64 cb;
64   u64 eb;
65   vl_api_sse2_qos_rate_type_t rate_type;
66   vl_api_sse2_qos_round_type_t round_type;
67   vl_api_sse2_qos_policer_type_t type;
68   bool color_aware;
69   vl_api_sse2_qos_action_t conform_action;
70   vl_api_sse2_qos_action_t exceed_action;
71   vl_api_sse2_qos_action_t violate_action;
72 };
73
74 /** \brief Add/del policer response
75     @param context - sender context, to match reply w/ request
76     @param retval - return value for request
77     @param policer_index - for add, returned index of the new policer
78 */
79 define policer_add_del_reply
80 {
81   u32 context;
82   i32 retval;
83   u32 policer_index;
84 };
85
86 /** \brief Get list of policers
87     @param client_index - opaque cookie to identify the sender
88     @param context - sender context, to match reply w/ request
89     @param match_name_valid - if 0 request all policers otherwise use match_name
90     @param match_name - policer name
91 */
92 define policer_dump
93 {
94   u32 client_index;
95   u32 context;
96
97   bool match_name_valid;
98   string match_name[64];
99 };
100
101 /** \brief Policer operational state response.
102     @param context - sender context, to match reply w/ request
103     @param name - policer name
104     @param cir - CIR
105     @param eir - EIR
106     @param cb - Committed Burst
107     @param eb - Excess or Peak Burst
108     @param rate_type - rate type
109     @param round_type - rounding type
110     @param type - policer algorithm
111     @param conform_action - conform action
112     @param exceed_action - exceed action
113     @param violate_action - violate action
114     @param single_rate - 1 = single rate policer, 0 = two rate policer
115     @param color_aware - for hierarchical policing
116     @param scale - power-of-2 shift amount for lower rates
117     @param cir_tokens_per_period - number of tokens for each period
118     @param pir_tokens_per_period - number of tokens for each period for 2-rate policer
119     @param current_limit - current limit
120     @param current_bucket - current bucket
121     @param extended_limit - extended limit
122     @param extended_bucket - extended bucket
123     @param last_update_time - last update time
124 */
125 define policer_details
126 {
127   u32 context;
128
129   string name[64];
130   u32 cir;
131   u32 eir;
132   u64 cb;
133   u64 eb;
134   vl_api_sse2_qos_rate_type_t rate_type;
135   vl_api_sse2_qos_round_type_t round_type;
136   vl_api_sse2_qos_policer_type_t type;
137   vl_api_sse2_qos_action_t conform_action;
138   vl_api_sse2_qos_action_t exceed_action;
139   vl_api_sse2_qos_action_t violate_action;
140   bool single_rate;
141   bool color_aware;
142   u32 scale;
143   u32 cir_tokens_per_period;
144   u32 pir_tokens_per_period;
145   u32 current_limit;
146   u32 current_bucket;
147   u32 extended_limit;
148   u32 extended_bucket;
149   u64 last_update_time;
150 };
151
152 /*
153  * Local Variables:
154  * eval: (c-set-style "gnu")
155  * End:
156  */