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 core logic of buffer detaching

Factor out core logic of buffer detaching and leave the free list
management to the caller so in_order can just call the core logic.

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

authored by

Jason Wang and committed by
Michael S. Tsirkin
c623106c 03f05c4e

+13 -4
+13 -4
drivers/virtio/virtio_ring.c
··· 1665 1665 return needs_kick; 1666 1666 } 1667 1667 1668 - static void detach_buf_packed(struct vring_virtqueue *vq, 1669 - unsigned int id, void **ctx) 1668 + static void detach_buf_packed_in_order(struct vring_virtqueue *vq, 1669 + unsigned int id, void **ctx) 1670 1670 { 1671 1671 struct vring_desc_state_packed *state = NULL; 1672 1672 struct vring_packed_desc *desc; ··· 1677 1677 /* Clear data ptr. */ 1678 1678 state->data = NULL; 1679 1679 1680 - vq->packed.desc_extra[state->last].next = vq->free_head; 1681 - vq->free_head = id; 1682 1680 vq->vq.num_free += state->num; 1683 1681 1684 1682 if (unlikely(vq->use_map_api)) { ··· 1711 1713 } else if (ctx) { 1712 1714 *ctx = state->indir_desc; 1713 1715 } 1716 + } 1717 + 1718 + static void detach_buf_packed(struct vring_virtqueue *vq, 1719 + unsigned int id, void **ctx) 1720 + { 1721 + struct vring_desc_state_packed *state = &vq->packed.desc_state[id]; 1722 + 1723 + vq->packed.desc_extra[state->last].next = vq->free_head; 1724 + vq->free_head = id; 1725 + 1726 + detach_buf_packed_in_order(vq, id, ctx); 1714 1727 } 1715 1728 1716 1729 static inline bool is_used_desc_packed(const struct vring_virtqueue *vq,