Thread (41 messages) 41 messages, 2 authors, 2025-09-24

Re: [PATCH V6 14/19] virtio_ring: determine descriptor flags at one time

From: Jason Wang <hidden>
Date: 2025-09-22 00:48:15
Also in: lkml

On Mon, Sep 22, 2025 at 1:44 AM Michael S. Tsirkin [off-list ref] wrote:
On Fri, Sep 19, 2025 at 03:31:49PM +0800, Jason Wang wrote:
quoted
Let's determine the last descriptor by counting the number of sg. This
would be consistent with packed virtqueue implementation and ease the
future in-order implementation.

Acked-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Jason Wang <redacted>
---
 drivers/virtio/virtio_ring.c | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 1045c553ee65..0949675a3d12 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -574,7 +574,7 @@ static inline int virtqueue_add_split(struct vring_virtqueue *vq,
      struct vring_desc_extra *extra;
      struct scatterlist *sg;
      struct vring_desc *desc;
-     unsigned int i, n, avail, descs_used, prev, err_idx;
+     unsigned int i, n, avail, descs_used, err_idx, c = 0;
      int head;
      bool indirect;
@@ -631,6 +631,7 @@ static inline int virtqueue_add_split(struct vring_virtqueue *vq,
      }

      for (n = 0; n < out_sgs; n++) {
+             sg = sgs[n];
              for (sg = sgs[n]; sg; sg = sg_next(sg)) {
                      dma_addr_t addr;
                      u32 len;
How does this make any sense?
Let me drop this unnecessary assignment.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help