aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/policer/policer.c
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/policer.c
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/policer.c')
-rw-r--r--src/vnet/policer/policer.c96
1 files changed, 46 insertions, 50 deletions
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);