[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC 5/8] virtio-net: in-order handling
From: |
Jonah Palmer |
Subject: |
[RFC 5/8] virtio-net: in-order handling |
Date: |
Thu, 21 Mar 2024 11:57:14 -0400 |
Implements in-order handling for the virtio-net device.
Since virtio-net utilizes batching for its Rx VirtQueue, the device is
responsible for calling virtqueue_flush once it has completed its
batching operation.
Note:
-----
It's unclear if this implementation is really necessary to "guarantee"
that used VirtQueueElements are put on the used ring in-order since, by
design, virtio-net already does this with its Rx VirtQueue.
Signed-off-by: Jonah Palmer <jonah.palmer@oracle.com>
---
hw/net/virtio-net.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9959f1932b..b0375f7e5e 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -2069,7 +2069,11 @@ static ssize_t virtio_net_receive_rcu(NetClientState
*nc, const uint8_t *buf,
for (j = 0; j < i; j++) {
/* signal other side */
- virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
+ if (virtio_vdev_has_feature(vdev, VIRTIO_F_IN_ORDER)) {
+ virtqueue_order_element(q->rx_vq, elems[j], lens[j], j, 0);
+ } else {
+ virtqueue_fill(q->rx_vq, elems[j], lens[j], j);
+ }
g_free(elems[j]);
}
--
2.39.3
[RFC 5/8] virtio-net: in-order handling,
Jonah Palmer <=
[RFC 6/8] vhost-svq: in-order handling, Jonah Palmer, 2024/03/21
[RFC 8/8] virtio: Add VIRTIO_F_IN_ORDER property definition, Jonah Palmer, 2024/03/21
Re: [RFC 0/8] virtio,vhost: Add VIRTIO_F_IN_ORDER support, Dongli Zhang, 2024/03/21
Re: [RFC 0/8] virtio,vhost: Add VIRTIO_F_IN_ORDER support, Eugenio Perez Martin, 2024/03/22