Add support for transparent ethernet bridging to GRE
[vpp.git] / vnet / vnet / policer / xlate.c
index d1eab30..c9250eb 100644 (file)
@@ -468,7 +468,7 @@ sse2_pol_convert_cfg_rates_to_hw (sse2_qos_pol_cfg_params_st *cfg,
                             &exp, &hi_mant);
     }
 
-    denom = (1 << exp);
+    denom = (1ULL << exp);
     if (hi_rate == eir_hw) {
         hw->peak_rate_man = (uint16_t)hi_mant;
         rc = sse2_qos_pol_round((uint64_t)cir_hw, denom, &rnd_value,
@@ -1045,10 +1045,6 @@ x86_pol_compute_hw_params (sse2_qos_pol_cfg_params_st *cfg,
                (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115)) {
         // Two-rate policer
 
-        if (cfg->rfc == SSE2_QOS_POLICER_TYPE_2R3C_RFC_4115) {
-            hw->color_aware = 1;
-        }
-
         if ((cfg->rb.kbps.cir_kbps == 0) || (cfg->rb.kbps.eir_kbps == 0) || (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.");
@@ -1129,6 +1125,15 @@ sse2_pol_logical_2_physical (sse2_qos_pol_cfg_params_st    *cfg,
     kbps_cfg.rnd_type  = cfg->rnd_type;
     kbps_cfg.rfc       = cfg->rfc;
 
+    phys->action[POLICE_CONFORM]    = cfg->conform_action.action_type;
+    phys->mark_dscp[POLICE_CONFORM] = cfg->conform_action.dscp;
+    phys->action[POLICE_EXCEED]     = cfg->exceed_action.action_type;
+    phys->mark_dscp[POLICE_EXCEED]  = cfg->exceed_action.dscp;
+    phys->action[POLICE_VIOLATE]    = cfg->violate_action.action_type;
+    phys->mark_dscp[POLICE_VIOLATE] = cfg->violate_action.dscp;
+
+    phys->color_aware = cfg->color_aware;
+
 #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);
@@ -1233,11 +1238,11 @@ sse2_pol_convert_hw_to_cfg_params (sse2_qos_pol_hw_params_st  *hw,
         return EINVAL;
     }
 
-    temp_rate = ((hw->avg_rate_man << hw->rate_exp) * 8LL *
+    temp_rate = (((uint64_t) hw->avg_rate_man << hw->rate_exp) * 8LL *
                 SSE2_QOS_POL_TICKS_PER_SEC)/1000;
     cfg->rb.kbps.cir_kbps = (uint32_t)temp_rate;
 
-    temp_rate = ((hw->peak_rate_man << hw->rate_exp) * 8LL *
+    temp_rate = (((uint64_t) hw->peak_rate_man << hw->rate_exp) * 8LL *
                 SSE2_QOS_POL_TICKS_PER_SEC)/1000;
     cfg->rb.kbps.eir_kbps = (uint32_t)temp_rate;