span: add tx functionality and support for multiple mirror ports
[vpp.git] / vnet / vnet / buffer.h
index fafb318..898c94e 100644 (file)
 #define ETH_BUFFER_VLAN_BITS (ETH_BUFFER_VLAN_1_DEEP | \
                               ETH_BUFFER_VLAN_2_DEEP)
 
-#define LOG2_BUFFER_OUTPUT_FEAT_DONE LOG2_VLIB_BUFFER_FLAG_USER(5)
-#define BUFFER_OUTPUT_FEAT_DONE (1 << LOG2_BUFFER_OUTPUT_FEAT_DONE)
+#define LOG2_VNET_BUFFER_RTE_MBUF_VALID LOG2_VLIB_BUFFER_FLAG_USER(5)
+#define VNET_BUFFER_RTE_MBUF_VALID (1 << LOG2_VNET_BUFFER_RTE_MBUF_VALID)
 
 #define LOG2_BUFFER_HANDOFF_NEXT_VALID LOG2_VLIB_BUFFER_FLAG_USER(6)
 #define BUFFER_HANDOFF_NEXT_VALID (1 << LOG2_BUFFER_HANDOFF_NEXT_VALID)
 
+#define LOG2_VNET_BUFFER_LOCALLY_ORIGINATED LOG2_VLIB_BUFFER_FLAG_USER(7)
+#define VNET_BUFFER_LOCALLY_ORIGINATED (1 << LOG2_VNET_BUFFER_LOCALLY_ORIGINATED)
+
+#define LOG2_VNET_BUFFER_SPAN_CLONE LOG2_VLIB_BUFFER_FLAG_USER(8)
+#define VNET_BUFFER_SPAN_CLONE (1 << LOG2_VNET_BUFFER_SPAN_CLONE)
+
 #define foreach_buffer_opaque_union_subtype     \
 _(ethernet)                                     \
 _(ip)                                           \
@@ -78,7 +84,7 @@ _(gre)                                          \
 _(l2_classify)                                  \
 _(handoff)                                      \
 _(policer)                                      \
-_(output_features)                             \
+_(ipsec)                                       \
 _(map)                                         \
 _(map_t)                                       \
 _(ip_frag)
@@ -140,6 +146,18 @@ typedef struct
       };
     } ip;
 
+    /*
+     * MPLS:
+     * data copied from the MPLS header that was popped from the packet
+     * during the look-up.
+     */
+    struct
+    {
+      u8 ttl;
+      u8 exp;
+      u8 first;
+    } mpls;
+
     /* Multicast replication */
     struct
     {
@@ -203,11 +221,9 @@ typedef struct
     /* interface output features */
     struct
     {
-      u32 ipsec_flags;
-      u32 ipsec_sad_index;
-      u32 unused[3];
-      u32 bitmap;
-    } output_features;
+      u32 flags;
+      u32 sad_index;
+    } ipsec;
 
     /* vcgn udp inside input, only valid there */
     struct
@@ -330,6 +346,14 @@ typedef struct
   };
 } vnet_buffer_opaque_t;
 
+/*
+ * The opaque field of the vlib_buffer_t is intepreted as a
+ * vnet_buffer_opaque_t. Hence it should be big enough to accommodate one.
+ */
+STATIC_ASSERT (sizeof (vnet_buffer_opaque_t) <= STRUCT_SIZE_OF (vlib_buffer_t,
+                                                               opaque),
+              "VNET buffer meta-data too large for vlib_buffer");
+
 #define vnet_buffer(b) ((vnet_buffer_opaque_t *) (b)->opaque)
 
 /* Full cache line (64 bytes) of additional space */