virtio: fix the packed ring support

Type: fix

Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Change-Id: If27702d2a9755e0e0a6eaeab4cf26b4974444b44
This commit is contained in:
Mohsin Kazmi
2024-02-16 17:30:41 +00:00
committed by Beno�t Ganne
parent 4e16e782ad
commit 84847c4762
+18
View File
@@ -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;