mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
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>
This commit is contained in:
committed by
Michael S. Tsirkin
parent
9dc6b944f1
commit
519b206e30
@@ -805,8 +805,9 @@ static void detach_indirect_split(struct vring_virtqueue *vq,
|
||||
vq->split.desc_state[head].indir_desc = NULL;
|
||||
}
|
||||
|
||||
static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
|
||||
void **ctx)
|
||||
static unsigned detach_buf_split_in_order(struct vring_virtqueue *vq,
|
||||
unsigned int head,
|
||||
void **ctx)
|
||||
{
|
||||
struct vring_desc_extra *extra;
|
||||
unsigned int i;
|
||||
@@ -826,8 +827,6 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
|
||||
}
|
||||
|
||||
vring_unmap_one_split(vq, &extra[i]);
|
||||
extra[i].next = vq->free_head;
|
||||
vq->free_head = head;
|
||||
|
||||
/* Plus final descriptor */
|
||||
vq->vq.num_free++;
|
||||
@@ -836,6 +835,17 @@ static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
|
||||
detach_indirect_split(vq, head);
|
||||
else if (ctx)
|
||||
*ctx = vq->split.desc_state[head].indir_desc;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static void detach_buf_split(struct vring_virtqueue *vq, unsigned int head,
|
||||
void **ctx)
|
||||
{
|
||||
unsigned int i = detach_buf_split_in_order(vq, head, ctx);
|
||||
|
||||
vq->split.desc_extra[i].next = vq->free_head;
|
||||
vq->free_head = head;
|
||||
}
|
||||
|
||||
static bool virtqueue_poll_split(const struct vring_virtqueue *vq,
|
||||
|
||||
Reference in New Issue
Block a user