X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fpolicer%2Fxlate.c;h=afc0c05c3760593f17c582c24871c31bbdebc0db;hb=b6a4795;hp=74a6eb23d0a07b44bad44798cc26ef2c3d232ea4;hpb=7cd468a3d7dee7d6c92f69a0bb7061ae208ec727;p=vpp.git diff --git a/src/vnet/policer/xlate.c b/src/vnet/policer/xlate.c index 74a6eb23d0a..afc0c05c376 100644 --- a/src/vnet/policer/xlate.c +++ b/src/vnet/policer/xlate.c @@ -128,7 +128,7 @@ #define SSE2_QOS_POL_DEF_BURST_BYTE 100 /* - * Minimum burst needs to be such that the largest packet size is accomodated + * 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 @@ -566,7 +566,7 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st * cfg, * sse2_pol_get_bkt_max * * PARAMETERS - * rate_hw - either the averate rate or peak rate + * rate_hw - either the average rate or peak rate * bkt_max - bit width in the current bucket or extended bucket * * RETURNS @@ -605,7 +605,7 @@ sse2_pol_get_bkt_max (u64 rate_hw, u64 bkt_max) * sse2_pol_get_bkt_value * * PARAMETERS - * rate_hw - either the averate rate or peak rate + * rate_hw - either the average rate or peak rate * byte_value - bytes for this token bucket * * RETURNS @@ -798,7 +798,7 @@ sse2_pol_convert_cfg_to_hw_params (sse2_qos_pol_cfg_params_st * cfg, /* * clear the hw_params */ - memset (hw, 0, sizeof (sse2_qos_pol_hw_params_st)); + clib_memset (hw, 0, sizeof (sse2_qos_pol_hw_params_st)); hw->allow_negative = SSE2_QOS_POL_ALLOW_NEGATIVE; @@ -973,7 +973,7 @@ compute_policer_params (u64 hz, // CPU speed in clocks per second internal_cir_bytes_per_period = (double) cir_rate / period; internal_pir_bytes_per_period = (double) pir_rate / period; - // Scale if possible. Scaling helps rate accuracy, but is contrained + // Scale if possible. Scaling helps rate accuracy, but is constrained // by the scaled rates and limits fitting in 32-bits. // In addition, we need to insure the scaled rate is no larger than // 2^22 tokens per period. This allows the dataplane to ignore overflow @@ -1172,11 +1172,10 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg, policer_read_response_type_st * phys) { int rc; - sse2_qos_pol_hw_params_st pol_hw; sse2_qos_pol_cfg_params_st kbps_cfg; - memset (phys, 0, sizeof (policer_read_response_type_st)); - memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); + clib_memset (phys, 0, sizeof (policer_read_response_type_st)); + clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); if (!cfg) { @@ -1270,9 +1269,6 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st * cfg, phys->extended_bucket = cfg->extended_bucket; } - // Touch to avoid compiler warning for X86 - pol_hw.allow_negative = pol_hw.allow_negative; - #endif // if !defined (INTERNAL_SS) && !defined (X86) return 0; @@ -1283,7 +1279,7 @@ static void sse2_qos_convert_pol_bucket_to_hw_fmt (policer_read_response_type_st * bkt, sse2_qos_pol_hw_params_st * hw_fmt) { - memset (hw_fmt, 0, sizeof (sse2_qos_pol_hw_params_st)); + clib_memset (hw_fmt, 0, sizeof (sse2_qos_pol_hw_params_st)); #if !defined (INTERNAL_SS) && !defined (X86) hw_fmt->rfc = (u8) bkt->rfc; hw_fmt->allow_negative = (u8) bkt->an; @@ -1316,7 +1312,7 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st * hw, } if ((hw->rfc == IPE_RFC_RFC4115) && - !(hw->peak_rate_man << hw->rate_exp) && !(hw->extd_bkt_limit_man)) + (hw->peak_rate_man << hw->rate_exp) == 0 && !(hw->extd_bkt_limit_man)) { /* * For a 1R2C, we set EIR = 0, EB = 0 @@ -1440,8 +1436,8 @@ sse2_pol_physical_2_logical (policer_read_response_type_st * phys, sse2_qos_pol_hw_params_st pol_hw; sse2_qos_pol_cfg_params_st kbps_cfg; - memset (&pol_hw, 0, sizeof (sse2_qos_pol_hw_params_st)); - memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); + clib_memset (&pol_hw, 0, sizeof (sse2_qos_pol_hw_params_st)); + clib_memset (&kbps_cfg, 0, sizeof (sse2_qos_pol_cfg_params_st)); if (!phys) {