From 6809538e646bf86c000dc1faba60b0a4157ad898 Mon Sep 17 00:00:00 2001 From: Mohsin Kazmi Date: Wed, 10 Feb 2021 11:26:24 +0100 Subject: 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 --- src/vnet/buffer.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/vnet/buffer.c') 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 #include +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); -- cgit 1.2.3-korg