aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2021-02-18 10:34:33 +0100
committerDamjan Marion <dmarion@me.com>2021-02-23 10:01:15 +0000
commitaa80f07209d85e3fa32d7c404f2d55cf97cf343f (patch)
treea75591860ff9ae3507f2c97dbf6a79dcf763569f /src
parent5fdc47c237b3e370dc18d3ed593ce3bd7c346110 (diff)
vlib: fix offload flags value reset
When a buffer is freed and re-allocated for a new packet, opaque2 is not reset, so the offload flags can be set to a stale value. Make sure the offload flags are reset to the current value on 1st set. Type: fix Fixes: 6809538e646bf86c000dc1faba60b0a4157ad898 Change-Id: I4048febedf25b9995dbd080a11495ee7dbe59153 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/vnet/buffer.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index fb734d5acde..bd70ea2722f 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -524,8 +524,17 @@ format_function_t format_vnet_buffer_offload;
static_always_inline void
vnet_buffer_offload_flags_set (vlib_buffer_t *b, u32 oflags)
{
- vnet_buffer2 (b)->oflags |= oflags;
- b->flags |= VNET_BUFFER_F_OFFLOAD;
+ if (b->flags & VNET_BUFFER_F_OFFLOAD)
+ {
+ /* add a flag to existing offload */
+ vnet_buffer2 (b)->oflags |= oflags;
+ }
+ else
+ {
+ /* no offload yet: reset offload flags to new value */
+ vnet_buffer2 (b)->oflags = oflags;
+ b->flags |= VNET_BUFFER_F_OFFLOAD;
+ }
}
static_always_inline void