Skip to content

Commit

Permalink
virtio: Extend the admin command to include the result size
Browse files Browse the repository at this point in the history
Extend the admin command by incorporating a result size field.

This allows higher layers to determine the actual result size from the
backend when this information is not included in the result_sg.

The additional information introduced here will be used in subsequent
patches of this series.

Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Link: https://lore.kernel.org/r/20241113115200.209269-3-yishaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
  • Loading branch information
Yishai Hadas authored and Alex Williamson committed Nov 13, 2024
1 parent 7c1ae15 commit 704806c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/virtio/virtio_pci_modern.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ void vp_modern_avq_done(struct virtqueue *vq)
spin_lock_irqsave(&admin_vq->lock, flags);
do {
virtqueue_disable_cb(vq);
while ((cmd = virtqueue_get_buf(vq, &len)))
while ((cmd = virtqueue_get_buf(vq, &len))) {
cmd->result_sg_size = len;
complete(&cmd->completion);
}
} while (!virtqueue_enable_cb(vq));
spin_unlock_irqrestore(&admin_vq->lock, flags);
}
Expand Down
1 change: 1 addition & 0 deletions include/linux/virtio.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ struct virtio_admin_cmd {
struct scatterlist *data_sg;
struct scatterlist *result_sg;
struct completion completion;
u32 result_sg_size;
int ret;
};

Expand Down

0 comments on commit 704806c

Please sign in to comment.