Add support for multiple microarchitectures in single binary
[vpp.git] / vnet / vnet / interface.h
index f441f9e..30dcf27 100644 (file)
@@ -163,6 +163,32 @@ static void __vnet_add_device_class_registration_##x (void)             \
 }                                                                       \
 __VA_ARGS__ vnet_device_class_t x                                       
 
+#define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt)          \
+  uword                                                                        \
+  __attribute__ ((flatten))                                            \
+  __attribute__ ((target (tgt)))                                       \
+  CLIB_CPU_OPTIMIZED                                                   \
+  fn ## _ ## arch ( vlib_main_t * vm,                                  \
+                   vlib_node_runtime_t * node,                         \
+                   vlib_frame_t * frame)                               \
+  { return fn (vm, node, frame); }
+
+#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn)                    \
+  foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn)
+
+#if CLIB_DEBUG > 0
+#define VLIB_MULTIARCH_CLONE_AND_SELECT_FN(fn,...)
+#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn)
+#else
+#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn)                     \
+  VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn)                          \
+  CLIB_MULTIARCH_SELECT_FN(fn, static inline)                          \
+  static void __attribute__((__constructor__))                         \
+  __vlib_device_tx_function_multiarch_select_##dev (void)              \
+  { dev.tx_function = fn ## _multiarch_select(); }
+#endif
+
+
 /* Layer-2 (e.g. Ethernet) interface class. */
 typedef struct _vnet_hw_interface_class {
   /* Index into main vector. */
@@ -263,6 +289,10 @@ typedef struct vnet_hw_interface_t {
    VNET_HW_INTERFACE_FLAG_SPEED_40G |          \
    VNET_HW_INTERFACE_FLAG_SPEED_100G)
 
+  /* l2output node flags */
+#define VNET_HW_INTERFACE_FLAG_L2OUTPUT_SHIFT  9
+#define VNET_HW_INTERFACE_FLAG_L2OUTPUT_MAPPED (1 << 9)
+
   /* Hardware address as vector.  Zero (e.g. zero-length vector) if no
      address for this class (e.g. PPP). */
   u8 * hw_address;
@@ -288,6 +318,12 @@ typedef struct vnet_hw_interface_t {
   /* Maximum transmit rate for this interface in bits/sec. */
   f64 max_rate_bits_per_sec;
 
+  /* Smallest packet size supported by this interface. */
+  u32 min_supported_packet_bytes;
+
+  /* Largest packet size supported by this interface. */
+  u32 max_supported_packet_bytes;
+
   /* Smallest packet size for this interface. */
   u32 min_packet_bytes;
 
@@ -307,6 +343,15 @@ typedef struct vnet_hw_interface_t {
 
   /* Count of number of L2 subinterfaces */
   u32 l2_if_count;
+
+  /* Bonded interface info -
+     0       - not a bonded interface nor a slave
+     ~0      - slave to a bonded interface
+     others  - A bonded interface with a pointer to bitmap for all slaves */
+  uword *bond_info;
+#define VNET_HW_INTERFACE_BOND_INFO_NONE ((uword *) 0)
+#define VNET_HW_INTERFACE_BOND_INFO_SLAVE ((uword *) ~0)
+
 } vnet_hw_interface_t;
 
 typedef enum {
@@ -360,6 +405,8 @@ typedef struct {
 
 #define VNET_SW_INTERFACE_FLAG_UNNUMBERED (1 << 3)
 
+#define VNET_SW_INTERFACE_FLAG_BOND_SLAVE (1 << 4)
+
   /* Index for this interface. */
   u32 sw_if_index;