feature: provide a u16 version of vnet_feature_next 85/25385/2
authorNeale Ranns <nranns@cisco.com>
Mon, 24 Feb 2020 12:54:31 +0000 (12:54 +0000)
committerDave Barach <openvpp@barachs.net>
Tue, 25 Feb 2020 16:05:26 +0000 (16:05 +0000)
Type: improvement

when using vlib_buffer_enqueue_to_next the 'nexts' parameter is an array
of u16, but vnet_feautre_next takes a u32. this is a simple wrapper to
address the impedence mismatch.

Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: I0fa86629e979e313344eb68442dc35a7b9537a8f

src/plugins/acl/dataplane_node.c
src/vnet/feature/feature.h
src/vnet/ipsec/esp_encrypt.c

index c738f66..5034f94 100644 (file)
@@ -778,11 +778,10 @@ acl_fa_inner_node_fn (vlib_main_t * vm,
            }
 
          {
-           u32 next0;
            /* speculatively get the next0 */
-           vnet_feature_next (&next0, b[0]);
+           vnet_feature_next_u16 (&next[0], b[0]);
            /* if the action is not deny - then use that next */
-           next[0] = action ? next0 : 0;
+           next[0] = action ? next[0] : 0;
          }
 
          if (node_trace_on)    // PREDICT_FALSE (node->flags & VLIB_NODE_FLAG_TRACE))
index cbea659..cd01673 100644 (file)
@@ -304,6 +304,14 @@ vnet_feature_next (u32 * next0, vlib_buffer_t * b0)
   vnet_feature_next_with_data (next0, b0, 0);
 }
 
+static_always_inline void
+vnet_feature_next_u16 (u16 * next0, vlib_buffer_t * b0)
+{
+  u32 next32;
+  vnet_feature_next_with_data (&next32, b0, 0);
+  *next0 = next32;
+}
+
 static_always_inline int
 vnet_device_input_have_features (u32 sw_if_index)
 {
index 7df537a..e06babd 100644 (file)
@@ -320,10 +320,8 @@ esp_encrypt_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
       if (is_tun)
        {
          /* we are on a ipsec tunnel's feature arc */
-         u32 next0 = 0;
          config_index = b[0]->current_config_index;
-         vnet_feature_next (&next0, b[0]);
-         next[0] = next0;
+         vnet_feature_next_u16 (&next[0], b[0]);
          vnet_buffer (b[0])->ipsec.sad_index =
            sa_index0 = ipsec_tun_protect_get_sa_out
            (vnet_buffer (b[0])->ip.adj_index[VLIB_TX]);