blob: 16742f80a471edfa1c553fb4305f6bfc21d1dc2b [file] [log] [blame]
Ed Warnickecb9cada2015-12-08 15:45:58 -07001/*
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/*---------------------------------------------------------------------------
16 * from gdp_logical_qos.h
17 *---------------------------------------------------------------------------
18 */
19
20#ifndef __included_xlate_h__
21#define __included_xlate_h__
22
Ed Warnickecb9cada2015-12-08 15:45:58 -070023#include <vnet/policer/police.h>
24
25/*
26 * edt: * enum sse2_qos_policer_type_en
27 * Defines type of policer to be allocated
28 */
Damjan Marion3891cd82016-10-27 10:27:00 +020029typedef enum sse2_qos_policer_type_en_
30{
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
Ed Warnickecb9cada2015-12-08 15:45:58 -070037} sse2_qos_policer_type_en;
38
39/*
40 * edt: * enum
41 * Enum used to define type of rounding used when calculating policer values
42 */
Damjan Marion3891cd82016-10-27 10:27:00 +020043typedef enum
44{
45 SSE2_QOS_ROUND_TO_CLOSEST = 0,
46 SSE2_QOS_ROUND_TO_UP,
47 SSE2_QOS_ROUND_TO_DOWN,
48 SSE2_QOS_ROUND_INVALID
Ed Warnickecb9cada2015-12-08 15:45:58 -070049} sse2_qos_round_type_en;
50
51/*
52 * edt: * enum
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.
55 *
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.
60 */
Damjan Marion3891cd82016-10-27 10:27:00 +020061typedef enum
62{
63 SSE2_QOS_RATE_KBPS = 0,
64 SSE2_QOS_RATE_PPS,
65 SSE2_QOS_RATE_INVALID
Ed Warnickecb9cada2015-12-08 15:45:58 -070066} sse2_qos_rate_type_en;
67
Matus Fabian4ac74c92016-05-31 07:33:29 -070068/*
69 * edt: * enum
70 * Defines type of policer actions.
71 */
Damjan Marion3891cd82016-10-27 10:27:00 +020072typedef enum
73{
74 SSE2_QOS_ACTION_DROP = 0,
75 SSE2_QOS_ACTION_TRANSMIT,
76 SSE2_QOS_ACTION_MARK_AND_TRANSMIT
Matus Fabian4ac74c92016-05-31 07:33:29 -070077} sse2_qos_action_type_en;
78
79/*
80 * edt * struct sse2_qos_pol_action_params_st
81 * This structure is used to hold user configured police action parameters.
82 *
83 * element: action_type
84 * Action type (see sse2_qos_action_type_en).
85 * elemtnt: dscp
86 * DSCP value to set when action is SSE2_QOS_ACTION_MARK_AND_TRANSMIT.
87 */
Damjan Marion3891cd82016-10-27 10:27:00 +020088typedef struct sse2_qos_pol_action_params_st_
89{
90 u8 action_type;
91 u8 dscp;
Matus Fabian4ac74c92016-05-31 07:33:29 -070092} sse2_qos_pol_action_params_st;
93
Damjan Marion3891cd82016-10-27 10:27:00 +020094/*
Ed Warnickecb9cada2015-12-08 15:45:58 -070095 * edt: * struct sse2_qos_pol_cfg_params_st
96 *
Damjan Marion3891cd82016-10-27 10:27:00 +020097 * Description:
98 * This structure is used to hold user configured policing parameters.
99 *
100 * element: cir_kbps
Ed Warnickecb9cada2015-12-08 15:45:58 -0700101 * CIR in kbps.
Damjan Marion3891cd82016-10-27 10:27:00 +0200102 * element: eir_kbps
Ed Warnickecb9cada2015-12-08 15:45:58 -0700103 * EIR or PIR in kbps.
Damjan Marion3891cd82016-10-27 10:27:00 +0200104 * element: cb_bytes
Ed Warnickecb9cada2015-12-08 15:45:58 -0700105 * Committed Burst in bytes.
Damjan Marion3891cd82016-10-27 10:27:00 +0200106 * element: eb_bytes
Ed Warnickecb9cada2015-12-08 15:45:58 -0700107 * Excess or Peak Burst in bytes.
Damjan Marion3891cd82016-10-27 10:27:00 +0200108 * element: cir_pps
Ed Warnickecb9cada2015-12-08 15:45:58 -0700109 * CIR in pps.
Damjan Marion3891cd82016-10-27 10:27:00 +0200110 * element: eir_pps
Ed Warnickecb9cada2015-12-08 15:45:58 -0700111 * EIR or PIR in pps.
Damjan Marion3891cd82016-10-27 10:27:00 +0200112 * element: cb_ms
Ed Warnickecb9cada2015-12-08 15:45:58 -0700113 * Committed Burst in milliseconds.
Damjan Marion3891cd82016-10-27 10:27:00 +0200114 * element: eb_ms
Ed Warnickecb9cada2015-12-08 15:45:58 -0700115 * Excess or Peak Burst in milliseconds.
Damjan Marion3891cd82016-10-27 10:27:00 +0200116 * element: rate_type
Ed Warnickecb9cada2015-12-08 15:45:58 -0700117 * Indicates the union if in kbps/bytes or pps/ms.
Damjan Marion3891cd82016-10-27 10:27:00 +0200118 * element: rfc
Ed Warnickecb9cada2015-12-08 15:45:58 -0700119 * Policer algorithm - 1R2C, 1R3C (2697), 2R3C (2698) or 2R3C (4115). See
120 * sse_qos_policer_type_en
121 * element: rnd_type
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
124 */
Damjan Marion3891cd82016-10-27 10:27:00 +0200125typedef struct sse2_qos_pol_cfg_params_st_
126{
127 union
128 {
129 struct
130 {
131 u32 cir_kbps;
132 u32 eir_kbps;
133 u64 cb_bytes;
134 u64 eb_bytes;
135 } kbps;
136 struct
137 {
138 u32 cir_pps;
139 u32 eir_pps;
140 u64 cb_ms;
141 u64 eb_ms;
142 } pps;
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 */
147 u8 color_aware;
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;
Ed Warnickecb9cada2015-12-08 15:45:58 -0700154} sse2_qos_pol_cfg_params_st;
155
156
Damjan Marion3891cd82016-10-27 10:27:00 +0200157typedef struct sse2_qos_pol_hw_params_st_
158{
159 u8 rfc;
160 u8 allow_negative;
161 u8 rate_exp;
162 u16 avg_rate_man;
163 u16 peak_rate_man;
164 u8 comm_bkt_limit_exp;
165 u8 comm_bkt_limit_man;
166 u8 extd_bkt_limit_exp;
167 u8 extd_bkt_limit_man;
168 u32 comm_bkt;
169 u32 extd_bkt;
Ed Warnickecb9cada2015-12-08 15:45:58 -0700170} sse2_qos_pol_hw_params_st;
171
172
Damjan Marion3891cd82016-10-27 10:27:00 +0200173int
174sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
175 policer_read_response_type_st * phys);
Ed Warnickecb9cada2015-12-08 15:45:58 -0700176
177
178#endif /* __included_xlate_h__ */
Damjan Marion3891cd82016-10-27 10:27:00 +0200179
180/*
181 * fd.io coding-style-patch-verification: ON
182 *
183 * Local Variables:
184 * eval: (c-set-style "gnu")
185 * End:
186 */