Introduce l{2,3,4}_hdr_offset fields in the buffer metadata
[vpp.git] / src / vnet / buffer.h
index ec5e2f7..8647db0 100644 (file)
@@ -71,7 +71,6 @@
 #define VNET_BUFFER_SPAN_CLONE (1 << LOG2_VNET_BUFFER_SPAN_CLONE)
 
 #define foreach_buffer_opaque_union_subtype     \
-_(ethernet)                                     \
 _(ip)                                           \
 _(swt)                                          \
 _(l2)                                           \
@@ -100,16 +99,12 @@ _(tcp)
 typedef struct
 {
   u32 sw_if_index[VLIB_N_RX_TX];
+  i16 l2_hdr_offset;
+  i16 l3_hdr_offset;
+  i16 l4_hdr_offset;
 
   union
   {
-    /* Ethernet. */
-    struct
-    {
-      /* Saved value of current header by ethernet-input. */
-      i32 start_of_ethernet_header;
-    } ethernet;
-
     /* IP4/6 buffer opaque. */
     struct
     {
@@ -143,9 +138,6 @@ typedef struct
          u8 code;
          u32 data;
        } icmp;
-
-       /* IP header offset from vlib_buffer.data - saved by ip*_local nodes */
-       i32 start_of_ip_header;
       };
 
     } ip;
@@ -170,7 +162,7 @@ typedef struct
     } swt;
 
     /* l2 bridging path, only valid there */
-    struct
+    struct opaque_l2
     {
       u32 feature_bitmap;
       u16 bd_index;            /* bridge-domain index */
@@ -195,9 +187,12 @@ typedef struct
     /* L2 classify */
     struct
     {
-      u64 pad;
-      u32 table_index;
-      u32 opaque_index;
+      struct opaque_l2 pad;
+      union
+      {
+       u32 table_index;
+       u32 opaque_index;
+      };
       u64 hash;
     } l2_classify;
 
@@ -293,8 +288,8 @@ typedef struct
  * 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),
+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)