misc: move to new pool_foreach macros
[vpp.git] / src / vnet / srmpls / sr_mpls_steering.c
old mode 100755 (executable)
new mode 100644 (file)
index 0bd3466..b12e78d
@@ -70,7 +70,7 @@ find_or_create_internal_label (ip46_address_t endpoint, u32 color)
   if (!color_table)
     {
       mhash_t color_t;
-      memset (&color_t, 0, sizeof (mhash_t));
+      clib_memset (&color_t, 0, sizeof (mhash_t));
       mhash_init (&color_t, sizeof (u32), sizeof (ip46_address_t));
       mhash_set_mem (&sm->sr_policies_c2e2eclabel_hash, &color,
                     (uword *) & color_t, NULL);
@@ -301,7 +301,10 @@ compute_sr_te_automated_steering_fib_entry (mpls_sr_steering_policy_t *
 
   if (steer_pl->vpn_label != (u32) ~ 0)
     {
-      vec_add1 (path.frp_label_stack, steer_pl->vpn_label);
+      fib_mpls_label_t fml = {
+       .fml_value = steer_pl->vpn_label,
+      };
+      vec_add1 (path.frp_label_stack, fml);
       path.frp_eos = MPLS_NON_EOS;
     }
 
@@ -388,24 +391,18 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id,
   mpls_sr_policy_t *sr_policy = 0;
   uword *p = 0;
 
-  memset (&key, 0, sizeof (sr_mpls_steering_key_t));
+  clib_memset (&key, 0, sizeof (sr_mpls_steering_key_t));
 
-  /* Compute the steer policy key */
-  if (traffic_type == SR_STEER_IPV4 || traffic_type == SR_STEER_IPV6)
-    {
-      key.prefix.as_u64[0] = prefix->as_u64[0];
-      key.prefix.as_u64[1] = prefix->as_u64[1];
-      key.mask_width = mask_width;
-      key.fib_table = (table_id != (u32) ~ 0 ? table_id : 0);
-    }
-  else
+  if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
     return -1;
 
+  /* Compute the steer policy key */
+  key.prefix.as_u64[0] = prefix->as_u64[0];
+  key.prefix.as_u64[1] = prefix->as_u64[1];
+  key.mask_width = mask_width;
+  key.fib_table = (table_id != (u32) ~ 0 ? table_id : 0);
   key.traffic_type = traffic_type;
 
-  if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
-    return -1;
-
   /*
    * Search for steering policy. If already exists we are adding a new
    * color.
@@ -441,7 +438,7 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id,
 
   /* Create a new steering policy */
   pool_get (sm->steer_policies, steer_pl);
-  memset (steer_pl, 0, sizeof (*steer_pl));
+  clib_memset (steer_pl, 0, sizeof (*steer_pl));
   clib_memcpy (&steer_pl->classify.prefix, prefix, sizeof (ip46_address_t));
   clib_memcpy (&steer_pl->next_hop, next_hop, sizeof (ip46_address_t));
   steer_pl->nh_type = nh_type;
@@ -480,7 +477,12 @@ sr_mpls_steering_policy_add (mpls_label_t bsid, u32 table_id,
       fib_route_path_t *paths = NULL;
 
       if (steer_pl->vpn_label != (u32) ~ 0)
-       vec_add1 (path.frp_label_stack, steer_pl->vpn_label);
+       {
+         fib_mpls_label_t fml = {
+           .fml_value = steer_pl->vpn_label,
+         };
+         vec_add1 (path.frp_label_stack, fml);
+       }
 
       /* FIB API calls - Recursive route through the BindingSID */
       if (traffic_type == SR_STEER_IPV6)
@@ -551,7 +553,7 @@ sr_mpls_steering_policy_del (ip46_address_t * prefix, u32 mask_width,
   fib_prefix_t pfx = { 0 };
   uword *p = 0;
 
-  memset (&key, 0, sizeof (sr_mpls_steering_key_t));
+  clib_memset (&key, 0, sizeof (sr_mpls_steering_key_t));
 
   /* Compute the steer policy key */
   if (traffic_type != SR_STEER_IPV4 && traffic_type != SR_STEER_IPV6)
@@ -671,8 +673,8 @@ sr_mpls_steer_policy_command_fn (vlib_main_t * vm, unformat_input_t * input,
 
   u8 sr_policy_set = 0;
 
-  memset (&prefix, 0, sizeof (ip46_address_t));
-  memset (&nh, 0, sizeof (ip46_address_t));
+  clib_memset (&prefix, 0, sizeof (ip46_address_t));
+  clib_memset (&nh, 0, sizeof (ip46_address_t));
 
   int rv;
   while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
@@ -798,9 +800,9 @@ show_sr_mpls_steering_policies_command_fn (vlib_main_t * vm,
 
   vlib_cli_output (vm, "SR MPLS steering policies:");
   /* *INDENT-OFF* */
-  pool_foreach(steer_pl, sm->steer_policies, ({
+  pool_foreach (steer_pl, sm->steer_policies)  {
     vec_add1(steer_policies, steer_pl);
-  }));
+  }
   /* *INDENT-ON* */
   for (i = 0; i < vec_len (steer_policies); i++)
     {