mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
virtio_ring: reset IN_ORDER state in virtqueue_init()
The IN_ORDER feature uses additional software state to track the next
available descriptor and in-flight descriptor batches.
virtqueue_init() resets the common virtqueue state, but free_head and
batch_last.id are initialized only when the virtqueue is created. When
an IN_ORDER virtqueue is reset, these fields can retain state from the
previous queue instance.
Reset free_head and invalidate batch_last when initializing an IN_ORDER
virtqueue. Keep this in virtqueue_init() so the state is initialized
consistently for both newly created and reset virtqueues.
Fixes: f6a15d8549 ("virtio_ring: add in order support")
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260910123903.1717-1-lirongqing@baidu.com>
This commit is contained in:
parent
62b0a9b11e
commit
d7825623a9
|
|
@ -559,6 +559,11 @@ static void virtqueue_init(struct vring_virtqueue *vq, u32 num)
|
|||
vq->in_use = false;
|
||||
vq->last_add_time_valid = false;
|
||||
#endif
|
||||
|
||||
if (virtqueue_is_in_order(vq)) {
|
||||
vq->free_head = 0;
|
||||
vq->batch_last.id = UINT_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user