aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/policer
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-02-09 10:16:58 +0000
committerNeale Ranns <neale@graphiant.com>2021-02-12 14:55:58 +0000
commitc5299ff30a6186f580509eda2c4db3decfffe967 (patch)
tree019738ecade99e21539171dab723b4cba0bc7d72 /src/vnet/policer
parentcf0102b3ba69cb6bad6b1bae159e51976e2331f8 (diff)
policer: remove SSE2 prefix
The policer code uses a naming convention of prefixing a lot of its definitions with "SSE2" when in fact there is nothing SSE2 specific about them. This is confusing so remove the prefix. Unfortunately it has to stay in the API definitions for backward compatibility. Type: improvement Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: I59a7df9fd5ded2575f2e587b2768a025a213b07c
Diffstat (limited to 'src/vnet/policer')
-rw-r--r--src/vnet/policer/node_funcs.c10
-rw-r--r--src/vnet/policer/police_inlines.h2
-rw-r--r--src/vnet/policer/policer.c96
-rw-r--r--src/vnet/policer/policer.h9
-rw-r--r--src/vnet/policer/policer_api.c18
-rw-r--r--src/vnet/policer/policer_types.api2
-rw-r--r--src/vnet/policer/xlate.c680
-rw-r--r--src/vnet/policer/xlate.h90
8 files changed, 424 insertions, 483 deletions
diff --git a/src/vnet/policer/node_funcs.c b/src/vnet/policer/node_funcs.c
index fd7f197e905..5ede4aca944 100644
--- a/src/vnet/policer/node_funcs.c
+++ b/src/vnet/policer/node_funcs.c
@@ -156,7 +156,7 @@ vnet_policer_inline (vlib_main_t * vm,
act1 = vnet_policer_police (vm, b1, pi1, time_in_policer_periods,
POLICE_CONFORM /* no chaining */ );
- if (PREDICT_FALSE (act0 == SSE2_QOS_ACTION_DROP)) /* drop action */
+ if (PREDICT_FALSE (act0 == QOS_ACTION_DROP)) /* drop action */
{
next0 = VNET_POLICER_NEXT_DROP;
b0->error = node->errors[VNET_POLICER_ERROR_DROP];
@@ -166,7 +166,7 @@ vnet_policer_inline (vlib_main_t * vm,
transmitted++;
}
- if (PREDICT_FALSE (act1 == SSE2_QOS_ACTION_DROP)) /* drop action */
+ if (PREDICT_FALSE (act1 == QOS_ACTION_DROP)) /* drop action */
{
next1 = VNET_POLICER_NEXT_DROP;
b1->error = node->errors[VNET_POLICER_ERROR_DROP];
@@ -238,7 +238,7 @@ vnet_policer_inline (vlib_main_t * vm,
act0 = vnet_policer_police (vm, b0, pi0, time_in_policer_periods,
POLICE_CONFORM /* no chaining */ );
- if (PREDICT_FALSE (act0 == SSE2_QOS_ACTION_DROP)) /* drop action */
+ if (PREDICT_FALSE (act0 == QOS_ACTION_DROP)) /* drop action */
{
next0 = VNET_POLICER_NEXT_DROP;
b0->error = node->errors[VNET_POLICER_ERROR_DROP];
@@ -704,7 +704,7 @@ policer_classify_inline (vlib_main_t * vm,
e0->next_index,
time_in_policer_periods,
e0->opaque_index);
- if (PREDICT_FALSE (act0 == SSE2_QOS_ACTION_DROP))
+ if (PREDICT_FALSE (act0 == QOS_ACTION_DROP))
{
next0 = POLICER_CLASSIFY_NEXT_INDEX_DROP;
b0->error = node->errors[POLICER_CLASSIFY_ERROR_DROP];
@@ -738,7 +738,7 @@ policer_classify_inline (vlib_main_t * vm,
e0->next_index,
time_in_policer_periods,
e0->opaque_index);
- if (PREDICT_FALSE (act0 == SSE2_QOS_ACTION_DROP))
+ if (PREDICT_FALSE (act0 == QOS_ACTION_DROP))
{
next0 = POLICER_CLASSIFY_NEXT_INDEX_DROP;
b0->error =
diff --git a/src/vnet/policer/police_inlines.h b/src/vnet/policer/police_inlines.h
index c3bd324d85b..f0b871af856 100644
--- a/src/vnet/policer/police_inlines.h
+++ b/src/vnet/policer/police_inlines.h
@@ -78,7 +78,7 @@ vnet_policer_police (vlib_main_t * vm,
act = pol->action[col];
vlib_increment_combined_counter (&policer_counters[col], vm->thread_index,
policer_index, 1, len);
- if (PREDICT_TRUE (act == SSE2_QOS_ACTION_MARK_AND_TRANSMIT))
+ if (PREDICT_TRUE (act == QOS_ACTION_MARK_AND_TRANSMIT))
vnet_policer_mark (b, pol->mark_dscp[col]);
return act;
diff --git a/src/vnet/policer/policer.c b/src/vnet/policer/policer.c
index 99c3ff1b4ba..6d5197ed8ed 100644
--- a/src/vnet/policer/policer.c
+++ b/src/vnet/policer/policer.c
@@ -49,10 +49,8 @@ vlib_combined_counter_main_t policer_counters[] = {
};
clib_error_t *
-policer_add_del (vlib_main_t * vm,
- u8 * name,
- sse2_qos_pol_cfg_params_st * cfg,
- u32 * policer_index, u8 is_add)
+policer_add_del (vlib_main_t *vm, u8 *name, qos_pol_cfg_params_st *cfg,
+ u32 *policer_index, u8 is_add)
{
vnet_policer_main_t *pm = &vnet_policer_main;
policer_read_response_type_st test_policer;
@@ -96,12 +94,12 @@ policer_add_del (vlib_main_t * vm,
}
/* Vet the configuration before adding it to the table */
- rv = sse2_pol_logical_2_physical (cfg, &test_policer);
+ rv = pol_logical_2_physical (cfg, &test_policer);
if (rv == 0)
{
policer_read_response_type_st *pp;
- sse2_qos_pol_cfg_params_st *cp;
+ qos_pol_cfg_params_st *cp;
int i;
pool_get (pm->configs, cp);
@@ -171,13 +169,13 @@ format_policer_instance (u8 * s, va_list * va)
static u8 *
format_policer_round_type (u8 * s, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
- if (c->rnd_type == SSE2_QOS_ROUND_TO_CLOSEST)
+ if (c->rnd_type == QOS_ROUND_TO_CLOSEST)
s = format (s, "closest");
- else if (c->rnd_type == SSE2_QOS_ROUND_TO_UP)
+ else if (c->rnd_type == QOS_ROUND_TO_UP)
s = format (s, "up");
- else if (c->rnd_type == SSE2_QOS_ROUND_TO_DOWN)
+ else if (c->rnd_type == QOS_ROUND_TO_DOWN)
s = format (s, "down");
else
s = format (s, "ILLEGAL");
@@ -188,11 +186,11 @@ format_policer_round_type (u8 * s, va_list * va)
static u8 *
format_policer_rate_type (u8 * s, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
- if (c->rate_type == SSE2_QOS_RATE_KBPS)
+ if (c->rate_type == QOS_RATE_KBPS)
s = format (s, "kbps");
- else if (c->rate_type == SSE2_QOS_RATE_PPS)
+ else if (c->rate_type == QOS_RATE_PPS)
s = format (s, "pps");
else
s = format (s, "ILLEGAL");
@@ -202,21 +200,21 @@ format_policer_rate_type (u8 * s, va_list * va)
static u8 *
format_policer_type (u8 * s, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
- if (c->rfc == SSE2_QOS_POLICER_TYPE_1R2C)
+ if (c->rfc == QOS_POLICER_TYPE_1R2C)
s = format (s, "1r2c");
- else if (c->rfc == SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697)
+ else if (c->rfc == QOS_POLICER_TYPE_1R3C_RFC_2697)
s = format (s, "1r3c");
- else if (c->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698)
+ else if (c->rfc == QOS_POLICER_TYPE_2R3C_RFC_2698)
s = format (s, "2r3c-2698");
- else if (c->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115)
+ else if (c->rfc == QOS_POLICER_TYPE_2R3C_RFC_4115)
s = format (s, "2r3c-4115");
- else if (c->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1)
+ else if (c->rfc == QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1)
s = format (s, "2r3c-mef5cf1");
else
s = format (s, "ILLEGAL");
@@ -226,14 +224,13 @@ format_policer_type (u8 * s, va_list * va)
static u8 *
format_policer_action_type (u8 * s, va_list * va)
{
- sse2_qos_pol_action_params_st *a
- = va_arg (*va, sse2_qos_pol_action_params_st *);
+ qos_pol_action_params_st *a = va_arg (*va, qos_pol_action_params_st *);
- if (a->action_type == SSE2_QOS_ACTION_DROP)
+ if (a->action_type == QOS_ACTION_DROP)
s = format (s, "drop");
- else if (a->action_type == SSE2_QOS_ACTION_TRANSMIT)
+ else if (a->action_type == QOS_ACTION_TRANSMIT)
s = format (s, "transmit");
- else if (a->action_type == SSE2_QOS_ACTION_MARK_AND_TRANSMIT)
+ else if (a->action_type == QOS_ACTION_MARK_AND_TRANSMIT)
s = format (s, "mark-and-transmit %U", format_ip_dscp, a->dscp);
else
s = format (s, "ILLEGAL");
@@ -243,7 +240,7 @@ format_policer_action_type (u8 * s, va_list * va)
u8 *
format_policer_config (u8 * s, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
s = format (s, "type %U cir %u eir %u cb %u eb %u\n",
format_policer_type, c,
@@ -261,21 +258,21 @@ format_policer_config (u8 * s, va_list * va)
static uword
unformat_policer_type (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (!unformat (input, "type"))
return 0;
if (unformat (input, "1r2c"))
- c->rfc = SSE2_QOS_POLICER_TYPE_1R2C;
+ c->rfc = QOS_POLICER_TYPE_1R2C;
else if (unformat (input, "1r3c"))
- c->rfc = SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697;
+ c->rfc = QOS_POLICER_TYPE_1R3C_RFC_2697;
else if (unformat (input, "2r3c-2698"))
- c->rfc = SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698;
+ c->rfc = QOS_POLICER_TYPE_2R3C_RFC_2698;
else if (unformat (input, "2r3c-4115"))
- c->rfc = SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115;
+ c->rfc = QOS_POLICER_TYPE_2R3C_RFC_4115;
else if (unformat (input, "2r3c-mef5cf1"))
- c->rfc = SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1;
+ c->rfc = QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1;
else
return 0;
return 1;
@@ -284,17 +281,17 @@ unformat_policer_type (unformat_input_t * input, va_list * va)
static uword
unformat_policer_round_type (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (!unformat (input, "round"))
return 0;
if (unformat (input, "closest"))
- c->rnd_type = SSE2_QOS_ROUND_TO_CLOSEST;
+ c->rnd_type = QOS_ROUND_TO_CLOSEST;
else if (unformat (input, "up"))
- c->rnd_type = SSE2_QOS_ROUND_TO_UP;
+ c->rnd_type = QOS_ROUND_TO_UP;
else if (unformat (input, "down"))
- c->rnd_type = SSE2_QOS_ROUND_TO_DOWN;
+ c->rnd_type = QOS_ROUND_TO_DOWN;
else
return 0;
return 1;
@@ -303,15 +300,15 @@ unformat_policer_round_type (unformat_input_t * input, va_list * va)
static uword
unformat_policer_rate_type (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (!unformat (input, "rate"))
return 0;
if (unformat (input, "kbps"))
- c->rate_type = SSE2_QOS_RATE_KBPS;
+ c->rate_type = QOS_RATE_KBPS;
else if (unformat (input, "pps"))
- c->rate_type = SSE2_QOS_RATE_PPS;
+ c->rate_type = QOS_RATE_PPS;
else
return 0;
return 1;
@@ -320,7 +317,7 @@ unformat_policer_rate_type (unformat_input_t * input, va_list * va)
static uword
unformat_policer_cir (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (unformat (input, "cir %u", &c->rb.kbps.cir_kbps))
return 1;
@@ -330,7 +327,7 @@ unformat_policer_cir (unformat_input_t * input, va_list * va)
static uword
unformat_policer_eir (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (unformat (input, "eir %u", &c->rb.kbps.eir_kbps))
return 1;
@@ -340,7 +337,7 @@ unformat_policer_eir (unformat_input_t * input, va_list * va)
static uword
unformat_policer_cb (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (unformat (input, "cb %u", &c->rb.kbps.cb_bytes))
return 1;
@@ -350,7 +347,7 @@ unformat_policer_cb (unformat_input_t * input, va_list * va)
static uword
unformat_policer_eb (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (unformat (input, "eb %u", &c->rb.kbps.eb_bytes))
return 1;
@@ -360,16 +357,15 @@ unformat_policer_eb (unformat_input_t * input, va_list * va)
static uword
unformat_policer_action_type (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_action_params_st *a
- = va_arg (*va, sse2_qos_pol_action_params_st *);
+ qos_pol_action_params_st *a = va_arg (*va, qos_pol_action_params_st *);
if (unformat (input, "drop"))
- a->action_type = SSE2_QOS_ACTION_DROP;
+ a->action_type = QOS_ACTION_DROP;
else if (unformat (input, "transmit"))
- a->action_type = SSE2_QOS_ACTION_TRANSMIT;
+ a->action_type = QOS_ACTION_TRANSMIT;
else if (unformat (input, "mark-and-transmit %U", unformat_ip_dscp,
&a->dscp))
- a->action_type = SSE2_QOS_ACTION_MARK_AND_TRANSMIT;
+ a->action_type = QOS_ACTION_MARK_AND_TRANSMIT;
else
return 0;
return 1;
@@ -378,7 +374,7 @@ unformat_policer_action_type (unformat_input_t * input, va_list * va)
static uword
unformat_policer_action (unformat_input_t * input, va_list * va)
{
- sse2_qos_pol_cfg_params_st *c = va_arg (*va, sse2_qos_pol_cfg_params_st *);
+ qos_pol_cfg_params_st *c = va_arg (*va, qos_pol_cfg_params_st *);
if (unformat (input, "conform-action %U", unformat_policer_action_type,
&c->conform_action))
@@ -445,7 +441,7 @@ configure_policer_command_fn (vlib_main_t * vm,
unformat_input_t * input,
vlib_cli_command_t * cmd)
{
- sse2_qos_pol_cfg_params_st c;
+ qos_pol_cfg_params_st c;
unformat_input_t _line_input, *line_input = &_line_input;
u8 is_add = 1;
u8 *name = 0;
@@ -504,7 +500,7 @@ show_policer_command_fn (vlib_main_t * vm,
u8 *match_name = 0;
u8 *name;
uword *pi;
- sse2_qos_pol_cfg_params_st *config;
+ qos_pol_cfg_params_st *config;
policer_read_response_type_st *templ;
(void) unformat (input, "name %s", &match_name);
diff --git a/src/vnet/policer/policer.h b/src/vnet/policer/policer.h
index 5253bb6c432..71910c423a6 100644
--- a/src/vnet/policer/policer.h
+++ b/src/vnet/policer/policer.h
@@ -27,7 +27,7 @@ typedef struct
policer_read_response_type_st *policers;
/* config + template h/w policer instance parallel pools */
- sse2_qos_pol_cfg_params_st *configs;
+ qos_pol_cfg_params_st *configs;
policer_read_response_type_st *policer_templates;
/* Config by name hash */
@@ -63,10 +63,9 @@ typedef enum
} vnet_policer_next_t;
u8 *format_policer_instance (u8 * s, va_list * va);
-clib_error_t *policer_add_del (vlib_main_t * vm,
- u8 * name,
- sse2_qos_pol_cfg_params_st * cfg,
- u32 * policer_index, u8 is_add);
+clib_error_t *policer_add_del (vlib_main_t *vm, u8 *name,
+ qos_pol_cfg_params_st *cfg, u32 *policer_index,
+ u8 is_add);
#endif /* __included_policer_h__ */
diff --git a/src/vnet/policer/policer_api.c b/src/vnet/policer/policer_api.c
index b543a3c2e0e..855ebad69e9 100644
--- a/src/vnet/policer/policer_api.c
+++ b/src/vnet/policer/policer_api.c
@@ -53,7 +53,7 @@ vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp)
vl_api_policer_add_del_reply_t *rmp;
int rv = 0;
u8 *name = NULL;
- sse2_qos_pol_cfg_params_st cfg;
+ qos_pol_cfg_params_st cfg;
clib_error_t *error;
u32 policer_index;
@@ -69,13 +69,12 @@ vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp)
cfg.rb.kbps.cb_bytes = clib_net_to_host_u64 (mp->cb);
cfg.rb.kbps.eb_bytes = clib_net_to_host_u64 (mp->eb);
cfg.conform_action.action_type =
- (sse2_qos_action_type_en) mp->conform_action.type;
+ (qos_action_type_en) mp->conform_action.type;
cfg.conform_action.dscp = mp->conform_action.dscp;
- cfg.exceed_action.action_type =
- (sse2_qos_action_type_en) mp->exceed_action.type;
+ cfg.exceed_action.action_type = (qos_action_type_en) mp->exceed_action.type;
cfg.exceed_action.dscp = mp->exceed_action.dscp;
cfg.violate_action.action_type =
- (sse2_qos_action_type_en) mp->violate_action.type;
+ (qos_action_type_en) mp->violate_action.type;
cfg.violate_action.dscp = mp->violate_action.dscp;
cfg.color_aware = mp->color_aware;
@@ -97,10 +96,9 @@ vl_api_policer_add_del_t_handler (vl_api_policer_add_del_t * mp)
}
static void
-send_policer_details (u8 * name,
- sse2_qos_pol_cfg_params_st * config,
- policer_read_response_type_st * templ,
- vl_api_registration_t * reg, u32 context)
+send_policer_details (u8 *name, qos_pol_cfg_params_st *config,
+ policer_read_response_type_st *templ,
+ vl_api_registration_t *reg, u32 context)
{
vl_api_policer_details_t *mp;
@@ -150,7 +148,7 @@ vl_api_policer_dump_t_handler (vl_api_policer_dump_t * mp)
u32 pool_index;
u8 *match_name = 0;
u8 *name;
- sse2_qos_pol_cfg_params_st *config;
+ qos_pol_cfg_params_st *config;
policer_read_response_type_st *templ;
reg = vl_api_client_index_to_registration (mp->client_index);
diff --git a/src/vnet/policer/policer_types.api b/src/vnet/policer/policer_types.api
index d48dc646ed1..3e21b7d707c 100644
--- a/src/vnet/policer/policer_types.api
+++ b/src/vnet/policer/policer_types.api
@@ -46,7 +46,7 @@ enum sse2_qos_action_type : u8
SSE2_QOS_ACTION_API_MARK_AND_TRANSMIT,
};
-/** \brief SSE2 QOS action
+/** \brief QOS action
@param conform_action_type - conform action type
@param conform_dscp - DSCP for conform mark-and-transmit action
*/
diff --git a/src/vnet/policer/xlate.c b/src/vnet/policer/xlate.c
index afc0c05c376..2ef99225017 100644
--- a/src/vnet/policer/xlate.c
+++ b/src/vnet/policer/xlate.c
@@ -28,18 +28,15 @@
#define INTERNAL_SS 1
/* debugs */
-#define SSE2_QOS_DEBUG_ERROR(msg, args...) \
- fformat(stderr, msg "\n", ##args);
+#define QOS_DEBUG_ERROR(msg, args...) fformat (stderr, msg "\n", ##args);
-#define SSE2_QOS_DEBUG_INFO(msg, args...) \
- fformat(stderr, msg "\n", ##args);
+#define QOS_DEBUG_INFO(msg, args...) fformat (stderr, msg "\n", ##args);
-
-#define SSE2_QOS_TR_ERR(TpParms...)
+#define QOS_TR_ERR(TpParms...)
// {
// }
-#define SSE2_QOS_TR_INFO(TpParms...)
+#define QOS_TR_INFO(TpParms...)
#ifndef MIN
#define MIN(x,y) (((x)<(y))?(x):(y))
@@ -117,78 +114,68 @@
/* End of constants copied from sse_ipe_desc_fmt.h */
/* Misc Policer specific definitions */
-#define SSE2_QOS_POLICER_FIXED_PKT_SIZE 256
+#define QOS_POLICER_FIXED_PKT_SIZE 256
// TODO check what can be provided by hw macro based on ASIC
-#define SSE2_QOS_POL_TICKS_PER_SEC 1000LL /* 1 tick = 1 ms */
+#define QOS_POL_TICKS_PER_SEC 1000LL /* 1 tick = 1 ms */
/*
* Default burst, in ms (byte format)
*/
-#define SSE2_QOS_POL_DEF_BURST_BYTE 100
+#define QOS_POL_DEF_BURST_BYTE 100
/*
* Minimum burst needs to be such that the largest packet size is accommodated
*/
// Do we need to get it from some lib?
-#define SSE2_QOS_POL_MIN_BURST_BYTE 9*1024
-
+#define QOS_POL_MIN_BURST_BYTE 9 * 1024
/*
* Flag to indicate if AN is employed or not
* 1 - TRUE, 0 - FALSE
*/
-#define SSE2_QOS_POL_ALLOW_NEGATIVE 1
+#define QOS_POL_ALLOW_NEGATIVE 1
// Various Macros to take care of policer calculations
-#define SSE2_QOS_POL_COMM_BKT_MAX \
- (1<<IPE_POLICER_FULL_WRITE_REQUEST_CB_MASK)
-#define SSE2_QOS_POL_EXTD_BKT_MAX \
- (1<<IPE_POLICER_FULL_WRITE_REQUEST_EB_MASK)
-
-#define SSE2_QOS_POL_RATE_EXP_SIZE \
- (IPE_POLICER_FULL_WRITE_REQUEST_REXP_MASK)
-#define SSE2_QOS_POL_RATE_EXP_MAX ((1<<SSE2_QOS_POL_RATE_EXP_SIZE) - 1)
-#define SSE2_QOS_POL_AVG_RATE_MANT_SIZE \
- (IPE_POLICER_FULL_WRITE_REQUEST_ARM_MASK)
-#define SSE2_QOS_POL_AVG_RATE_MANT_MAX \
- ((1<< SSE2_QOS_POL_AVG_RATE_MANT_SIZE) - 1)
-#define SSE2_QOS_POL_AVG_RATE_MAX \
- (SSE2_QOS_POL_AVG_RATE_MANT_MAX << \
- SSE2_QOS_POL_RATE_EXP_MAX)
-
-#define SSE2_QOS_POL_PEAK_RATE_MANT_SIZE \
- (IPE_POLICER_FULL_WRITE_REQUEST_PRM_MASK)
-#define SSE2_QOS_POL_PEAK_RATE_MANT_MAX \
- ((1<<SSE2_QOS_POL_PEAK_RATE_MANT_SIZE) - 1)
-#define SSE2_QOS_POL_PEAK_RATE_MAX \
- (SSE2_QOS_POL_PEAK_RATE_MANT_MAX << \
- SSE2_QOS_POL_RATE_EXP_MAX)
-
-#define SSE2_QOS_POL_COMM_BKT_LIMIT_MANT_SIZE \
- (IPE_POLICER_FULL_WRITE_REQUEST_CBLM_MASK)
-#define SSE2_QOS_POL_COMM_BKT_LIMIT_MANT_MAX \
- ((1<<SSE2_QOS_POL_COMM_BKT_LIMIT_MANT_SIZE) - 1)
-#define SSE2_QOS_POL_COMM_BKT_LIMIT_EXP_SIZE \
- (IPE_POLICER_FULL_WRITE_REQUEST_CBLE_MASK)
-#define SSE2_QOS_POL_COMM_BKT_LIMIT_EXP_MAX \
- ((1<<SSE2_QOS_POL_COMM_BKT_LIMIT_EXP_SIZE) - 1)
-#define SSE2_QOS_POL_COMM_BKT_LIMIT_MAX \
- ((u64)SSE2_QOS_POL_COMM_BKT_LIMIT_MANT_MAX << \
- (u64)SSE2_QOS_POL_COMM_BKT_LIMIT_EXP_MAX)
-
-#define SSE2_QOS_POL_EXTD_BKT_LIMIT_MANT_SIZE \
- (IPE_POLICER_FULL_WRITE_REQUEST_EBLM_MASK)
-#define SSE2_QOS_POL_EXTD_BKT_LIMIT_MANT_MAX \
- ((1<<SSE2_QOS_POL_EXTD_BKT_LIMIT_MANT_SIZE) - 1)
-#define SSE2_QOS_POL_EXTD_BKT_LIMIT_EXP_SIZE \
- (IPE_POLICER_FULL_WRITE_REQUEST_EBLE_MASK)
-#define SSE2_QOS_POL_EXTD_BKT_LIMIT_EXP_MAX \
- ((1<<SSE2_QOS_POL_EXTD_BKT_LIMIT_EXP_SIZE) - 1)
-#define SSE2_QOS_POL_EXT_BKT_LIMIT_MAX \
- ((u64)SSE2_QOS_POL_EXTD_BKT_LIMIT_MANT_MAX << \
- (u64)SSE2_QOS_POL_EXTD_BKT_LIMIT_EXP_MAX)
+#define QOS_POL_COMM_BKT_MAX (1 << IPE_POLICER_FULL_WRITE_REQUEST_CB_MASK)
+#define QOS_POL_EXTD_BKT_MAX (1 << IPE_POLICER_FULL_WRITE_REQUEST_EB_MASK)
+
+#define QOS_POL_RATE_EXP_SIZE (IPE_POLICER_FULL_WRITE_REQUEST_REXP_MASK)
+#define QOS_POL_RATE_EXP_MAX ((1 << QOS_POL_RATE_EXP_SIZE) - 1)
+#define QOS_POL_AVG_RATE_MANT_SIZE (IPE_POLICER_FULL_WRITE_REQUEST_ARM_MASK)
+#define QOS_POL_AVG_RATE_MANT_MAX ((1 << QOS_POL_AVG_RATE_MANT_SIZE) - 1)
+#define QOS_POL_AVG_RATE_MAX \
+ (QOS_POL_AVG_RATE_MANT_MAX << QOS_POL_RATE_EXP_MAX)
+
+#define QOS_POL_PEAK_RATE_MANT_SIZE (IPE_POLICER_FULL_WRITE_REQUEST_PRM_MASK)
+#define QOS_POL_PEAK_RATE_MANT_MAX ((1 << QOS_POL_PEAK_RATE_MANT_SIZE) - 1)
+#define QOS_POL_PEAK_RATE_MAX \
+ (QOS_POL_PEAK_RATE_MANT_MAX << QOS_POL_RATE_EXP_MAX)
+
+#define QOS_POL_COMM_BKT_LIMIT_MANT_SIZE \
+ (IPE_POLICER_FULL_WRITE_REQUEST_CBLM_MASK)
+#define QOS_POL_COMM_BKT_LIMIT_MANT_MAX \
+ ((1 << QOS_POL_COMM_BKT_LIMIT_MANT_SIZE) - 1)
+#define QOS_POL_COMM_BKT_LIMIT_EXP_SIZE \
+ (IPE_POLICER_FULL_WRITE_REQUEST_CBLE_MASK)
+#define QOS_POL_COMM_BKT_LIMIT_EXP_MAX \
+ ((1 << QOS_POL_COMM_BKT_LIMIT_EXP_SIZE) - 1)
+#define QOS_POL_COMM_BKT_LIMIT_MAX \
+ ((u64) QOS_POL_COMM_BKT_LIMIT_MANT_MAX \
+ << (u64) QOS_POL_COMM_BKT_LIMIT_EXP_MAX)
+
+#define QOS_POL_EXTD_BKT_LIMIT_MANT_SIZE \
+ (IPE_POLICER_FULL_WRITE_REQUEST_EBLM_MASK)
+#define QOS_POL_EXTD_BKT_LIMIT_MANT_MAX \
+ ((1 << QOS_POL_EXTD_BKT_LIMIT_MANT_SIZE) - 1)
+#define QOS_POL_EXTD_BKT_LIMIT_EXP_SIZE \
+ (IPE_POLICER_FULL_WRITE_REQUEST_EBLE_MASK)
+#define QOS_POL_EXTD_BKT_LIMIT_EXP_MAX \
+ ((1 << QOS_POL_EXTD_BKT_LIMIT_EXP_SIZE) - 1)
+#define QOS_POL_EXT_BKT_LIMIT_MAX \
+ ((u64) QOS_POL_EXTD_BKT_LIMIT_MANT_MAX \
+ << (u64) QOS_POL_EXTD_BKT_LIMIT_EXP_MAX)
/*
* Rates determine the units of the bucket
@@ -199,35 +186,34 @@
*
* The code uses bytes per tick as oppose to Gigabits per second.
*/
-#define RATE256 (256114688000LL / 8LL / SSE2_QOS_POL_TICKS_PER_SEC)
-#define RATE128 (128057344000LL / 8LL / SSE2_QOS_POL_TICKS_PER_SEC)
-#define RATE64 ( 64028672000LL / 8LL / SSE2_QOS_POL_TICKS_PER_SEC)
+#define RATE256 (256114688000LL / 8LL / QOS_POL_TICKS_PER_SEC)
+#define RATE128 (128057344000LL / 8LL / QOS_POL_TICKS_PER_SEC)
+#define RATE64 (64028672000LL / 8LL / QOS_POL_TICKS_PER_SEC)
#define RATE_OVER256_UNIT 8LL
#define RATE_128TO256_UNIT 4LL
#define RATE_64TO128_UNIT 2LL
static int
-sse2_qos_pol_round (u64 numerator,
- u64 denominator,
- u64 * rounded_value, sse2_qos_round_type_en round_type)
+qos_pol_round (u64 numerator, u64 denominator, u64 *rounded_value,
+ qos_round_type_en round_type)
{
int rc = 0;
if (denominator == 0)
{
- SSE2_QOS_DEBUG_ERROR ("Illegal denominator");
- SSE2_QOS_TR_ERR (SSE2_QOSRM_TP_ERR_59);
+ QOS_DEBUG_ERROR ("Illegal denominator");
+ QOS_TR_ERR (QOSRM_TP_ERR_59);
return (EINVAL);
}
switch (round_type)
{
- case SSE2_QOS_ROUND_TO_CLOSEST:
+ case QOS_ROUND_TO_CLOSEST:
*rounded_value = ((numerator + (denominator >> 1)) / denominator);
break;
- case SSE2_QOS_ROUND_TO_UP:
+ case QOS_ROUND_TO_UP:
*rounded_value = (numerator / denominator);
if ((*rounded_value * denominator) < numerator)
{
@@ -235,35 +221,33 @@ sse2_qos_pol_round (u64 numerator,
}
break;
- case SSE2_QOS_ROUND_TO_DOWN:
+ case QOS_ROUND_TO_DOWN:
*rounded_value = (numerator / denominator);
break;
- case SSE2_QOS_ROUND_INVALID:
+ case QOS_ROUND_INVALID:
default:
- SSE2_QOS_DEBUG_ERROR ("Illegal round type");
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_60, round_type);
+ QOS_DEBUG_ERROR ("Illegal round type");
+ QOS_TR_ERR (QOS_TP_ERR_60, round_type);
rc = EINVAL;
break;
}
return (rc);
}
-
static int
-sse2_pol_validate_cfg_params (sse2_qos_pol_cfg_params_st * cfg)
+pol_validate_cfg_params (qos_pol_cfg_params_st *cfg)
{
u64 numer, denom, rnd_value;
u32 cir_hw, eir_hw;
int rc = 0;
- if ((cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698) &&
+ if ((cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_2698) &&
(cfg->rb.kbps.eir_kbps < cfg->rb.kbps.cir_kbps))
{
- SSE2_QOS_DEBUG_ERROR ("CIR (%u kbps) is greater than PIR (%u kbps)",
- cfg->rb.kbps.cir_kbps, cfg->rb.kbps.eir_kbps);
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_39, cfg->rb.kbps.cir_kbps,
- cfg->rb.kbps.eir_kbps);
+ QOS_DEBUG_ERROR ("CIR (%u kbps) is greater than PIR (%u kbps)",
+ cfg->rb.kbps.cir_kbps, cfg->rb.kbps.eir_kbps);
+ QOS_TR_ERR (QOS_TP_ERR_39, cfg->rb.kbps.cir_kbps, cfg->rb.kbps.eir_kbps);
return (EINVAL);
}
@@ -271,45 +255,44 @@ sse2_pol_validate_cfg_params (sse2_qos_pol_cfg_params_st * cfg)
* convert rates to bytes-per-tick
*/
numer = (u64) (cfg->rb.kbps.cir_kbps);
- denom = (u64) (8 * SSE2_QOS_POL_TICKS_PER_SEC) / 1000;
- rc = sse2_qos_pol_round (numer, denom, &rnd_value,
- (sse2_qos_round_type_en) cfg->rnd_type);
+ denom = (u64) (8 * QOS_POL_TICKS_PER_SEC) / 1000;
+ rc = qos_pol_round (numer, denom, &rnd_value,
+ (qos_round_type_en) cfg->rnd_type);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to convert CIR to bytes/tick format");
+ QOS_DEBUG_ERROR ("Unable to convert CIR to bytes/tick format");
// Error traced
return (rc);
}
cir_hw = (u32) rnd_value;
numer = (u64) (cfg->rb.kbps.eir_kbps);
- rc = sse2_qos_pol_round (numer, denom, &rnd_value,
- (sse2_qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round (numer, denom, &rnd_value,
+ (qos_round_type_en) cfg->rnd_type);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to convert EIR to bytes/tick format");
+ QOS_DEBUG_ERROR ("Unable to convert EIR to bytes/tick format");
// Error traced
return (rc);
}
eir_hw = (u32) rnd_value;
- if (cir_hw > SSE2_QOS_POL_AVG_RATE_MAX)
+ if (cir_hw > QOS_POL_AVG_RATE_MAX)
{
- SSE2_QOS_DEBUG_ERROR ("hw cir (%u bytes/tick) is greater than the "
- "max supported value (%u)", cir_hw,
- SSE2_QOS_POL_AVG_RATE_MAX);
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_84, cir_hw, SSE2_QOS_POL_AVG_RATE_MAX);
+ QOS_DEBUG_ERROR ("hw cir (%u bytes/tick) is greater than the "
+ "max supported value (%u)",
+ cir_hw, QOS_POL_AVG_RATE_MAX);
+ QOS_TR_ERR (QOS_TP_ERR_84, cir_hw, QOS_POL_AVG_RATE_MAX);
return (EINVAL);
}
- if (eir_hw > SSE2_QOS_POL_PEAK_RATE_MAX)
+ if (eir_hw > QOS_POL_PEAK_RATE_MAX)
{
- SSE2_QOS_DEBUG_ERROR ("hw eir (%u bytes/tick) is greater than the "
- "max supported value (%u). Capping it to the max. "
- "supported value", eir_hw,
- SSE2_QOS_POL_PEAK_RATE_MAX);
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_85, eir_hw,
- SSE2_QOS_POL_PEAK_RATE_MAX);
+ QOS_DEBUG_ERROR ("hw eir (%u bytes/tick) is greater than the "
+ "max supported value (%u). Capping it to the max. "
+ "supported value",
+ eir_hw, QOS_POL_PEAK_RATE_MAX);
+ QOS_TR_ERR (QOS_TP_ERR_85, eir_hw, QOS_POL_PEAK_RATE_MAX);
return (EINVAL);
}
/*
@@ -317,32 +300,31 @@ sse2_pol_validate_cfg_params (sse2_qos_pol_cfg_params_st * cfg)
*/
if ((cfg->rb.kbps.cir_kbps == 0) && cfg->rb.kbps.cb_bytes)
{
- SSE2_QOS_DEBUG_ERROR ("CIR = 0 with bc != 0");
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_55);
+ QOS_DEBUG_ERROR ("CIR = 0 with bc != 0");
+ QOS_TR_ERR (QOS_TP_ERR_55);
return (EINVAL);
}
if ((cfg->rb.kbps.eir_kbps == 0) &&
- (cfg->rfc > SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697))
+ (cfg->rfc > QOS_POLICER_TYPE_1R3C_RFC_2697))
{
- SSE2_QOS_DEBUG_ERROR ("EIR = 0 for a 2R3C policer (rfc: %u)", cfg->rfc);
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_23, cfg->rb.kbps.eir_kbps, cfg->rfc);
+ QOS_DEBUG_ERROR ("EIR = 0 for a 2R3C policer (rfc: %u)", cfg->rfc);
+ QOS_TR_ERR (QOS_TP_ERR_23, cfg->rb.kbps.eir_kbps, cfg->rfc);
return (EINVAL);
}
- if (cfg->rb.kbps.eir_kbps &&
- (cfg->rfc < SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698))
+ if (cfg->rb.kbps.eir_kbps && (cfg->rfc < QOS_POLICER_TYPE_2R3C_RFC_2698))
{
- SSE2_QOS_DEBUG_ERROR ("EIR: %u kbps for a 1-rate policer (rfc: %u)",
- cfg->rb.kbps.eir_kbps, cfg->rfc);
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_23, cfg->rb.kbps.eir_kbps, cfg->rfc);
+ QOS_DEBUG_ERROR ("EIR: %u kbps for a 1-rate policer (rfc: %u)",
+ cfg->rb.kbps.eir_kbps, cfg->rfc);
+ QOS_TR_ERR (QOS_TP_ERR_23, cfg->rb.kbps.eir_kbps, cfg->rfc);
return (EINVAL);
}
- if ((cfg->rfc == SSE2_QOS_POLICER_TYPE_1R2C) && cfg->rb.kbps.eb_bytes)
+ if ((cfg->rfc == QOS_POLICER_TYPE_1R2C) && cfg->rb.kbps.eb_bytes)
{
- SSE2_QOS_DEBUG_ERROR ("For a 1R1B policer, EB burst cannot be > 0");
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_56);
+ QOS_DEBUG_ERROR ("For a 1R1B policer, EB burst cannot be > 0");
+ QOS_TR_ERR (QOS_TP_ERR_56);
return (EINVAL);
}
@@ -350,11 +332,9 @@ sse2_pol_validate_cfg_params (sse2_qos_pol_cfg_params_st * cfg)
}
static void
-sse2_qos_convert_value_to_exp_mant_fmt (u64 value,
- u16 max_exp_value,
- u16 max_mant_value,
- sse2_qos_round_type_en type,
- u8 * exp, u32 * mant)
+qos_convert_value_to_exp_mant_fmt (u64 value, u16 max_exp_value,
+ u16 max_mant_value, qos_round_type_en type,
+ u8 *exp, u32 *mant)
{
u64 rnd_value;
u64 temp_mant;
@@ -374,8 +354,8 @@ sse2_qos_convert_value_to_exp_mant_fmt (u64 value,
temp_exp++;
rnd_value = 0;
- (void) sse2_qos_pol_round ((u64) value, (u64) (1 << temp_exp),
- &rnd_value, type);
+ (void) qos_pol_round ((u64) value, (u64) (1 << temp_exp), &rnd_value,
+ type);
temp_mant = rnd_value;
}
@@ -391,14 +371,13 @@ sse2_qos_convert_value_to_exp_mant_fmt (u64 value,
*exp = temp_exp;
*mant = (u32) temp_mant;
- SSE2_QOS_DEBUG_INFO ("value: 0x%llx, mant: %u, exp: %u", value, *mant,
- *exp);
+ QOS_DEBUG_INFO ("value: 0x%llx, mant: %u, exp: %u", value, *mant, *exp);
return;
}
static int
-sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
- sse2_qos_pol_hw_params_st * hw)
+pol_convert_cfg_rates_to_hw (qos_pol_cfg_params_st *cfg,
+ qos_pol_hw_params_st *hw)
{
int rc = 0;
u32 cir_hw, eir_hw, hi_mant, hi_rate, cir_rnded, eir_rnded, eir_kbps;
@@ -409,15 +388,14 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
* convert rates to bytes-per-tick (tick is 1ms)
* For rate conversion, the denominator is gonna be the same
*/
- denom = (u64) ((SSE2_QOS_POL_TICKS_PER_SEC * 8) / 1000);
+ denom = (u64) ((QOS_POL_TICKS_PER_SEC * 8) / 1000);
numer = (u64) (cfg->rb.kbps.cir_kbps);
- rc = sse2_qos_pol_round (numer, denom, &rnd_value,
- (sse2_qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round (numer, denom, &rnd_value,
+ (qos_round_type_en) cfg->rnd_type);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR
- ("Rounding error, rate: %d kbps, rounding_type: %d",
- cfg->rb.kbps.cir_kbps, cfg->rnd_type);
+ QOS_DEBUG_ERROR ("Rounding error, rate: %d kbps, rounding_type: %d",
+ cfg->rb.kbps.cir_kbps, cfg->rnd_type);
// Error is traced
return (rc);
}
@@ -431,15 +409,15 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
cir_hw = 1;
}
- if (cfg->rfc == SSE2_QOS_POLICER_TYPE_1R2C)
+ if (cfg->rfc == QOS_POLICER_TYPE_1R2C)
{
eir_kbps = 0;
}
- else if (cfg->rfc == SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697)
+ else if (cfg->rfc == QOS_POLICER_TYPE_1R3C_RFC_2697)
{
eir_kbps = cfg->rb.kbps.cir_kbps;
}
- else if (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115)
+ else if (cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_4115)
{
eir_kbps = cfg->rb.kbps.eir_kbps - cfg->rb.kbps.cir_kbps;
}
@@ -449,13 +427,12 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
}
numer = (u64) eir_kbps;
- rc = sse2_qos_pol_round (numer, denom, &rnd_value,
- (sse2_qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round (numer, denom, &rnd_value,
+ (qos_round_type_en) cfg->rnd_type);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR
- ("Rounding error, rate: %d kbps, rounding_type: %d", eir_kbps,
- cfg->rnd_type);
+ QOS_DEBUG_ERROR ("Rounding error, rate: %d kbps, rounding_type: %d",
+ eir_kbps, cfg->rnd_type);
// Error is traced
return (rc);
}
@@ -469,8 +446,8 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
eir_hw = 1;
}
- SSE2_QOS_DEBUG_INFO ("cir_hw: %u bytes/tick, eir_hw: %u bytes/tick", cir_hw,
- eir_hw);
+ QOS_DEBUG_INFO ("cir_hw: %u bytes/tick, eir_hw: %u bytes/tick", cir_hw,
+ eir_hw);
if (cir_hw > eir_hw)
{
@@ -487,39 +464,36 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
* Both the rates are 0. Use exp = 15, and set the RFC to 4115. Also
* set AN = 0
*/
- exp = (u8) SSE2_QOS_POL_RATE_EXP_MAX;
+ exp = (u8) QOS_POL_RATE_EXP_MAX;
hi_mant = 0;
hw->rfc = IPE_RFC_RFC4115;
hw->allow_negative = 0;
}
else
{
- sse2_qos_convert_value_to_exp_mant_fmt (hi_rate,
- (u16) SSE2_QOS_POL_RATE_EXP_MAX,
- (u16)
- SSE2_QOS_POL_AVG_RATE_MANT_MAX,
- (sse2_qos_round_type_en)
- cfg->rnd_type, &exp, &hi_mant);
+ qos_convert_value_to_exp_mant_fmt (
+ hi_rate, (u16) QOS_POL_RATE_EXP_MAX, (u16) QOS_POL_AVG_RATE_MANT_MAX,
+ (qos_round_type_en) cfg->rnd_type, &exp, &hi_mant);
}
denom = (1ULL << exp);
if (hi_rate == eir_hw)
{
hw->peak_rate_man = (u16) hi_mant;
- rc = sse2_qos_pol_round ((u64) cir_hw, denom, &rnd_value,
- (sse2_qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round ((u64) cir_hw, denom, &rnd_value,
+ (qos_round_type_en) cfg->rnd_type);
hw->avg_rate_man = (u16) rnd_value;
}
else
{
hw->avg_rate_man = (u16) hi_mant;
- rc = sse2_qos_pol_round ((u64) eir_hw, denom, &rnd_value,
- (sse2_qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round ((u64) eir_hw, denom, &rnd_value,
+ (qos_round_type_en) cfg->rnd_type);
hw->peak_rate_man = (u16) rnd_value;
}
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Rounding error");
+ QOS_DEBUG_ERROR ("Rounding error");
// Error is traced
return (rc);
}
@@ -531,8 +505,9 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
* cir was reduced to 0 during rounding. Bump it up
*/
hw->avg_rate_man = 1;
- SSE2_QOS_DEBUG_INFO ("CIR = 0 during rounding. Bump it up to %u "
- "bytes/tick", (hw->avg_rate_man << hw->rate_exp));
+ QOS_DEBUG_INFO ("CIR = 0 during rounding. Bump it up to %u "
+ "bytes/tick",
+ (hw->avg_rate_man << hw->rate_exp));
}
if ((hw->peak_rate_man == 0) && eir_kbps)
@@ -541,29 +516,30 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
* eir was reduced to 0 during rounding. Bump it up
*/
hw->peak_rate_man = 1;
- SSE2_QOS_DEBUG_INFO ("EIR = 0 during rounding. Bump it up to %u "
- "bytes/tick", (hw->peak_rate_man << hw->rate_exp));
+ QOS_DEBUG_INFO ("EIR = 0 during rounding. Bump it up to %u "
+ "bytes/tick",
+ (hw->peak_rate_man << hw->rate_exp));
}
cir_rnded = (hw->avg_rate_man << hw->rate_exp);
eir_rnded = (hw->peak_rate_man << hw->rate_exp);
- SSE2_QOS_DEBUG_INFO ("Configured(rounded) values, cir: %u "
- "kbps (mant: %u, exp: %u, rate: %u bytes/tick)",
- cfg->rb.kbps.cir_kbps, hw->avg_rate_man,
- hw->rate_exp, cir_rnded);
+ QOS_DEBUG_INFO ("Configured(rounded) values, cir: %u "
+ "kbps (mant: %u, exp: %u, rate: %u bytes/tick)",
+ cfg->rb.kbps.cir_kbps, hw->avg_rate_man, hw->rate_exp,
+ cir_rnded);
- SSE2_QOS_DEBUG_INFO ("Configured(rounded) values, eir: %u "
- "kbps (mant: %u, exp: %u, rate: %u bytes/tick)",
- cfg->rb.kbps.eir_kbps, hw->peak_rate_man,
- hw->rate_exp, eir_rnded);
+ QOS_DEBUG_INFO ("Configured(rounded) values, eir: %u "
+ "kbps (mant: %u, exp: %u, rate: %u bytes/tick)",
+ cfg->rb.kbps.eir_kbps, hw->peak_rate_man, hw->rate_exp,
+ eir_rnded);
return (rc);
}
/*****
* NAME
- * sse2_pol_get_bkt_max
+ * pol_get_bkt_max
*
* PARAMETERS
* rate_hw - either the average rate or peak rate
@@ -582,7 +558,7 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg,
* bytes based on the rate.
*****/
u64
-sse2_pol_get_bkt_max (u64 rate_hw, u64 bkt_max)
+pol_get_bkt_max (u64 rate_hw, u64 bkt_max)
{
if (rate_hw <= RATE64)
{
@@ -602,7 +578,7 @@ sse2_pol_get_bkt_max (u64 rate_hw, u64 bkt_max)
/*****
* NAME
- * sse2_pol_get_bkt_value
+ * pol_get_bkt_value
*
* PARAMETERS
* rate_hw - either the average rate or peak rate
@@ -620,7 +596,7 @@ sse2_pol_get_bkt_max (u64 rate_hw, u64 bkt_max)
* be divided by the units of either 1,2,4,8 bytes based on the rate.
*****/
u64
-sse2_pol_get_bkt_value (u64 rate_hw, u64 byte_value)
+pol_get_bkt_value (u64 rate_hw, u64 byte_value)
{
if (rate_hw <= RATE64)
{
@@ -639,12 +615,9 @@ sse2_pol_get_bkt_value (u64 rate_hw, u64 byte_value)
}
static void
-sse2_pol_rnd_burst_byte_fmt (u64 cfg_burst,
- u16 max_exp_value,
- u16 max_mant_value,
- u32 max_bkt_value,
- u32 rate_hw,
- u8 * exp, u32 * mant, u32 * bkt_value)
+pol_rnd_burst_byte_fmt (u64 cfg_burst, u16 max_exp_value, u16 max_mant_value,
+ u32 max_bkt_value, u32 rate_hw, u8 *exp, u32 *mant,
+ u32 *bkt_value)
{
u64 bkt_max = max_bkt_value;
u64 bkt_limit_max;
@@ -652,7 +625,7 @@ sse2_pol_rnd_burst_byte_fmt (u64 cfg_burst,
u64 temp_bkt_value;
bkt_limit_max = ((u64) max_mant_value << (u64) max_exp_value);
- bkt_max = sse2_pol_get_bkt_max (rate_hw, bkt_max);
+ bkt_max = pol_get_bkt_max (rate_hw, bkt_max);
bkt_max = MIN (bkt_max, bkt_limit_max);
if (!cfg_burst)
{
@@ -660,47 +633,45 @@ sse2_pol_rnd_burst_byte_fmt (u64 cfg_burst,
* If configured burst = 0, compute the burst to be 100ms at a given
* rate. Note that for rate_hw = 0, exp = mant = 0.
*/
- cfg_burst = (u64) rate_hw *(u64) SSE2_QOS_POL_DEF_BURST_BYTE;
+ cfg_burst = (u64) rate_hw * (u64) QOS_POL_DEF_BURST_BYTE;
}
if (cfg_burst > bkt_max)
{
- SSE2_QOS_DEBUG_ERROR ("burst 0x%llx bytes is greater than the max. "
- "supported value 0x%llx bytes. Capping it to the "
- "max", cfg_burst, bkt_max);
- SSE2_QOS_TR_INFO (SSE2_QOS_TP_INFO_38,
- (uint) cfg_burst, (uint) bkt_max);
+ QOS_DEBUG_ERROR ("burst 0x%llx bytes is greater than the max. "
+ "supported value 0x%llx bytes. Capping it to the "
+ "max",
+ cfg_burst, bkt_max);
+ QOS_TR_INFO (QOS_TP_INFO_38, (uint) cfg_burst, (uint) bkt_max);
cfg_burst = bkt_max;
}
- if (cfg_burst < SSE2_QOS_POL_MIN_BURST_BYTE)
+ if (cfg_burst < QOS_POL_MIN_BURST_BYTE)
{
/*
* Bump up the burst value ONLY if the cfg_burst is non-zero AND
* less than the min. supported value
*/
- SSE2_QOS_DEBUG_INFO ("burst 0x%llx bytes is less than the min "
- "supported value %u bytes. Rounding it up to "
- "the min", cfg_burst, SSE2_QOS_POL_MIN_BURST_BYTE);
- SSE2_QOS_TR_INFO (SSE2_QOS_TP_INFO_39, (uint) cfg_burst,
- SSE2_QOS_POL_MIN_BURST_BYTE);
- cfg_burst = SSE2_QOS_POL_MIN_BURST_BYTE;
+ QOS_DEBUG_INFO ("burst 0x%llx bytes is less than the min "
+ "supported value %u bytes. Rounding it up to "
+ "the min",
+ cfg_burst, QOS_POL_MIN_BURST_BYTE);
+ QOS_TR_INFO (QOS_TP_INFO_39, (uint) cfg_burst, QOS_POL_MIN_BURST_BYTE);
+ cfg_burst = QOS_POL_MIN_BURST_BYTE;
}
- sse2_qos_convert_value_to_exp_mant_fmt (cfg_burst,
- max_exp_value,
- max_mant_value,
- SSE2_QOS_ROUND_TO_DOWN, exp, mant);
+ qos_convert_value_to_exp_mant_fmt (cfg_burst, max_exp_value, max_mant_value,
+ QOS_ROUND_TO_DOWN, exp, mant);
/* Bucket value is based on rate. */
rnd_burst = ((u64) (*mant) << (u64) (*exp));
- temp_bkt_value = sse2_pol_get_bkt_value (rate_hw, rnd_burst);
+ temp_bkt_value = pol_get_bkt_value (rate_hw, rnd_burst);
*bkt_value = (u32) temp_bkt_value;
}
static int
-sse2_pol_convert_cfg_burst_to_hw (sse2_qos_pol_cfg_params_st * cfg,
- sse2_qos_pol_hw_params_st * hw)
+pol_convert_cfg_burst_to_hw (qos_pol_cfg_params_st *cfg,
+ qos_pol_hw_params_st *hw)
{
u8 temp_exp;
u32 temp_mant, rate_hw;
@@ -710,17 +681,16 @@ sse2_pol_convert_cfg_burst_to_hw (sse2_qos_pol_cfg_params_st * cfg,
/*
* compute Committed Burst
*/
- SSE2_QOS_DEBUG_INFO ("Compute commit burst ...");
+ QOS_DEBUG_INFO ("Compute commit burst ...");
rate_hw = (hw->avg_rate_man) << (hw->rate_exp);
- sse2_pol_rnd_burst_byte_fmt (cfg->rb.kbps.cb_bytes,
- (u16) SSE2_QOS_POL_COMM_BKT_LIMIT_EXP_MAX,
- (u16) SSE2_QOS_POL_COMM_BKT_LIMIT_MANT_MAX,
- (u32) SSE2_QOS_POL_COMM_BKT_MAX,
- rate_hw, &temp_exp, &temp_mant, &bkt_value);
- SSE2_QOS_DEBUG_INFO ("Committed burst, burst_limit: 0x%llx mant : %u, "
- "exp: %u, rnded: 0x%llx cb:%u bytes",
- cfg->rb.kbps.cb_bytes, temp_mant, temp_exp,
- ((u64) temp_mant << (u64) temp_exp), bkt_value);
+ pol_rnd_burst_byte_fmt (
+ cfg->rb.kbps.cb_bytes, (u16) QOS_POL_COMM_BKT_LIMIT_EXP_MAX,
+ (u16) QOS_POL_COMM_BKT_LIMIT_MANT_MAX, (u32) QOS_POL_COMM_BKT_MAX, rate_hw,
+ &temp_exp, &temp_mant, &bkt_value);
+ QOS_DEBUG_INFO ("Committed burst, burst_limit: 0x%llx mant : %u, "
+ "exp: %u, rnded: 0x%llx cb:%u bytes",
+ cfg->rb.kbps.cb_bytes, temp_mant, temp_exp,
+ ((u64) temp_mant << (u64) temp_exp), bkt_value);
hw->comm_bkt_limit_exp = temp_exp;
hw->comm_bkt_limit_man = (u8) temp_mant;
@@ -729,33 +699,32 @@ sse2_pol_convert_cfg_burst_to_hw (sse2_qos_pol_cfg_params_st * cfg,
/*
* compute Exceed Burst
*/
- SSE2_QOS_DEBUG_INFO ("Compute exceed burst ...");
+ QOS_DEBUG_INFO ("Compute exceed burst ...");
- if (cfg->rfc == SSE2_QOS_POLICER_TYPE_1R2C)
+ if (cfg->rfc == QOS_POLICER_TYPE_1R2C)
{
/*
* For 1R2C, hw uses 2R3C (RFC-4115). As such, the Exceed Bucket
* params are set to 0. Recommendation is to use EB_exp = max_exp (=15)
* and EB_mant = 0
*/
- hw->extd_bkt_limit_exp = (u8) SSE2_QOS_POL_EXTD_BKT_LIMIT_EXP_MAX;
+ hw->extd_bkt_limit_exp = (u8) QOS_POL_EXTD_BKT_LIMIT_EXP_MAX;
hw->extd_bkt_limit_man = 0;
- SSE2_QOS_DEBUG_INFO ("Excess burst, burst: 0x%llx mant: %u, "
- "exp: %u, rnded: 0x%llx bytes",
- cfg->rb.kbps.eb_bytes, hw->extd_bkt_limit_man,
- hw->extd_bkt_limit_exp,
- ((u64) hw->extd_bkt_limit_man <<
- (u64) hw->extd_bkt_limit_exp));
- SSE2_QOS_TR_INFO (SSE2_QOS_TP_INFO_20, (uint) cfg->rb.kbps.eb_bytes,
- hw->extd_bkt_limit_man, hw->extd_bkt_limit_exp);
+ QOS_DEBUG_INFO (
+ "Excess burst, burst: 0x%llx mant: %u, "
+ "exp: %u, rnded: 0x%llx bytes",
+ cfg->rb.kbps.eb_bytes, hw->extd_bkt_limit_man, hw->extd_bkt_limit_exp,
+ ((u64) hw->extd_bkt_limit_man << (u64) hw->extd_bkt_limit_exp));
+ QOS_TR_INFO (QOS_TP_INFO_20, (uint) cfg->rb.kbps.eb_bytes,
+ hw->extd_bkt_limit_man, hw->extd_bkt_limit_exp);
return (0);
}
- if (cfg->rfc == SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697)
+ if (cfg->rfc == QOS_POLICER_TYPE_1R3C_RFC_2697)
{
eb_bytes = cfg->rb.kbps.cb_bytes + cfg->rb.kbps.eb_bytes;
}
- else if (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115)
+ else if (cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_4115)
{
eb_bytes = cfg->rb.kbps.eb_bytes - cfg->rb.kbps.cb_bytes;
}
@@ -765,16 +734,15 @@ sse2_pol_convert_cfg_burst_to_hw (sse2_qos_pol_cfg_params_st * cfg,
}
rate_hw = (hw->peak_rate_man) << (hw->rate_exp);
- sse2_pol_rnd_burst_byte_fmt (eb_bytes,
- (u16) SSE2_QOS_POL_EXTD_BKT_LIMIT_EXP_MAX,
- (u16) SSE2_QOS_POL_EXTD_BKT_LIMIT_MANT_MAX,
- (u32) SSE2_QOS_POL_EXTD_BKT_MAX,
- rate_hw, &temp_exp, &temp_mant, &bkt_value);
+ pol_rnd_burst_byte_fmt (eb_bytes, (u16) QOS_POL_EXTD_BKT_LIMIT_EXP_MAX,
+ (u16) QOS_POL_EXTD_BKT_LIMIT_MANT_MAX,
+ (u32) QOS_POL_EXTD_BKT_MAX, rate_hw, &temp_exp,
+ &temp_mant, &bkt_value);
- SSE2_QOS_DEBUG_INFO ("Excess burst, burst_limit: 0x%llx mant: %u, "
- "exp: %u, rnded: 0x%llx eb:%u bytes",
- cfg->rb.kbps.eb_bytes, temp_mant, temp_exp,
- ((u64) temp_mant << (u64) temp_exp), bkt_value);
+ QOS_DEBUG_INFO ("Excess burst, burst_limit: 0x%llx mant: %u, "
+ "exp: %u, rnded: 0x%llx eb:%u bytes",
+ cfg->rb.kbps.eb_bytes, temp_mant, temp_exp,
+ ((u64) temp_mant << (u64) temp_exp), bkt_value);
hw->extd_bkt_limit_exp = (u8) temp_exp;
hw->extd_bkt_limit_man = (u8) temp_mant;
@@ -790,56 +758,54 @@ sse2_pol_convert_cfg_burst_to_hw (sse2_qos_pol_cfg_params_st * cfg,
* Return: success or failure code.
*/
static int
-sse2_pol_convert_cfg_to_hw_params (sse2_qos_pol_cfg_params_st * cfg,
- sse2_qos_pol_hw_params_st * hw)
+pol_convert_cfg_to_hw_params (qos_pol_cfg_params_st *cfg,
+ qos_pol_hw_params_st *hw)
{
int rc = 0;
/*
* clear the hw_params
*/
- clib_memset (hw, 0, sizeof (sse2_qos_pol_hw_params_st));
+ clib_memset (hw, 0, sizeof (qos_pol_hw_params_st));
- hw->allow_negative = SSE2_QOS_POL_ALLOW_NEGATIVE;
+ hw->allow_negative = QOS_POL_ALLOW_NEGATIVE;
- if ((cfg->rfc == SSE2_QOS_POLICER_TYPE_1R2C) ||
- (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115))
+ if ((cfg->rfc == QOS_POLICER_TYPE_1R2C) ||
+ (cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_4115))
{
hw->rfc = IPE_RFC_RFC4115;
}
- else if (cfg->rfc == SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697)
+ else if (cfg->rfc == QOS_POLICER_TYPE_1R3C_RFC_2697)
{
hw->rfc = IPE_RFC_RFC2697;
}
- else if (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698)
+ else if (cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_2698)
{
hw->rfc = IPE_RFC_RFC2698;
}
- else if (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1)
+ else if (cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1)
{
hw->rfc = IPE_RFC_MEF5CF1;
}
else
{
- SSE2_QOS_DEBUG_ERROR ("Invalid RFC type %d\n", cfg->rfc);
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_61, cfg->rfc);
+ QOS_DEBUG_ERROR ("Invalid RFC type %d\n", cfg->rfc);
+ QOS_TR_ERR (QOS_TP_ERR_61, cfg->rfc);
return (EINVAL);
}
- rc = sse2_pol_convert_cfg_rates_to_hw (cfg, hw);
+ rc = pol_convert_cfg_rates_to_hw (cfg, hw);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to convert config rates to hw. Error: %d",
- rc);
+ QOS_DEBUG_ERROR ("Unable to convert config rates to hw. Error: %d", rc);
// Error is traced
return (rc);
}
- rc = sse2_pol_convert_cfg_burst_to_hw (cfg, hw);
+ rc = pol_convert_cfg_burst_to_hw (cfg, hw);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to convert config burst to hw. Error: %d",
- rc);
+ QOS_DEBUG_ERROR ("Unable to convert config burst to hw. Error: %d", rc);
// Error is traced
return (rc);
}
@@ -847,35 +813,31 @@ sse2_pol_convert_cfg_to_hw_params (sse2_qos_pol_cfg_params_st * cfg,
return 0;
}
-
u32
-sse2_qos_convert_pps_to_kbps (u32 rate_pps)
+qos_convert_pps_to_kbps (u32 rate_pps)
{
- // sse2_qos_ship_inc_counter(SSE2_QOS_SHIP_COUNTER_TYPE_API_CNT,
- // SSE2_QOS_SHIP_CNT_POL_CONV_PPS_TO_KBPS);
+ // qos_ship_inc_counter(QOS_SHIP_COUNTER_TYPE_API_CNT,
+ // QOS_SHIP_CNT_POL_CONV_PPS_TO_KBPS);
u64 numer, rnd_value = 0;
- numer = (u64) ((u64) rate_pps *
- (u64) SSE2_QOS_POLICER_FIXED_PKT_SIZE * 8LL);
- (void) sse2_qos_pol_round (numer, 1000LL, &rnd_value,
- SSE2_QOS_ROUND_TO_CLOSEST);
+ numer = (u64) ((u64) rate_pps * (u64) QOS_POLICER_FIXED_PKT_SIZE * 8LL);
+ (void) qos_pol_round (numer, 1000LL, &rnd_value, QOS_ROUND_TO_CLOSEST);
return ((u32) rnd_value);
}
u32
-sse2_qos_convert_burst_ms_to_bytes (u32 burst_ms, u32 rate_kbps)
+qos_convert_burst_ms_to_bytes (u32 burst_ms, u32 rate_kbps)
{
u64 numer, rnd_value = 0;
- //sse2_qos_ship_inc_counter(SSE2_QOS_SHIP_COUNTER_TYPE_API_CNT,
- // SSE2_QOS_SHIP_CNT_POL_CONV_BURST_MS_TO_BYTES);
+ // qos_ship_inc_counter(QOS_SHIP_COUNTER_TYPE_API_CNT,
+ // QOS_SHIP_CNT_POL_CONV_BURST_MS_TO_BYTES);
numer = (u64) ((u64) burst_ms * (u64) rate_kbps);
- (void) sse2_qos_pol_round (numer, 8LL, &rnd_value,
- SSE2_QOS_ROUND_TO_CLOSEST);
+ (void) qos_pol_round (numer, 8LL, &rnd_value, QOS_ROUND_TO_CLOSEST);
return ((u32) rnd_value);
}
@@ -887,25 +849,23 @@ sse2_qos_convert_burst_ms_to_bytes (u32 burst_ms, u32 rate_kbps)
* Return: Status, success or failure code.
*/
int
-sse2_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
- sse2_qos_pol_hw_params_st * hw)
+pol_compute_hw_params (qos_pol_cfg_params_st *cfg, qos_pol_hw_params_st *hw)
{
int rc = 0;
if (!cfg || !hw)
{
- SSE2_QOS_DEBUG_ERROR ("Illegal parameters");
+ QOS_DEBUG_ERROR ("Illegal parameters");
return (-1);
}
/*
* Validate the police config params being presented to RM
*/
- rc = sse2_pol_validate_cfg_params (cfg);
+ rc = pol_validate_cfg_params (cfg);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Config parameter validation failed. Error: %d",
- rc);
+ QOS_DEBUG_ERROR ("Config parameter validation failed. Error: %d", rc);
// Error is traced
return (-1);
}
@@ -914,12 +874,13 @@ sse2_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
* first round configured values to h/w supported values. This func
* also determines whether 'tick' or 'byte' format
*/
- rc = sse2_pol_convert_cfg_to_hw_params (cfg, hw);
+ rc = pol_convert_cfg_to_hw_params (cfg, hw);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to convert config params to hw params. "
- "Error: %d", rc);
- SSE2_QOS_TR_ERR (SSE2_QOS_TP_ERR_53, rc);
+ QOS_DEBUG_ERROR ("Unable to convert config params to hw params. "
+ "Error: %d",
+ rc);
+ QOS_TR_ERR (QOS_TP_ERR_53, rc);
return (-1);
}
@@ -1052,8 +1013,8 @@ compute_policer_params (u64 hz, // CPU speed in clocks per second
* Return: Status, success or failure code.
*/
int
-x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
- policer_read_response_type_st * hw)
+x86_pol_compute_hw_params (qos_pol_cfg_params_st *cfg,
+ policer_read_response_type_st *hw)
{
const int BYTES_PER_KBIT = (1000 / 8);
u64 hz;
@@ -1061,7 +1022,7 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
if (!cfg || !hw)
{
- SSE2_QOS_DEBUG_ERROR ("Illegal parameters");
+ QOS_DEBUG_ERROR ("Illegal parameters");
return (-1);
}
@@ -1086,17 +1047,16 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
return 0;
}
- if ((cfg->rfc == SSE2_QOS_POLICER_TYPE_1R2C) ||
- (cfg->rfc == SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697))
+ if ((cfg->rfc == QOS_POLICER_TYPE_1R2C) ||
+ (cfg->rfc == QOS_POLICER_TYPE_1R3C_RFC_2697))
{
// Single-rate policer
hw->single_rate = 1;
- if ((cfg->rfc == SSE2_QOS_POLICER_TYPE_1R2C) && cfg->rb.kbps.eb_bytes)
+ if ((cfg->rfc == QOS_POLICER_TYPE_1R2C) && cfg->rb.kbps.eb_bytes)
{
- SSE2_QOS_DEBUG_ERROR
- ("Policer parameter validation failed -- 1R2C.");
+ QOS_DEBUG_ERROR ("Policer parameter validation failed -- 1R2C.");
return (-1);
}
@@ -1104,7 +1064,7 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
(cfg->rb.kbps.eir_kbps != 0) ||
((cfg->rb.kbps.cb_bytes == 0) && (cfg->rb.kbps.eb_bytes == 0)))
{
- SSE2_QOS_DEBUG_ERROR ("Policer parameter validation failed -- 1R.");
+ QOS_DEBUG_ERROR ("Policer parameter validation failed -- 1R.");
return (-1);
}
@@ -1115,13 +1075,13 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
&hw->cir_tokens_per_period,
&hw->pir_tokens_per_period, &hw->scale))
{
- SSE2_QOS_DEBUG_ERROR ("Policer parameter computation failed.");
+ QOS_DEBUG_ERROR ("Policer parameter computation failed.");
return (-1);
}
}
- else if ((cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698) ||
- (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115))
+ else if ((cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_2698) ||
+ (cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_4115))
{
// Two-rate policer
@@ -1129,7 +1089,7 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
|| (cfg->rb.kbps.eir_kbps < cfg->rb.kbps.cir_kbps)
|| (cfg->rb.kbps.cb_bytes == 0) || (cfg->rb.kbps.eb_bytes == 0))
{
- SSE2_QOS_DEBUG_ERROR ("Config parameter validation failed.");
+ QOS_DEBUG_ERROR ("Config parameter validation failed.");
return (-1);
}
@@ -1142,15 +1102,15 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
&hw->cir_tokens_per_period,
&hw->pir_tokens_per_period, &hw->scale))
{
- SSE2_QOS_DEBUG_ERROR ("Policer parameter computation failed.");
+ QOS_DEBUG_ERROR ("Policer parameter computation failed.");
return (-1);
}
}
else
{
- SSE2_QOS_DEBUG_ERROR
- ("Config parameter validation failed. RFC not supported");
+ QOS_DEBUG_ERROR (
+ "Config parameter validation failed. RFC not supported");
return (-1);
}
@@ -1168,51 +1128,47 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st * cfg,
* Return: Status, success or failure code.
*/
int
-sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
- policer_read_response_type_st * phys)
+pol_logical_2_physical (qos_pol_cfg_params_st *cfg,
+ policer_read_response_type_st *phys)
{
int rc;
- sse2_qos_pol_cfg_params_st kbps_cfg;
+ qos_pol_cfg_params_st kbps_cfg;
clib_memset (phys, 0, sizeof (policer_read_response_type_st));
- clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st));
+ clib_memset (&kbps_cfg, 0, sizeof (qos_pol_cfg_params_st));
if (!cfg)
{
- SSE2_QOS_DEBUG_ERROR ("Illegal parameters");
+ QOS_DEBUG_ERROR ("Illegal parameters");
return (-1);
}
switch (cfg->rate_type)
{
- case SSE2_QOS_RATE_KBPS:
+ case QOS_RATE_KBPS:
/* copy all the data into kbps_cfg */
kbps_cfg.rb.kbps.cir_kbps = cfg->rb.kbps.cir_kbps;
kbps_cfg.rb.kbps.eir_kbps = cfg->rb.kbps.eir_kbps;
kbps_cfg.rb.kbps.cb_bytes = cfg->rb.kbps.cb_bytes;
kbps_cfg.rb.kbps.eb_bytes = cfg->rb.kbps.eb_bytes;
break;
- case SSE2_QOS_RATE_PPS:
+ case QOS_RATE_PPS:
kbps_cfg.rb.kbps.cir_kbps =
- sse2_qos_convert_pps_to_kbps (cfg->rb.pps.cir_pps);
+ qos_convert_pps_to_kbps (cfg->rb.pps.cir_pps);
kbps_cfg.rb.kbps.eir_kbps =
- sse2_qos_convert_pps_to_kbps (cfg->rb.pps.eir_pps);
- kbps_cfg.rb.kbps.cb_bytes = sse2_qos_convert_burst_ms_to_bytes ((u32)
- cfg->
- rb.pps.cb_ms,
- kbps_cfg.rb.
- kbps.cir_kbps);
- kbps_cfg.rb.kbps.eb_bytes =
- sse2_qos_convert_burst_ms_to_bytes ((u32) cfg->rb.pps.eb_ms,
- kbps_cfg.rb.kbps.eir_kbps);
+ qos_convert_pps_to_kbps (cfg->rb.pps.eir_pps);
+ kbps_cfg.rb.kbps.cb_bytes = qos_convert_burst_ms_to_bytes (
+ (u32) cfg->rb.pps.cb_ms, kbps_cfg.rb.kbps.cir_kbps);
+ kbps_cfg.rb.kbps.eb_bytes = qos_convert_burst_ms_to_bytes (
+ (u32) cfg->rb.pps.eb_ms, kbps_cfg.rb.kbps.eir_kbps);
break;
default:
- SSE2_QOS_DEBUG_ERROR ("Illegal rate type");
+ QOS_DEBUG_ERROR ("Illegal rate type");
return (-1);
}
/* rate type is now converted to kbps */
- kbps_cfg.rate_type = SSE2_QOS_RATE_KBPS;
+ kbps_cfg.rate_type = QOS_RATE_KBPS;
kbps_cfg.rnd_type = cfg->rnd_type;
kbps_cfg.rfc = cfg->rfc;
@@ -1227,10 +1183,10 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
#if !defined (INTERNAL_SS) && !defined (X86)
// convert logical into hw params which involves qos calculations
- rc = sse2_pol_compute_hw_params (&kbps_cfg, &pol_hw);
+ rc = pol_compute_hw_params (&kbps_cfg, &pol_hw);
if (rc == -1)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to compute hw param. Error: %d", rc);
+ QOS_DEBUG_ERROR ("Unable to compute hw param. Error: %d", rc);
return (rc);
}
@@ -1258,7 +1214,7 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
rc = x86_pol_compute_hw_params (&kbps_cfg, phys);
if (rc == -1)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to compute hw param. Error: %d", rc);
+ QOS_DEBUG_ERROR ("Unable to compute hw param. Error: %d", rc);
return (rc);
}
@@ -1274,12 +1230,11 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
return 0;
}
-
static void
-sse2_qos_convert_pol_bucket_to_hw_fmt (policer_read_response_type_st * bkt,
- sse2_qos_pol_hw_params_st * hw_fmt)
+qos_convert_pol_bucket_to_hw_fmt (policer_read_response_type_st *bkt,
+ qos_pol_hw_params_st *hw_fmt)
{
- clib_memset (hw_fmt, 0, sizeof (sse2_qos_pol_hw_params_st));
+ clib_memset (hw_fmt, 0, sizeof (qos_pol_hw_params_st));
#if !defined (INTERNAL_SS) && !defined (X86)
hw_fmt->rfc = (u8) bkt->rfc;
hw_fmt->allow_negative = (u8) bkt->an;
@@ -1301,8 +1256,8 @@ sse2_qos_convert_pol_bucket_to_hw_fmt (policer_read_response_type_st * bkt,
* Return: Status, success or failure code.
*/
static int
-sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st * hw,
- sse2_qos_pol_cfg_params_st * cfg)
+pol_convert_hw_to_cfg_params (qos_pol_hw_params_st *hw,
+ qos_pol_cfg_params_st *cfg)
{
u64 temp_rate;
@@ -1317,35 +1272,37 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st * hw,
/*
* For a 1R2C, we set EIR = 0, EB = 0
*/
- cfg->rfc = SSE2_QOS_POLICER_TYPE_1R2C;
+ cfg->rfc = QOS_POLICER_TYPE_1R2C;
}
else if (hw->rfc == IPE_RFC_RFC2697)
{
- cfg->rfc = SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697;
+ cfg->rfc = QOS_POLICER_TYPE_1R3C_RFC_2697;
}
else if (hw->rfc == IPE_RFC_RFC2698)
{
- cfg->rfc = SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698;
+ cfg->rfc = QOS_POLICER_TYPE_2R3C_RFC_2698;
}
else if (hw->rfc == IPE_RFC_RFC4115)
{
- cfg->rfc = SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115;
+ cfg->rfc = QOS_POLICER_TYPE_2R3C_RFC_4115;
}
else if (hw->rfc == IPE_RFC_MEF5CF1)
{
- cfg->rfc = SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1;
+ cfg->rfc = QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1;
}
else
{
return EINVAL;
}
- temp_rate = (((u64) hw->avg_rate_man << hw->rate_exp) * 8LL *
- SSE2_QOS_POL_TICKS_PER_SEC) / 1000;
+ temp_rate =
+ (((u64) hw->avg_rate_man << hw->rate_exp) * 8LL * QOS_POL_TICKS_PER_SEC) /
+ 1000;
cfg->rb.kbps.cir_kbps = (u32) temp_rate;
- temp_rate = (((u64) hw->peak_rate_man << hw->rate_exp) * 8LL *
- SSE2_QOS_POL_TICKS_PER_SEC) / 1000;
+ temp_rate =
+ (((u64) hw->peak_rate_man << hw->rate_exp) * 8LL * QOS_POL_TICKS_PER_SEC) /
+ 1000;
cfg->rb.kbps.eir_kbps = (u32) temp_rate;
cfg->rb.kbps.cb_bytes = ((u64) hw->comm_bkt_limit_man <<
@@ -1353,7 +1310,7 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st * hw,
cfg->rb.kbps.eb_bytes = ((u64) hw->extd_bkt_limit_man <<
(u64) hw->extd_bkt_limit_exp);
- if (cfg->rfc == SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697)
+ if (cfg->rfc == QOS_POLICER_TYPE_1R3C_RFC_2697)
{
/*
* For 1R3C in the hardware, EB = sum(CB, EB). Also, EIR = CIR. Restore
@@ -1362,7 +1319,7 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st * hw,
cfg->rb.kbps.eb_bytes = (cfg->rb.kbps.eb_bytes - cfg->rb.kbps.cb_bytes);
cfg->rb.kbps.eir_kbps = 0;
}
- else if (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115)
+ else if (cfg->rfc == QOS_POLICER_TYPE_2R3C_RFC_4115)
{
/*
* For 4115 in the hardware is excess rate and burst, but EA provides
@@ -1372,53 +1329,49 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st * hw,
cfg->rb.kbps.eb_bytes += cfg->rb.kbps.cb_bytes;
}
/* h/w conversion to cfg is in kbps */
- cfg->rate_type = SSE2_QOS_RATE_KBPS;
+ cfg->rate_type = QOS_RATE_KBPS;
cfg->overwrite_bucket = 0;
cfg->current_bucket = hw->comm_bkt;
cfg->extended_bucket = hw->extd_bkt;
- SSE2_QOS_DEBUG_INFO ("configured params, cir: %u kbps, eir: %u kbps, cb "
- "burst: 0x%llx bytes, eb burst: 0x%llx bytes",
- cfg->rb.kbps.cir_kbps, cfg->rb.kbps.eir_kbps,
- cfg->rb.kbps.cb_bytes, cfg->rb.kbps.eb_bytes);
- SSE2_QOS_TR_INFO (SSE2_QOS_TP_INFO_22, cfg->rb.kbps.cir_kbps,
- cfg->rb.kbps.eir_kbps,
- (uint) cfg->rb.kbps.cb_bytes,
- (uint) cfg->rb.kbps.eb_bytes);
+ QOS_DEBUG_INFO ("configured params, cir: %u kbps, eir: %u kbps, cb "
+ "burst: 0x%llx bytes, eb burst: 0x%llx bytes",
+ cfg->rb.kbps.cir_kbps, cfg->rb.kbps.eir_kbps,
+ cfg->rb.kbps.cb_bytes, cfg->rb.kbps.eb_bytes);
+ QOS_TR_INFO (QOS_TP_INFO_22, cfg->rb.kbps.cir_kbps, cfg->rb.kbps.eir_kbps,
+ (uint) cfg->rb.kbps.cb_bytes, (uint) cfg->rb.kbps.eb_bytes);
return 0;
}
u32
-sse2_qos_convert_kbps_to_pps (u32 rate_kbps)
+qos_convert_kbps_to_pps (u32 rate_kbps)
{
u64 numer, denom, rnd_value = 0;
- // sse_qosrm_ship_inc_counter(SSE2_QOS_SHIP_COUNTER_TYPE_API_CNT,
- // SSE2_QOS_SHIP_CNT_POL_CONV_KBPS_TO_PPS);
+ // sse_qosrm_ship_inc_counter(QOS_SHIP_COUNTER_TYPE_API_CNT,
+ // QOS_SHIP_CNT_POL_CONV_KBPS_TO_PPS);
numer = (u64) ((u64) rate_kbps * 1000LL);
- denom = (u64) ((u64) SSE2_QOS_POLICER_FIXED_PKT_SIZE * 8LL);
+ denom = (u64) ((u64) QOS_POLICER_FIXED_PKT_SIZE * 8LL);
- (void) sse2_qos_pol_round (numer, denom, &rnd_value,
- SSE2_QOS_ROUND_TO_CLOSEST);
+ (void) qos_pol_round (numer, denom, &rnd_value, QOS_ROUND_TO_CLOSEST);
return ((u32) rnd_value);
}
u32
-sse2_qos_convert_burst_bytes_to_ms (u64 burst_bytes, u32 rate_kbps)
+qos_convert_burst_bytes_to_ms (u64 burst_bytes, u32 rate_kbps)
{
u64 numer, denom, rnd_value = 0;
- //sse_qosrm_ship_inc_counter(SSE2_QOS_SHIP_COUNTER_TYPE_API_CNT,
- // SSE2_QOS_SHIP_CNT_POL_CONV_BYTES_TO_BURST_MS);
+ // sse_qosrm_ship_inc_counter(QOS_SHIP_COUNTER_TYPE_API_CNT,
+ // QOS_SHIP_CNT_POL_CONV_BYTES_TO_BURST_MS);
numer = burst_bytes * 8LL;
denom = (u64) rate_kbps;
- (void) sse2_qos_pol_round (numer, denom, &rnd_value,
- SSE2_QOS_ROUND_TO_CLOSEST);
+ (void) qos_pol_round (numer, denom, &rnd_value, QOS_ROUND_TO_CLOSEST);
return ((u32) rnd_value);
}
@@ -1429,56 +1382,55 @@ sse2_qos_convert_burst_bytes_to_ms (u64 burst_bytes, u32 rate_kbps)
* Return: Status, success or failure code.
*/
int
-sse2_pol_physical_2_logical (policer_read_response_type_st * phys,
- sse2_qos_pol_cfg_params_st * cfg)
+pol_physical_2_logical (policer_read_response_type_st *phys,
+ qos_pol_cfg_params_st *cfg)
{
int rc;
- sse2_qos_pol_hw_params_st pol_hw;
- sse2_qos_pol_cfg_params_st kbps_cfg;
+ qos_pol_hw_params_st pol_hw;
+ qos_pol_cfg_params_st kbps_cfg;
- clib_memset (&pol_hw, 0, sizeof (sse2_qos_pol_hw_params_st));
- clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st));
+ clib_memset (&pol_hw, 0, sizeof (qos_pol_hw_params_st));
+ clib_memset (&kbps_cfg, 0, sizeof (qos_pol_cfg_params_st));
if (!phys)
{
- SSE2_QOS_DEBUG_ERROR ("Illegal parameters");
+ QOS_DEBUG_ERROR ("Illegal parameters");
return (-1);
}
- sse2_qos_convert_pol_bucket_to_hw_fmt (phys, &pol_hw);
+ qos_convert_pol_bucket_to_hw_fmt (phys, &pol_hw);
- rc = sse2_pol_convert_hw_to_cfg_params (&pol_hw, &kbps_cfg);
+ rc = pol_convert_hw_to_cfg_params (&pol_hw, &kbps_cfg);
if (rc != 0)
{
- SSE2_QOS_DEBUG_ERROR ("Unable to convert hw params to config params. "
- "Error: %d", rc);
+ QOS_DEBUG_ERROR ("Unable to convert hw params to config params. "
+ "Error: %d",
+ rc);
return (-1);
}
/* check what rate type is required */
switch (cfg->rate_type)
{
- case SSE2_QOS_RATE_KBPS:
+ case QOS_RATE_KBPS:
/* copy all the data into kbps_cfg */
cfg->rb.kbps.cir_kbps = kbps_cfg.rb.kbps.cir_kbps;
cfg->rb.kbps.eir_kbps = kbps_cfg.rb.kbps.eir_kbps;
cfg->rb.kbps.cb_bytes = kbps_cfg.rb.kbps.cb_bytes;
cfg->rb.kbps.eb_bytes = kbps_cfg.rb.kbps.eb_bytes;
break;
- case SSE2_QOS_RATE_PPS:
+ case QOS_RATE_PPS:
cfg->rb.pps.cir_pps =
- sse2_qos_convert_kbps_to_pps (kbps_cfg.rb.kbps.cir_kbps);
+ qos_convert_kbps_to_pps (kbps_cfg.rb.kbps.cir_kbps);
cfg->rb.pps.eir_pps =
- sse2_qos_convert_kbps_to_pps (kbps_cfg.rb.kbps.eir_kbps);
- cfg->rb.pps.cb_ms =
- sse2_qos_convert_burst_bytes_to_ms (kbps_cfg.rb.kbps.cb_bytes,
- kbps_cfg.rb.kbps.cir_kbps);
- cfg->rb.pps.eb_ms =
- sse2_qos_convert_burst_bytes_to_ms (kbps_cfg.rb.kbps.eb_bytes,
- kbps_cfg.rb.kbps.eir_kbps);
+ qos_convert_kbps_to_pps (kbps_cfg.rb.kbps.eir_kbps);
+ cfg->rb.pps.cb_ms = qos_convert_burst_bytes_to_ms (
+ kbps_cfg.rb.kbps.cb_bytes, kbps_cfg.rb.kbps.cir_kbps);
+ cfg->rb.pps.eb_ms = qos_convert_burst_bytes_to_ms (
+ kbps_cfg.rb.kbps.eb_bytes, kbps_cfg.rb.kbps.eir_kbps);
break;
default:
- SSE2_QOS_DEBUG_ERROR ("Illegal rate type");
+ QOS_DEBUG_ERROR ("Illegal rate type");
return (-1);
}
diff --git a/src/vnet/policer/xlate.h b/src/vnet/policer/xlate.h
index 535006569f5..101c07074f2 100644
--- a/src/vnet/policer/xlate.h
+++ b/src/vnet/policer/xlate.h
@@ -24,18 +24,18 @@
#include <vnet/policer/police.h>
/*
- * edt: * enum sse2_qos_policer_type_en
+ * edt: * enum qos_policer_type_en
* Defines type of policer to be allocated
*/
-typedef enum sse2_qos_policer_type_en_
+typedef enum qos_policer_type_en_
{
- SSE2_QOS_POLICER_TYPE_1R2C = 0,
- SSE2_QOS_POLICER_TYPE_1R3C_RFC_2697 = 1,
- SSE2_QOS_POLICER_TYPE_2R3C_RFC_2698 = 2,
- SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115 = 3,
- SSE2_QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1 = 4,
- SSE2_QOS_POLICER_TYPE_MAX
-} sse2_qos_policer_type_en;
+ QOS_POLICER_TYPE_1R2C = 0,
+ QOS_POLICER_TYPE_1R3C_RFC_2697 = 1,
+ QOS_POLICER_TYPE_2R3C_RFC_2698 = 2,
+ QOS_POLICER_TYPE_2R3C_RFC_4115 = 3,
+ QOS_POLICER_TYPE_2R3C_RFC_MEF5CF1 = 4,
+ QOS_POLICER_TYPE_MAX
+} qos_policer_type_en;
/*
* edt: * enum
@@ -43,11 +43,11 @@ typedef enum sse2_qos_policer_type_en_
*/
typedef enum
{
- SSE2_QOS_ROUND_TO_CLOSEST = 0,
- SSE2_QOS_ROUND_TO_UP,
- SSE2_QOS_ROUND_TO_DOWN,
- SSE2_QOS_ROUND_INVALID
-} sse2_qos_round_type_en;
+ QOS_ROUND_TO_CLOSEST = 0,
+ QOS_ROUND_TO_UP,
+ QOS_ROUND_TO_DOWN,
+ QOS_ROUND_INVALID
+} qos_round_type_en;
/*
* edt: * enum
@@ -56,15 +56,15 @@ typedef enum
*
* Default of zero is kbps, which is inline with how it is programmed
* in actual hardware. However, the warning is that this is reverse logic
- * of units_in_bits field in sse2_static_policer_parameters_st, which is
+ * of units_in_bits field in static_policer_parameters_st, which is
* inline with sse_punt_drop.h.
*/
typedef enum
{
- SSE2_QOS_RATE_KBPS = 0,
- SSE2_QOS_RATE_PPS,
- SSE2_QOS_RATE_INVALID
-} sse2_qos_rate_type_en;
+ QOS_RATE_KBPS = 0,
+ QOS_RATE_PPS,
+ QOS_RATE_INVALID
+} qos_rate_type_en;
/*
* edt: * enum
@@ -72,28 +72,28 @@ typedef enum
*/
typedef enum
{
- SSE2_QOS_ACTION_DROP = 0,
- SSE2_QOS_ACTION_TRANSMIT,
- SSE2_QOS_ACTION_MARK_AND_TRANSMIT
-} sse2_qos_action_type_en;
+ QOS_ACTION_DROP = 0,
+ QOS_ACTION_TRANSMIT,
+ QOS_ACTION_MARK_AND_TRANSMIT
+} qos_action_type_en;
/*
- * edt * struct sse2_qos_pol_action_params_st
+ * edt * struct qos_pol_action_params_st
* This structure is used to hold user configured police action parameters.
*
* element: action_type
- * Action type (see sse2_qos_action_type_en).
+ * Action type (see qos_action_type_en).
* element: dscp
- * DSCP value to set when action is SSE2_QOS_ACTION_MARK_AND_TRANSMIT.
+ * DSCP value to set when action is QOS_ACTION_MARK_AND_TRANSMIT.
*/
-typedef struct sse2_qos_pol_action_params_st_
+typedef struct qos_pol_action_params_st_
{
u8 action_type;
ip_dscp_t dscp;
-} sse2_qos_pol_action_params_st;
+} qos_pol_action_params_st;
/*
- * edt: * struct sse2_qos_pol_cfg_params_st
+ * edt: * struct qos_pol_cfg_params_st
*
* Description:
* This structure is used to hold user configured policing parameters.
@@ -118,12 +118,12 @@ typedef struct sse2_qos_pol_action_params_st_
* Indicates the union if in kbps/bytes or pps/ms.
* element: rfc
* Policer algorithm - 1R2C, 1R3C (2697), 2R3C (2698) or 2R3C (4115). See
- * sse_qos_policer_type_en
+ * qos_policer_type_en
* element: rnd_type
- * Rounding type (see sse_qos_round_type_en). Needed when policer values
+ * Rounding type (see qos_round_type_en). Needed when policer values
* need to be rounded. Caller can decide on type of rounding used
*/
-typedef struct sse2_qos_pol_cfg_params_st_
+typedef struct qos_pol_cfg_params_st_
{
union
{
@@ -142,20 +142,19 @@ typedef struct sse2_qos_pol_cfg_params_st_
u64 eb_ms;
} pps;
} rb; /* rate burst config */
- u8 rate_type; /* sse2_qos_rate_type_en */
- u8 rnd_type; /* sse2_qos_round_type_en */
- u8 rfc; /* sse2_qos_policer_type_en */
+ u8 rate_type; /* qos_rate_type_en */
+ u8 rnd_type; /* qos_round_type_en */
+ u8 rfc; /* qos_policer_type_en */
u8 color_aware;
u8 overwrite_bucket; /* for debugging purposes */
u32 current_bucket; /* for debugging purposes */
u32 extended_bucket; /* for debugging purposes */
- sse2_qos_pol_action_params_st conform_action;
- sse2_qos_pol_action_params_st exceed_action;
- sse2_qos_pol_action_params_st violate_action;
-} sse2_qos_pol_cfg_params_st;
+ qos_pol_action_params_st conform_action;
+ qos_pol_action_params_st exceed_action;
+ qos_pol_action_params_st violate_action;
+} qos_pol_cfg_params_st;
-
-typedef struct sse2_qos_pol_hw_params_st_
+typedef struct qos_pol_hw_params_st_
{
u8 rfc;
u8 allow_negative;
@@ -168,13 +167,10 @@ typedef struct sse2_qos_pol_hw_params_st_
u8 extd_bkt_limit_man;
u32 comm_bkt;
u32 extd_bkt;
-} sse2_qos_pol_hw_params_st;
-
-
-int
-sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg,
- policer_read_response_type_st * phys);
+} qos_pol_hw_params_st;
+int pol_logical_2_physical (qos_pol_cfg_params_st *cfg,
+ policer_read_response_type_st *phys);
#endif /* __included_xlate_h__ */