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/policer/police.h>
26 * edt: * enum sse2_qos_policer_type_en
27 * Defines type of policer to be allocated
29 typedef enum sse2_qos_policer_type_en_
31 SSE2_QOS_POLICER_TYPE_1R2C = 0,
32 SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697 = 1,
33 SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698 = 2,
34 SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115 = 3,
35 SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1 = 4,
36 SSE2_QOS_POLICER_TYPE_MAX
37 } sse2_qos_policer_type_en;
41 * Enum used to define type of rounding used when calculating policer values
45 SSE2_QOS_ROUND_TO_CLOSEST = 0,
47 SSE2_QOS_ROUND_TO_DOWN,
48 SSE2_QOS_ROUND_INVALID
49 } sse2_qos_round_type_en;
53 * Enum used to define type of rate for configuration, either pps or kbps.
54 * If kbps, then burst is in bytes, if pps, then burst is in ms.
56 * Default of zero is kbps, which is inline with how it is programmed
57 * in actual hardware. However, the warning is that this is reverse logic
58 * of units_in_bits field in sse2_static_policer_parameters_st, which is
59 * inline with sse_punt_drop.h.
63 SSE2_QOS_RATE_KBPS = 0,
66 } sse2_qos_rate_type_en;
70 * Defines type of policer actions.
74 SSE2_QOS_ACTION_DROP = 0,
75 SSE2_QOS_ACTION_TRANSMIT,
76 SSE2_QOS_ACTION_MARK_AND_TRANSMIT
77 } sse2_qos_action_type_en;
80 * edt * struct sse2_qos_pol_action_params_st
81 * This structure is used to hold user configured police action parameters.
83 * element: action_type
84 * Action type (see sse2_qos_action_type_en).
86 * DSCP value to set when action is SSE2_QOS_ACTION_MARK_AND_TRANSMIT.
88 typedef struct sse2_qos_pol_action_params_st_
92 } sse2_qos_pol_action_params_st;
95 * edt: * struct sse2_qos_pol_cfg_params_st
98 * This structure is used to hold user configured policing parameters.
103 * EIR or PIR in kbps.
105 * Committed Burst in bytes.
107 * Excess or Peak Burst in bytes.
113 * Committed Burst in milliseconds.
115 * Excess or Peak Burst in milliseconds.
117 * Indicates the union if in kbps/bytes or pps/ms.
119 * Policer algorithm - 1R2C, 1R3C (2697), 2R3C (2698) or 2R3C (4115). See
120 * sse_qos_policer_type_en
122 * Rounding type (see sse_qos_round_type_en). Needed when policer values
123 * need to be rounded. Caller can decide on type of rounding used
125 typedef struct sse2_qos_pol_cfg_params_st_
143 } rb; /* rate burst config */
144 u8 rate_type; /* sse2_qos_rate_type_en */
145 u8 rnd_type; /* sse2_qos_round_type_en */
146 u8 rfc; /* sse2_qos_policer_type_en */
148 u8 overwrite_bucket; /* for debugging purposes */
149 u32 current_bucket; /* for debugging purposes */
150 u32 extended_bucket; /* for debugging purposes */
151 sse2_qos_pol_action_params_st conform_action;
152 sse2_qos_pol_action_params_st exceed_action;
153 sse2_qos_pol_action_params_st violate_action;
154 } sse2_qos_pol_cfg_params_st;
157 typedef struct sse2_qos_pol_hw_params_st_
164 u8 comm_bkt_limit_exp;
165 u8 comm_bkt_limit_man;
166 u8 extd_bkt_limit_exp;
167 u8 extd_bkt_limit_man;
170 } sse2_qos_pol_hw_params_st;
174 sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
175 policer_read_response_type_st * phys);
178 #endif /* __included_xlate_h__ */
181 * fd.io coding-style-patch-verification: ON
184 * eval: (c-set-style "gnu")