summaryrefslogtreecommitdiffstats
path: root/src/vnet/policer/xlate.c
diff options
context:
space:
mode:
authorBrian Russell <brian@graphiant.com>2021-02-09 11:36:31 +0000
committerNeale Ranns <neale@graphiant.com>2021-02-12 18:57:55 +0000
commitb2aae75c1712b733f16e97bdb69e4b93f32de10c (patch)
tree569aa2f8742e4d98d05981e758a96e397413391c /src/vnet/policer/xlate.c
parent950d33ef67fdccc24c74cadf679cdeadc1cf6ddc (diff)
policer: use enum types
Make the policer action enum packed and use it in the policer code. Use other policer enums where applicable. Type: improvement Signed-off-by: Brian Russell <brian@graphiant.com> Change-Id: I32f9735942af8bca3160b9ef8a75f605d9aba5fa
Diffstat (limited to 'src/vnet/policer/xlate.c')
-rw-r--r--src/vnet/policer/xlate.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/src/vnet/policer/xlate.c b/src/vnet/policer/xlate.c
index 2ef99225017..1b6015d51a6 100644
--- a/src/vnet/policer/xlate.c
+++ b/src/vnet/policer/xlate.c
@@ -256,8 +256,7 @@ pol_validate_cfg_params (qos_pol_cfg_params_st *cfg)
*/
numer = (u64) (cfg->rb.kbps.cir_kbps);
denom = (u64) (8 * QOS_POL_TICKS_PER_SEC) / 1000;
- rc = qos_pol_round (numer, denom, &rnd_value,
- (qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round (numer, denom, &rnd_value, cfg->rnd_type);
if (rc != 0)
{
QOS_DEBUG_ERROR ("Unable to convert CIR to bytes/tick format");
@@ -267,8 +266,7 @@ pol_validate_cfg_params (qos_pol_cfg_params_st *cfg)
cir_hw = (u32) rnd_value;
numer = (u64) (cfg->rb.kbps.eir_kbps);
- rc = qos_pol_round (numer, denom, &rnd_value,
- (qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round (numer, denom, &rnd_value, cfg->rnd_type);
if (rc != 0)
{
QOS_DEBUG_ERROR ("Unable to convert EIR to bytes/tick format");
@@ -390,8 +388,7 @@ pol_convert_cfg_rates_to_hw (qos_pol_cfg_params_st *cfg,
*/
denom = (u64) ((QOS_POL_TICKS_PER_SEC * 8) / 1000);
numer = (u64) (cfg->rb.kbps.cir_kbps);
- rc = qos_pol_round (numer, denom, &rnd_value,
- (qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round (numer, denom, &rnd_value, cfg->rnd_type);
if (rc != 0)
{
QOS_DEBUG_ERROR ("Rounding error, rate: %d kbps, rounding_type: %d",
@@ -427,8 +424,7 @@ pol_convert_cfg_rates_to_hw (qos_pol_cfg_params_st *cfg,
}
numer = (u64) eir_kbps;
- rc = qos_pol_round (numer, denom, &rnd_value,
- (qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round (numer, denom, &rnd_value, cfg->rnd_type);
if (rc != 0)
{
QOS_DEBUG_ERROR ("Rounding error, rate: %d kbps, rounding_type: %d",
@@ -471,24 +467,22 @@ pol_convert_cfg_rates_to_hw (qos_pol_cfg_params_st *cfg,
}
else
{
- 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);
+ qos_convert_value_to_exp_mant_fmt (hi_rate, (u16) QOS_POL_RATE_EXP_MAX,
+ (u16) QOS_POL_AVG_RATE_MANT_MAX,
+ cfg->rnd_type, &exp, &hi_mant);
}
denom = (1ULL << exp);
if (hi_rate == eir_hw)
{
hw->peak_rate_man = (u16) hi_mant;
- rc = qos_pol_round ((u64) cir_hw, denom, &rnd_value,
- (qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round ((u64) cir_hw, denom, &rnd_value, cfg->rnd_type);
hw->avg_rate_man = (u16) rnd_value;
}
else
{
hw->avg_rate_man = (u16) hi_mant;
- rc = qos_pol_round ((u64) eir_hw, denom, &rnd_value,
- (qos_round_type_en) cfg->rnd_type);
+ rc = qos_pol_round ((u64) eir_hw, denom, &rnd_value, cfg->rnd_type);
hw->peak_rate_man = (u16) rnd_value;
}
if (rc != 0)