dev: new device driver infra
[vpp.git] / src / vnet / l2 / l2_patch.c
index e2d2a67..5697fb6 100644 (file)
@@ -14,7 +14,6 @@
  */
 #include <vlib/vlib.h>
 #include <vnet/vnet.h>
-#include <vnet/pg/pg.h>
 #include <vnet/ethernet/ethernet.h>
 #include <vnet/feature/feature.h>
 #include <vppinfra/error.h>
@@ -49,9 +48,13 @@ format_l2_patch_trace (u8 * s, va_list * args)
   return s;
 }
 
+#ifndef CLIB_MARCH_VARIANT
 l2_patch_main_t l2_patch_main;
+#else
+extern l2_patch_main_t l2_patch_main;
+#endif
 
-static vlib_node_registration_t l2_patch_node;
+extern vlib_node_registration_t l2_patch_node;
 
 #define foreach_l2_patch_error                 \
 _(PATCHED, "L2 patch packets")                 \
@@ -204,7 +207,7 @@ VLIB_NODE_FN (l2_patch_node) (vlib_main_t * vm,
 }
 
 /* *INDENT-OFF* */
-VLIB_REGISTER_NODE (l2_patch_node, static) = {
+VLIB_REGISTER_NODE (l2_patch_node) = {
   .name = "l2-patch",
   .vector_size = sizeof (u32),
   .format_trace = format_l2_patch_trace,
@@ -266,15 +269,19 @@ vnet_l2_patch_add_del (u32 rx_sw_if_index, u32 tx_sw_if_index, int is_add)
                          ETHERNET_INTERFACE_FLAG_ACCEPT_ALL);
 
       vnet_feature_enable_disable ("device-input", "l2-patch",
-                                  rxhi->hw_if_index, 1, 0, 0);
+                                  rxhi->sw_if_index, 1, 0, 0);
+      vnet_feature_enable_disable ("port-rx-eth", "l2-patch",
+                                  rxhi->sw_if_index, 1, 0, 0);
     }
   else
     {
       ethernet_set_flags (l2pm->vnet_main, rxhi->hw_if_index,
-                         0 /* disable promiscuous mode */ );
+                         /*ETHERNET_INTERFACE_FLAG_DEFAULT_L3 */ 0);
 
       vnet_feature_enable_disable ("device-input", "l2-patch",
-                                  rxhi->hw_if_index, 0, 0, 0);
+                                  rxhi->sw_if_index, 0, 0, 0);
+      vnet_feature_enable_disable ("port-rx-eth", "l2-patch",
+                                  rxhi->sw_if_index, 0, 0, 0);
       if (vec_len (l2pm->tx_next_by_rx_sw_if_index) > rx_sw_if_index)
        {
          l2pm->tx_next_by_rx_sw_if_index[rx_sw_if_index] = ~0;