acl-plugin: fill in the 5tuple structure all at once, avoid short writes
[vpp.git] / src / plugins / acl / dataplane_node.c
index a6c7b98..00cad47 100644 (file)
@@ -66,6 +66,18 @@ typedef enum
 
 /* *INDENT-ON* */
 
+always_inline u16
+get_current_policy_epoch (acl_main_t * am, int is_input, u32 sw_if_index0)
+{
+  u32 **p_epoch_vec =
+    is_input ? &am->input_policy_epoch_by_sw_if_index :
+    &am->output_policy_epoch_by_sw_if_index;
+  u16 current_policy_epoch =
+    sw_if_index0 < vec_len (*p_epoch_vec) ? vec_elt (*p_epoch_vec,
+                                                    sw_if_index0)
+    : (is_input * FA_POLICY_EPOCH_IS_INPUT);
+  return current_policy_epoch;
+}
 
 always_inline uword
 acl_fa_node_fn (vlib_main_t * vm,
@@ -124,23 +136,17 @@ acl_fa_node_fn (vlib_main_t * vm,
       else
        lc_index0 = am->output_lc_index_by_sw_if_index[sw_if_index0];
 
-
-      u32 **p_epoch_vec =
-       is_input ? &am->input_policy_epoch_by_sw_if_index :
-       &am->output_policy_epoch_by_sw_if_index;
       u16 current_policy_epoch =
-       sw_if_index0 < vec_len (*p_epoch_vec) ? vec_elt (*p_epoch_vec,
-                                                        sw_if_index0)
-       : (is_input * FA_POLICY_EPOCH_IS_INPUT);
+       get_current_policy_epoch (am, is_input, sw_if_index0);
+
+
       /*
        * Extract the L3/L4 matching info into a 5-tuple structure.
        */
 
-      acl_plugin_fill_5tuple_inline (lc_index0, b[0], is_ip6, is_input,
-                                    is_l2_path,
-                                    (fa_5tuple_opaque_t *) & fa_5tuple);
-      fa_5tuple.l4.lsb_of_sw_if_index = sw_if_index0 & 0xffff;
-      fa_5tuple.pkt.mask_type_index_lsb = ~0;
+      acl_fill_5tuple (&acl_main, sw_if_index0, b[0], is_ip6,
+                      is_input, is_l2_path, &fa_5tuple);
+
 #ifdef FA_NODE_VERBOSE_DEBUG
       clib_warning
        ("ACL_FA_NODE_DBG: packet 5-tuple %016llx %016llx %016llx %016llx %016llx %016llx",
@@ -234,7 +240,7 @@ acl_fa_node_fn (vlib_main_t * vm,
       if (acl_check_needed)
        {
          action = 0;           /* deny by default */
-         acl_plugin_match_5tuple_inline (lc_index0,
+         acl_plugin_match_5tuple_inline (&acl_main, lc_index0,
                                          (fa_5tuple_opaque_t *) &
                                          fa_5tuple, is_ip6, &action,
                                          &match_acl_pos,
@@ -275,7 +281,7 @@ acl_fa_node_fn (vlib_main_t * vm,
          if (is_l2_path)
            next0 = vnet_l2_feature_next (b[0], l2_feat_next_node_index, 0);
          else
-           vnet_feature_next (sw_if_index0, &next0, b[0]);
+           vnet_feature_next (&next0, b[0]);
        }
 #ifdef FA_NODE_VERBOSE_DEBUG
       clib_warning