deprecate VLIB_DEVICE_TX_FUNCTION_MULTIARCH 51/18251/1
authorFilip Tehlar <ftehlar@cisco.com>
Wed, 13 Mar 2019 12:50:44 +0000 (05:50 -0700)
committerFilip Tehlar <ftehlar@cisco.com>
Wed, 13 Mar 2019 12:50:59 +0000 (05:50 -0700)
Change-Id: I8819bcb9e228e7a432f4a7b67b6107f984927cd4
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
src/vnet/CMakeLists.txt
src/vnet/devices/af_packet/device.c
src/vnet/devices/netmap/device.c
src/vnet/devices/virtio/device.c
src/vnet/interface.h
src/vnet/ipsec-gre/ipsec_gre.c

index 1b1df86..e486aa9 100644 (file)
@@ -834,6 +834,7 @@ list(APPEND VNET_SOURCES
 
 list(APPEND VNET_MULTIARCH_SOURCES
   ipsec-gre/node.c
+  ipsec-gre/ipsec_gre.c
 )
 
 list(APPEND VNET_HEADERS
@@ -1114,6 +1115,7 @@ list(APPEND VNET_MULTIARCH_SOURCES
   devices/netmap/node.c
   devices/virtio/node.c
   devices/af_packet/node.c
+  devices/virtio/device.c
 )
 
 list(APPEND VNET_API_FILES
@@ -1236,6 +1238,11 @@ list(APPEND VNET_SOURCES
   devices/af_packet/af_packet_api.c
 )
 
+list(APPEND VNET_MULTIARCH_SOURCES
+  devices/netmap/device.c
+  devices/af_packet/device.c
+)
+
 list(APPEND VNET_HEADERS
   devices/af_packet/af_packet.h
 )
index 9d08c62..2886fb5 100644 (file)
@@ -51,6 +51,7 @@ static char *af_packet_tx_func_error_strings[] = {
 };
 
 
+#ifndef CLIB_MARCH_VARIANT
 u8 *
 format_af_packet_device_name (u8 * s, va_list * args)
 {
@@ -61,6 +62,7 @@ format_af_packet_device_name (u8 * s, va_list * args)
   s = format (s, "host-%s", apif->host_if_name);
   return s;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 static u8 *
 format_af_packet_device (u8 * s, va_list * args)
@@ -76,9 +78,9 @@ format_af_packet_tx_trace (u8 * s, va_list * args)
   return s;
 }
 
-static uword
-af_packet_interface_tx (vlib_main_t * vm,
-                       vlib_node_runtime_t * node, vlib_frame_t * frame)
+VNET_DEVICE_CLASS_TX_FN (af_packet_device_class) (vlib_main_t * vm,
+                                                 vlib_node_runtime_t * node,
+                                                 vlib_frame_t * frame)
 {
   af_packet_main_t *apm = &af_packet_main;
   u32 *buffers = vlib_frame_vector_args (frame);
@@ -330,7 +332,6 @@ error:
 /* *INDENT-OFF* */
 VNET_DEVICE_CLASS (af_packet_device_class) = {
   .name = "af-packet",
-  .tx_function = af_packet_interface_tx,
   .format_device_name = format_af_packet_device_name,
   .format_device = format_af_packet_device,
   .format_tx_trace = format_af_packet_tx_trace,
@@ -342,9 +343,6 @@ VNET_DEVICE_CLASS (af_packet_device_class) = {
   .subif_add_del_function = af_packet_subif_add_del_function,
   .mac_addr_change_function = af_packet_set_mac_address_function,
 };
-
-VLIB_DEVICE_TX_FUNCTION_MULTIARCH (af_packet_device_class,
-                                  af_packet_interface_tx)
 /* *INDENT-ON* */
 
 /*
index b14bff4..47407aa 100644 (file)
@@ -93,9 +93,9 @@ format_netmap_tx_trace (u8 * s, va_list * args)
   return s;
 }
 
-static uword
-netmap_interface_tx (vlib_main_t * vm,
-                    vlib_node_runtime_t * node, vlib_frame_t * frame)
+VNET_DEVICE_CLASS_TX_FN (netmap_device_class) (vlib_main_t * vm,
+                                              vlib_node_runtime_t * node,
+                                              vlib_frame_t * frame)
 {
   netmap_main_t *nm = &netmap_main;
   u32 *buffers = vlib_frame_vector_args (frame);
@@ -231,7 +231,6 @@ netmap_subif_add_del_function (vnet_main_t * vnm,
 /* *INDENT-OFF* */
 VNET_DEVICE_CLASS (netmap_device_class) = {
   .name = "netmap",
-  .tx_function = netmap_interface_tx,
   .format_device_name = format_netmap_device_name,
   .format_device = format_netmap_device,
   .format_tx_trace = format_netmap_tx_trace,
@@ -242,9 +241,6 @@ VNET_DEVICE_CLASS (netmap_device_class) = {
   .admin_up_down_function = netmap_interface_admin_up_down,
   .subif_add_del_function = netmap_subif_add_del_function,
 };
-
-VLIB_DEVICE_TX_FUNCTION_MULTIARCH(netmap_device_class,
-                                 netmap_interface_tx)
 /* *INDENT-ON* */
 
 /*
index 609ffb4..dbf5606 100644 (file)
@@ -46,6 +46,7 @@ static char *virtio_tx_func_error_strings[] = {
 #undef _
 };
 
+#ifndef CLIB_MARCH_VARIANT
 u8 *
 format_virtio_device_name (u8 * s, va_list * args)
 {
@@ -64,6 +65,7 @@ format_virtio_device_name (u8 * s, va_list * args)
 
   return s;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 static u8 *
 format_virtio_device (u8 * s, va_list * args)
@@ -88,6 +90,7 @@ format_virtio_tx_trace (u8 * s, va_list * args)
   return s;
 }
 
+#ifndef CLIB_MARCH_VARIANT
 inline void
 virtio_free_used_desc (vlib_main_t * vm, virtio_vring_t * vring)
 {
@@ -113,6 +116,7 @@ virtio_free_used_desc (vlib_main_t * vm, virtio_vring_t * vring)
   vring->desc_in_use = used;
   vring->last_used_idx = last;
 }
+#endif /* CLIB_MARCH_VARIANT */
 
 static_always_inline u16
 add_buffer_to_slot (vlib_main_t * vm, virtio_if_t * vif,
@@ -299,9 +303,9 @@ virtio_interface_tx_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
   return frame->n_vectors - n_left;
 }
 
-static uword
-virtio_interface_tx (vlib_main_t * vm,
-                    vlib_node_runtime_t * node, vlib_frame_t * frame)
+VNET_DEVICE_CLASS_TX_FN (virtio_device_class) (vlib_main_t * vm,
+                                              vlib_node_runtime_t * node,
+                                              vlib_frame_t * frame)
 {
   virtio_main_t *nm = &virtio_main;
   vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
@@ -391,7 +395,6 @@ virtio_subif_add_del_function (vnet_main_t * vnm,
 /* *INDENT-OFF* */
 VNET_DEVICE_CLASS (virtio_device_class) = {
   .name = "virtio",
-  .tx_function = virtio_interface_tx,
   .format_device_name = format_virtio_device_name,
   .format_device = format_virtio_device,
   .format_tx_trace = format_virtio_tx_trace,
@@ -403,9 +406,6 @@ VNET_DEVICE_CLASS (virtio_device_class) = {
   .subif_add_del_function = virtio_subif_add_del_function,
   .rx_mode_change_function = virtio_interface_rx_mode_change,
 };
-
-VLIB_DEVICE_TX_FUNCTION_MULTIARCH(virtio_device_class,
-                                 virtio_interface_tx)
 /* *INDENT-ON* */
 
 /*
index ec76057..f1d0387 100644 (file)
@@ -302,9 +302,6 @@ CLIB_MARCH_SFX (devclass##_tx_fn_multiarch_register) (void)         \
 }                                                                      \
 uword CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (devclass##_tx_fn)
 
-/* FIXME to be removed */
-#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn)
-
 /**
  * Link Type: A description of the protocol of packets on the link.
  * On an ethernet link this maps directly into the ethertype. On a GRE tunnel
index 1b6fcf3..e4f5e80 100644 (file)
 #include <vnet/vnet.h>
 #include <vnet/ipsec-gre/ipsec_gre.h>
 
+extern ipsec_gre_main_t ipsec_gre_main;
+
+#ifndef CLIB_MARCH_VARIANT
 ipsec_gre_main_t ipsec_gre_main;
+#endif /* CLIB_MARCH_VARIANT */
 
 /**
  * @brief IPv4 and GRE header union.
@@ -53,7 +57,7 @@ typedef struct
   u32 sa_id; /**< tunnel IPSec SA id */
 } ipsec_gre_tx_trace_t;
 
-u8 *
+static u8 *
 format_ipsec_gre_tx_trace (u8 * s, va_list * args)
 {
   CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *);
@@ -92,9 +96,9 @@ format_ipsec_gre_tx_trace (u8 * s, va_list * args)
  * <em>Next Index:</em>
  * - Dispatches the packet to the esp-encrypt node.
 */
-static uword
-ipsec_gre_interface_tx (vlib_main_t * vm,
-                       vlib_node_runtime_t * node, vlib_frame_t * frame)
+VNET_DEVICE_CLASS_TX_FN (ipsec_gre_device_class) (vlib_main_t * vm,
+                                                 vlib_node_runtime_t * node,
+                                                 vlib_frame_t * frame)
 {
   ipsec_gre_main_t *igm = &ipsec_gre_main;
   u32 next_index;
@@ -348,17 +352,15 @@ VNET_DEVICE_CLASS (ipsec_gre_device_class) = {
   .format_device_name = format_ipsec_gre_tunnel_name,
   .format_device = format_ipsec_gre_device,
   .format_tx_trace = format_ipsec_gre_tx_trace,
-  .tx_function = ipsec_gre_interface_tx,
   .admin_up_down_function = ipsec_gre_interface_admin_up_down,
 };
 
-VLIB_DEVICE_TX_FUNCTION_MULTIARCH (ipsec_gre_device_class,
-                                  ipsec_gre_interface_tx)
-
 
+#ifndef CLIB_MARCH_VARIANT
 VNET_HW_INTERFACE_CLASS (ipsec_gre_hw_interface_class) = {
   .name = "IPSEC-GRE",
 };
+#endif /* CLIB_MARCH_VARIANT */
 /* *INDENT-ON* */
 
 static clib_error_t *