From 800ad3246f800839b63a256f35f605b8ec19889f Mon Sep 17 00:00:00 2001 From: horseface Date: Tue, 27 May 2025 04:55:15 +0000 Subject: [PATCH] Support Linux v6.11 Update virtqueue setup to use the new virtio_find_vqs() interface introduced in Linux commit c502eb8 ("virtio: Introduce struct virtqueue_info and find_vqs_info() config op"), which now takes an array of struct virtqueue_info instead of separate parameter arrays. The legacy virtio_find_vqs() interface was replaced in Linux commit 6c85d6b ("virtio: Rename virtio_find_vqs_info() to virtio_find_vqs") with a new implementation using struct virtqueue_info. Since the original code relied on virtio_find_vqs() with implicit NULL context, the ctx field is set to false to maintain equivalent behavior. --- vwifi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/vwifi.c b/vwifi.c index 318cdee..a4fd676 100644 --- a/vwifi.c +++ b/vwifi.c @@ -3167,8 +3167,23 @@ static int vwifi_virtio_init_vqs(struct virtio_device *vdev) [VWIFI_VQ_TX] = "tx", }; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0) + struct virtqueue_info vqs_info[VWIFI_NUM_VQS]; + /* Set ctx to false to maintain compatibility with legacy + * virtio_find_vqs() behavior, which implicitly passed NULL for ctx. + */ + for (int i = 0; i < VWIFI_NUM_VQS; i++) { + vqs_info[i].callback = callbacks[i]; + vqs_info[i].name = names[i]; + vqs_info[i].ctx = false; + } + + return virtio_find_vqs(vdev, VWIFI_NUM_VQS, vwifi_vqs, vqs_info, NULL); + +#else return virtio_find_vqs(vdev, VWIFI_NUM_VQS, vwifi_vqs, callbacks, names, NULL); +#endif } static void vwifi_virtio_fill_vq(struct virtqueue *vq, u8 vnet_hdr_len)