aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2021-06-17 14:33:03 +0200
committerDamjan Marion <dmarion@me.com>2021-07-16 12:02:53 +0000
commit537e955545c54820e9a6a54225bfb280f7cd7763 (patch)
treea0e421b92d1b9357e8a1b2e9b6010ec9b2ef14f2
parent9a554eea0e5b3e2b36c30ce2725f364380bdd55c (diff)
vlib: add tunnel offload flags for vlib_buffer_t
Type: improvement Change-Id: Iaad50b2044702c46eff287708dfcb24e61022104 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
-rw-r--r--src/vnet/buffer.c11
-rw-r--r--src/vnet/buffer.h10
2 files changed, 18 insertions, 3 deletions
diff --git a/src/vnet/buffer.c b/src/vnet/buffer.c
index 545018a79e9..ef93185b2c1 100644
--- a/src/vnet/buffer.c
+++ b/src/vnet/buffer.c
@@ -26,6 +26,14 @@ format_vnet_buffer_offload (u8 *s, va_list *args)
s = format (s, "%s ", ss);
foreach_vnet_buffer_offload_flag
#undef _
+
+ if (vnet_buffer (b)->oflags & VNET_BUFFER_OFFLOAD_F_TNL_MASK)
+ {
+ s = format (s, "outer-l3-hdr-offset %d ",
+ vnet_buffer2 (b)->outer_l3_hdr_offset);
+ s = format (s, "outer-l4-hdr-offset %d ",
+ vnet_buffer2 (b)->outer_l4_hdr_offset);
+ }
return s;
}
@@ -54,7 +62,8 @@ format_vnet_buffer (u8 * s, va_list * args)
a = format (a, "l4-hdr-offset %d ", vnet_buffer (b)->l4_hdr_offset);
if (b->flags & VNET_BUFFER_F_GSO)
- a = format (a, "gso gso-size %d", vnet_buffer2 (b)->gso_size);
+ a = format (a, "gso l4-hdr-len %d gso-size %d",
+ vnet_buffer2 (b)->gso_l4_hdr_sz, vnet_buffer2 (b)->gso_size);
if (b->flags & VNET_BUFFER_F_QOS_DATA_VALID)
a = format (a, "qos %d.%d ",
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index 0798de4cf63..600782c3864 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -112,8 +112,9 @@ STATIC_ASSERT (((VNET_BUFFER_FLAGS_ALL_AVAIL & VLIB_BUFFER_FLAGS_ALL) == 0),
_ (1, TCP_CKSUM, "offload-tcp-cksum", 1) \
_ (2, UDP_CKSUM, "offload-udp-cksum", 1) \
_ (3, OUTER_IP_CKSUM, "offload-outer-ip-cksum", 1) \
- _ (4, OUTER_TCP_CKSUM, "offload-outer-tcp-cksum", 1) \
- _ (5, OUTER_UDP_CKSUM, "offload-outer-udp-cksum", 1)
+ _ (4, OUTER_UDP_CKSUM, "offload-outer-udp-cksum", 1) \
+ _ (5, TNL_VXLAN, "offload-vxlan-tunnel", 1) \
+ _ (6, TNL_IPIP, "offload-ipip-tunnel", 1)
typedef enum
{
@@ -122,6 +123,9 @@ typedef enum
#undef _
} vnet_buffer_oflags_t;
+#define VNET_BUFFER_OFFLOAD_F_TNL_MASK \
+ (VNET_BUFFER_OFFLOAD_F_TNL_VXLAN | VNET_BUFFER_OFFLOAD_F_TNL_IPIP)
+
#define foreach_buffer_opaque_union_subtype \
_(ip) \
_(l2) \
@@ -473,6 +477,8 @@ typedef struct
u16 gso_size;
/* size of L4 prototol header */
u16 gso_l4_hdr_sz;
+ i16 outer_l3_hdr_offset;
+ i16 outer_l4_hdr_offset;
};
struct