summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2024-02-16 17:30:41 +0000
committerBeno�t Ganne <bganne@cisco.com>2024-02-26 16:15:48 +0000
commit84847c4762e48d600e1ce506631937483e09c8d8 (patch)
treea6048de2e99176b8d690624f44838bb41a6f9968 /src/vnet
parent4e16e782ad896c78f64ebad2b8e7a2e03049ffb4 (diff)
virtio: fix the packed ring support
Type: fix Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: If27702d2a9755e0e0a6eaeab4cf26b4974444b44
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/devices/virtio/node.c18
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;