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/fix_types.h>
24 #include <vnet/policer/police.h>
27 * edt: * enum sse2_qos_policer_type_en
28 * Defines type of policer to be allocated
30 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
44 SSE2_QOS_ROUND_TO_CLOSEST = 0,
46 SSE2_QOS_ROUND_TO_DOWN,
47 SSE2_QOS_ROUND_INVALID
48 } sse2_qos_round_type_en;
52 * Enum used to define type of rate for configuration, either pps or kbps.
53 * If kbps, then burst is in bytes, if pps, then burst is in ms.
55 * Default of zero is kbps, which is inline with how it is programmed
56 * in actual hardware. However, the warning is that this is reverse logic
57 * of units_in_bits field in sse2_static_policer_parameters_st, which is
58 * inline with sse_punt_drop.h.
61 SSE2_QOS_RATE_KBPS = 0,
64 } sse2_qos_rate_type_en;
67 * edt: * struct sse2_qos_pol_cfg_params_st
70 * This structure is used to hold user configured policing parameters.
77 * Committed Burst in bytes.
79 * Excess or Peak Burst in bytes.
85 * Committed Burst in milliseconds.
87 * Excess or Peak Burst in milliseconds.
89 * Indicates the union if in kbps/bytes or pps/ms.
91 * Policer algorithm - 1R2C, 1R3C (2697), 2R3C (2698) or 2R3C (4115). See
92 * sse_qos_policer_type_en
94 * Rounding type (see sse_qos_round_type_en). Needed when policer values
95 * need to be rounded. Caller can decide on type of rounding used
97 typedef struct sse2_qos_pol_cfg_params_st_ {
111 } PACKED rb; /* rate burst config */
112 uint8_t rate_type; /* sse2_qos_rate_type_en */
113 uint8_t rnd_type; /* sse2_qos_round_type_en */
114 uint8_t rfc; /* sse2_qos_policer_type_en */
115 uint8_t overwrite_bucket; /* for debugging purposes */
116 uint32_t current_bucket; /* for debugging purposes */
117 uint32_t extended_bucket; /* for debugging purposes */
118 } sse2_qos_pol_cfg_params_st;
121 typedef struct sse2_qos_pol_hw_params_st_ {
123 uint8_t allow_negative;
125 uint16_t avg_rate_man;
126 uint16_t peak_rate_man;
127 uint8_t comm_bkt_limit_exp;
128 uint8_t comm_bkt_limit_man;
129 uint8_t extd_bkt_limit_exp;
130 uint8_t extd_bkt_limit_man;
133 } sse2_qos_pol_hw_params_st;
137 sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st *cfg,
138 policer_read_response_type_st *phys);
141 #endif /* __included_xlate_h__ */