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;
}
vring_unmap_one_split(vq, &extra[i]);
- extra[i].next = vq->free_head;
- vq->free_head = head;
/* Plus final descriptor */
vq->vq.num_free++;
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,