session: mark apis for deprecation
[vpp.git] / src / vnet / interface.h
index d869b0c..6ca2b0d 100644 (file)
@@ -69,7 +69,8 @@ typedef clib_error_t *(vnet_subif_add_del_function_t)
 
 /* Interface set mac address callback. */
 typedef clib_error_t *(vnet_interface_set_mac_address_function_t)
-  (struct vnet_hw_interface_t * hi, char *address);
+  (struct vnet_hw_interface_t * hi,
+   const u8 * old_address, const u8 * new_address);
 
 /* Interface set rx mode callback. */
 typedef clib_error_t *(vnet_interface_set_rx_mode_function_t)
@@ -89,7 +90,7 @@ typedef enum
   VNET_FLOW_DEV_OP_RESET_COUNTER,
 } vnet_flow_dev_op_t;
 
-/* Interface flow opeations callback. */
+/* Interface flow operations callback. */
 typedef int (vnet_flow_dev_ops_function_t) (struct vnet_main_t * vnm,
                                            vnet_flow_dev_op_t op,
                                            u32 hw_if_index, u32 index,
@@ -108,6 +109,7 @@ typedef struct _vnet_interface_function_list_elt
   clib_error_t *(*fp) (struct vnet_main_t * vnm, u32 if_index, u32 flags);
 } _vnet_interface_function_list_elt_t;
 
+#ifndef CLIB_MARCH_VARIANT
 #define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p)                    \
                                                                         \
 static void __vnet_interface_function_init_##tag##_##f (void)           \
@@ -146,6 +148,12 @@ static void __vnet_interface_function_deinit_##tag##_##f (void)         \
       next = next->next_interface_function;                             \
     }                                                                   \
 }
+#else
+/* create unused pointer to silence compiler warnings and get whole
+   function optimized out */
+#define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p)                    \
+static __clib_unused void * __clib_unused_##f = f;
+#endif
 
 #define _VNET_INTERFACE_FUNCTION_DECL(f,tag)                            \
   _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,VNET_ITF_FUNC_PRIORITY_LOW)
@@ -195,6 +203,9 @@ typedef struct _vnet_device_class
   /* Transmit function. */
   vlib_node_function_t *tx_function;
 
+  /* Transmit function candidate registration with priority */
+  vlib_node_fn_registration_t *tx_fn_registrations;
+
   /* Error strings indexed by error code for this node. */
   char **tx_function_error_strings;
 
@@ -245,6 +256,7 @@ typedef struct _vnet_device_class
   vnet_interface_set_mac_address_function_t *mac_addr_change_function;
 } vnet_device_class_t;
 
+#ifndef CLIB_MARCH_VARIANT
 #define VNET_DEVICE_CLASS(x,...)                                        \
   __VA_ARGS__ vnet_device_class_t x;                                    \
 static void __vnet_add_device_class_registration_##x (void)             \
@@ -264,6 +276,30 @@ static void __vnet_rm_device_class_registration_##x (void)              \
                                   &x, next_class_registration);         \
 }                                                                       \
 __VA_ARGS__ vnet_device_class_t x
+#else
+/* create unused pointer to silence compiler warnings and get whole
+   function optimized out */
+#define VNET_DEVICE_CLASS(x,...)                                        \
+static __clib_unused vnet_device_class_t __clib_unused_##x
+#endif
+
+#define VNET_DEVICE_CLASS_TX_FN(devclass)                              \
+uword CLIB_MARCH_SFX (devclass##_tx_fn)();                             \
+static vlib_node_fn_registration_t                                     \
+  CLIB_MARCH_SFX(devclass##_tx_fn_registration) =                      \
+  { .function = &CLIB_MARCH_SFX (devclass##_tx_fn), };                 \
+                                                                       \
+static void __clib_constructor                                         \
+CLIB_MARCH_SFX (devclass##_tx_fn_multiarch_register) (void)            \
+{                                                                      \
+  extern vnet_device_class_t devclass;                                 \
+  vlib_node_fn_registration_t *r;                                      \
+  r = &CLIB_MARCH_SFX (devclass##_tx_fn_registration);                 \
+  r->priority = CLIB_MARCH_FN_PRIORITY();                              \
+  r->next_registration = devclass.tx_fn_registrations;                 \
+  devclass.tx_fn_registrations = r;                                    \
+}                                                                      \
+uword CLIB_CPU_OPTIMIZED CLIB_MARCH_SFX (devclass##_tx_fn)
 
 #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt)          \
   uword                                                                        \
@@ -393,7 +429,7 @@ typedef struct _vnet_hw_interface_class
                        u32 sw_if_index,
                        vnet_link_t link_type, const void *dst_hw_address);
 
-  /* Update an adjacecny added by FIB (as opposed to via the
+  /* Update an adjacency added by FIB (as opposed to via the
    * neighbour resolution protocol). */
   void (*update_adjacency) (struct vnet_main_t * vnm,
                            u32 sw_if_index, u32 adj_index);
@@ -650,7 +686,7 @@ extern vnet_mtu_t vnet_link_to_mtu (vnet_link_t link);
 
 typedef enum vnet_sw_interface_flags_t_
 {
-  /* Interface is "up" meaning adminstratively up.
+  /* Interface is "up" meaning administratively up.
      Up in the sense of link state being up is maintained by hardware interface. */
   VNET_SW_INTERFACE_FLAG_ADMIN_UP = (1 << 0),