Skip to contentSkip to conversation

virtio: document ENOSPC

PATCH In review Michael S. Tsirkin 5 participants 5 messages May 27, 2025 – Jun 13, 2025 virtio core

lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 virtio: document ENOSPC

drivers handle ENOSPC specially since it's an error one can get from a working VQ. Document the semantics.

---
 drivers/virtio/virtio_ring.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/virtio/virtio_ring.c +4 -0
index b784aab66867..97ab0cce527d 100644
@@ -2296,6 +2296,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
  * at the same time (except where noted).
  *
  * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
+ *
+ * NB: ENOSPC is a special code that is only returned on an attempt to add a
+ * buffer to a full VQ. It indicates that some buffers are outstanding and that
+ * the operation can be retried after some buffers have been used.
  */
 int virtqueue_add_sgs(struct virtqueue *_vq,
 		      struct scatterlist *sgs[],
Signature · 1 line
MST
Acked-by on v1 1/1
#2 lore raw
In reply to Michael S. Tsirkin
Quoted 26 lines · Michael S. Tsirkin

drivers handle ENOSPC specially since it's an error one can get from a working VQ. Document the semantics.

---
 drivers/virtio/virtio_ring.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/virtio/virtio_ring.c +4 -1
index b784aab66867..97ab0cce527d 100644
@@ -2296,6 +2296,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
  * at the same time (except where noted).
  *
  * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
+ *
+ * NB: ENOSPC is a special code that is only returned on an attempt to add a
+ * buffer to a full VQ. It indicates that some buffers are outstanding and that
+ * the operation can be retried after some buffers have been used.
  */
 int virtqueue_add_sgs(struct virtqueue *_vq,
                      struct scatterlist *sgs[],
--
Quoted 2 lines

MST

Thanks

Reviewed-by on v1 1/1
#3 lore raw
In reply to Michael S. Tsirkin
Quoted 38 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Tuesday, May 27, 2025 7:57 PM
To: [email protected]
Cc: Parav Pandit <[email protected]>; Jason Wang <[email protected]>; Xuan Zhuo <[email protected]>; Eugenio Pérez <[email protected]>; [email protected]
Subject: [PATCH] virtio: document ENOSPC

drivers handle ENOSPC specially since it's an error one can get from a working VQ. Document the semantics.

---
 drivers/virtio/virtio_ring.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/virtio/virtio_ring.c index renamed from drivers/virtio/virtio_ring.c +0 -0

b784aab66867..97ab0cce527d 100644

drivers/virtio/virtio_ring.c +6 -1
@@ -2296,6 +2296,10 @@ static inline int virtqueue_add(struct virtqueue
 *_vq,
  * at the same time (except where noted).
  *
  * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
+ *
+ * NB: ENOSPC is a special code that is only returned on an attempt to
+ add a
+ * buffer to a full VQ. It indicates that some buffers are outstanding
+ and that
+ * the operation can be retried after some buffers have been used.
  */
 int virtqueue_add_sgs(struct virtqueue *_vq,
 		      struct scatterlist *sgs[],
--
Quoted 1 line

MST

reviewer Reviewed-by on v1 1/1
#4 lore raw
In reply to Michael S. Tsirkin
Quoted 5 lines · Michael S. Tsirkin

drivers handle ENOSPC specially since it's an error one can get from a working VQ. Document the semantics.

Quoted 22 lines
---
 drivers/virtio/virtio_ring.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/virtio/virtio_ring.c +4 -1
index b784aab66867..97ab0cce527d 100644
@@ -2296,6 +2296,10 @@ static inline int virtqueue_add(struct virtqueue *_vq,
  * at the same time (except where noted).
  *
  * Returns zero or a negative error (ie. ENOSPC, ENOMEM, EIO).
+ *
+ * NB: ENOSPC is a special code that is only returned on an attempt to add a
+ * buffer to a full VQ. It indicates that some buffers are outstanding and that
+ * the operation can be retried after some buffers have been used.
  */
 int virtqueue_add_sgs(struct virtqueue *_vq,
 		      struct scatterlist *sgs[],
--

MST