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:
7 * http://www.apache.org/licenses/LICENSE-2.0
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.
15 /*---------------------------------------------------------------------------
16 * from gdp_logical_qos.h
17 *---------------------------------------------------------------------------
20 #ifndef __included_xlate_h__
21 #define __included_xlate_h__
23 #include <vnet/ip/ip_packet.h>
24 #include <vnet/policer/police.h>
27 * edt: * enum qos_policer_type_en
28 * Defines type of policer to be allocated
30 typedef enum qos_policer_type_en_
32 QOS_POLICER_TYPE_1R2C = 0,
33 QOS_POLICER_TYPE_1R3C_RFC_2697 = 1,
34 QOS_POLICER_TYPE_2R3C_RFC_2698 = 2,
35 QOS_POLICER_TYPE_2R3C_RFC_4115 = 3,
36 QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1 = 4,
38 } __clib_packed qos_policer_type_en;
42 * Enum used to define type of rounding used when calculating policer values
46 QOS_ROUND_TO_CLOSEST = 0,
50 } __clib_packed qos_round_type_en;
54 * Enum used to define type of rate for configuration, either pps or kbps.
55 * If kbps, then burst is in bytes, if pps, then burst is in ms.
57 * Default of zero is kbps, which is inline with how it is programmed
58 * in actual hardware. However, the warning is that this is reverse logic
59 * of units_in_bits field in static_policer_parameters_st, which is
60 * inline with sse_punt_drop.h.
67 } __clib_packed qos_rate_type_en;
70 * edt * struct qos_pol_action_params_st
71 * This structure is used to hold user configured police action parameters.
73 * element: action_type
74 * Action type (see qos_action_type_en).
76 * DSCP value to set when action is QOS_ACTION_MARK_AND_TRANSMIT.
78 typedef struct qos_pol_action_params_st_
80 qos_action_type_en action_type;
82 } qos_pol_action_params_st;
85 * edt: * struct qos_pol_cfg_params_st
88 * This structure is used to hold user configured policing parameters.
95 * Committed Burst in bytes.
97 * Excess or Peak Burst in bytes.
103 * Committed Burst in milliseconds.
105 * Excess or Peak Burst in milliseconds.
107 * Indicates the union if in kbps/bytes or pps/ms.
109 * Policer algorithm - 1R2C, 1R3C (2697), 2R3C (2698) or 2R3C (4115). See
110 * qos_policer_type_en
112 * Rounding type (see qos_round_type_en). Needed when policer values
113 * need to be rounded. Caller can decide on type of rounding used
115 typedef struct qos_pol_cfg_params_st_
133 } rb; /* rate burst config */
134 qos_rate_type_en rate_type;
135 qos_round_type_en rnd_type;
136 qos_policer_type_en rfc;
138 u8 overwrite_bucket; /* for debugging purposes */
139 u32 current_bucket; /* for debugging purposes */
140 u32 extended_bucket; /* for debugging purposes */
141 qos_pol_action_params_st conform_action;
142 qos_pol_action_params_st exceed_action;
143 qos_pol_action_params_st violate_action;
144 } qos_pol_cfg_params_st;
146 typedef struct qos_pol_hw_params_st_
153 u8 comm_bkt_limit_exp;
154 u8 comm_bkt_limit_man;
155 u8 extd_bkt_limit_exp;
156 u8 extd_bkt_limit_man;
159 } qos_pol_hw_params_st;
161 int pol_logical_2_physical (const qos_pol_cfg_params_st *cfg, policer_t *phys);
163 #endif /* __included_xlate_h__ */
166 * fd.io coding-style-patch-verification: ON
169 * eval: (c-set-style "gnu")