On Thu, Sep 25, 2025 at 06:37:08PM +0800, Jason Wang wrote:
> @@ -683,7 +707,12 @@ static inline int virtqueue_add_split(struct 
> vring_virtqueue *vq,
>       vq->vq.num_free -= descs_used;
>  
>       /* Update free pointer */
> -     if (indirect)
> +     if (virtqueue_is_in_order(vq)) {
> +             vq->free_head += descs_used;
> +             if (vq->free_head >= vq->split.vring.num)
> +                     vq->free_head -= vq->split.vring.num;
> +             vq->split.desc_state[head].total_len = total_len;;
> +     } else if (indirect)
>               vq->free_head = vq->split.desc_extra[head].next;
>       else
>               vq->free_head = i;

So in order is clearly doing something funky with the free_head.
It's no longer a head of a linked list of free descriptors, is it?
what is it doing and why?  Please add code comments to explain
both where free_list is defined and where it's used.
For example, virtqueue_vring_attach_packed only inits free_list
if not in order. So who will init it for in order? And so on.

-- 
MST


Reply via email to