flow-hash: Add symmetric flag for flow hashing
[vpp.git] / src / vnet / flow / flow.c
index 91e5112..4d867fe 100644 (file)
@@ -47,7 +47,7 @@ vnet_flow_add (vnet_main_t * vnm, vnet_flow_t * flow, u32 * flow_index)
 
   pool_get (fm->global_flow_pool, f);
   *flow_index = f - fm->global_flow_pool;
-  clib_memcpy (f, flow, sizeof (vnet_flow_t));
+  clib_memcpy_fast (f, flow, sizeof (vnet_flow_t));
   f->private_data = 0;
   f->index = *flow_index;
   return 0;
@@ -82,7 +82,7 @@ vnet_flow_del (vnet_main_t * vnm, u32 flow_index)
   /* *INDENT-ON* */
 
   hash_free (f->private_data);
-  memset (f, 0, sizeof (*f));
+  clib_memset (f, 0, sizeof (*f));
   pool_put (fm->global_flow_pool, f);
   return 0;
 }
@@ -109,6 +109,14 @@ vnet_flow_enable (vnet_main_t * vnm, u32 flow_index, u32 hw_if_index)
   if (dev_class->flow_ops_function == 0)
     return VNET_FLOW_ERROR_NOT_SUPPORTED;
 
+  if (f->actions & VNET_FLOW_ACTION_REDIRECT_TO_NODE)
+    {
+      vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
+      f->redirect_device_input_next_index =
+       vlib_node_add_next (vnm->vlib_main, hw->input_node_index,
+                           f->redirect_node_index);
+    }
+
   rv = dev_class->flow_ops_function (vnm, VNET_FLOW_DEV_OP_ADD_FLOW,
                                     hi->dev_instance, flow_index,
                                     &private_data);