Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

virtio_ring: factor out split detaching logic

This patch factors out the split core detaching logic that could be
reused by in order feature into a dedicated function.

Acked-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Eugenio Pérez <eperezma@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20251230064649.55597-19-jasowang@redhat.com>

authored by

Jason Wang and committed by
Michael S. Tsirkin
519b206e 9dc6b944

+14 -4
+14 -4
drivers/virtio/virtio_ring.c
··· 805 805 vq->split.desc_state[head].indir_desc = NULL; 806 806 } 807 807 808 - static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head, 809 - void **ctx) 808 + static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq, 809 + unsigned int head, 810 + void **ctx) 810 811 { 811 812 struct vring_desc_extra *extra; 812 813 unsigned int i; ··· 827 826 } 828 827 829 828 vring_unmap_one_split(vq, &extra[i]); 830 - extra[i].next = vq->free_head; 831 - vq->free_head = head; 832 829 833 830 /* Plus final descriptor */ 834 831 vq->vq.num_free++; ··· 835 836 detach_indirect_split(vq, head); 836 837 else if (ctx) 837 838 *ctx = vq->split.desc_state[head].indir_desc; 839 + 840 + return i; 841 + } 842 + 843 + static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head, 844 + void **ctx) 845 + { 846 + unsigned int i = detach_buf_split_in_order(vq, head, ctx); 847 + 848 + vq->split.desc_extra[i].next = vq->free_head; 849 + vq->free_head = head; 838 850 } 839 851 840 852 static bool virtqueue_poll_split(const struct vring_virtqueue *vq,