summaryrefslogtreecommitdiffstats
path: root/src/vnet/buffer.c
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2021-02-10 11:26:24 +0100
committerDamjan Marion <dmarion@me.com>2021-02-15 20:32:56 +0000
commit6809538e646bf86c000dc1faba60b0a4157ad898 (patch)
tree18a228b96226932381f15e44b4972636de1c7fe1 /src/vnet/buffer.c
parent99c6dc6a7a36c0be95da9afb3ad8830b24754d4e (diff)
vlib: refactor checksum offload support
Type: refactor This patch refactors the offload flags in vlib_buffer_t. There are two main reasons behind this refactoring. First, offload flags are insufficient to represent outer and inner headers offloads. Second, room for these flags in first cacheline of vlib_buffer_t is also limited. This patch introduces a generic offload flag in first cacheline. And detailed offload flags in 2nd cacheline of the structure for performance optimization. Change-Id: Icc363a142fb9208ec7113ab5bbfc8230181f6004 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/buffer.c')
-rw-r--r--src/vnet/buffer.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/vnet/buffer.c b/src/vnet/buffer.c
index 3cb6b948d2b..b41036d8124 100644
--- a/src/vnet/buffer.c
+++ b/src/vnet/buffer.c
@@ -16,6 +16,18 @@
#include <vlib/vlib.h>
#include <vnet/buffer.h>
+u8 *
+format_vnet_buffer_offload (u8 *s, va_list *args)
+{
+ vlib_buffer_t *b = va_arg (*args, vlib_buffer_t *);
+
+#define _(bit, name, ss, v) \
+ if (v && (vnet_buffer2 (b)->oflags & VNET_BUFFER_OFFLOAD_F_##name)) \
+ s = format (s, "%s ", ss);
+ foreach_vnet_buffer_offload_flag
+#undef _
+ return s;
+}
u8 *
format_vnet_buffer (u8 * s, va_list * args)
@@ -29,7 +41,10 @@ format_vnet_buffer (u8 * s, va_list * args)
a = format (a, "%s ", ss);
foreach_vnet_buffer_flag
#undef _
- if (b->flags & VNET_BUFFER_F_L2_HDR_OFFSET_VALID)
+ if (b->flags & VNET_BUFFER_F_OFFLOAD) a =
+ format (a, "%U ", format_vnet_buffer_offload, b);
+
+ if (b->flags & VNET_BUFFER_F_L2_HDR_OFFSET_VALID)
a = format (a, "l2-hdr-offset %d ", vnet_buffer (b)->l2_hdr_offset);
if (b->flags & VNET_BUFFER_F_L3_HDR_OFFSET_VALID)
@@ -38,6 +53,9 @@ format_vnet_buffer (u8 * s, va_list * args)
if (b->flags & VNET_BUFFER_F_L4_HDR_OFFSET_VALID)
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);
+
if (b->flags & VNET_BUFFER_F_QOS_DATA_VALID)
a = format (a, "qos %d.%d ",
vnet_buffer2 (b)->qos.bits, vnet_buffer2 (b)->qos.source);