diff options
Diffstat (limited to 'src/vnet/devices/virtio/node.c')
-rw-r--r-- | src/vnet/devices/virtio/node.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c index b329fdd7719..09478b1c32f 100644 --- a/src/vnet/devices/virtio/node.c +++ b/src/vnet/devices/virtio/node.c @@ -206,6 +206,19 @@ virtio_get_len (vnet_virtio_vring_t *vring, const int packed, const int hdr_sz, return vring->used->ring[last & mask].len - hdr_sz; } +#define virtio_packed_check_n_left(vring, last) \ + do \ + { \ + vnet_virtio_vring_packed_desc_t *d = &vring->packed_desc[last]; \ + u16 flags = d->flags; \ + if ((flags & VRING_DESC_F_AVAIL) != (vring->used_wrap_counter << 7) || \ + (flags & VRING_DESC_F_USED) != (vring->used_wrap_counter << 15)) \ + { \ + n_left = 0; \ + } \ + } \ + while (0) + #define increment_last(last, packed, vring) \ do \ { \ @@ -261,6 +274,11 @@ virtio_device_input_gso_inline (vlib_main_t *vm, vlib_node_runtime_t *node, u16 n_left = virtio_n_left_to_process (vring, packed); vlib_buffer_t bt = {}; + if (packed) + { + virtio_packed_check_n_left (vring, last); + } + if (n_left == 0) return 0; |