Skip to content

Commit 8a2d9c4

Browse files
committed
Support Linux 6.11
To align with the virtio subsystem changes introduced in Linux kernel v6.11 API, this commit updates the virtqueue setup logic to use `struct virtqueue_info` and the new `virtio_find_vqs()` interface. The old `virtio_find_vqs()` interface has been reworked and renamed to use `struct virtqueue_info` starting from Linux 6.11, replacing the legacy helpers entirely. Since the original code uses `virtio_find_vqs()` (which internally passes `NULL` for ctx), `ctx` is conservatively set to `false`. ref: Introduce struct virtqueue_info and find_vqs_info() config op torvalds/linux@c502eb8 Rename virtio_find_vqs_info() to virtio_find_vqs torvalds/linux@6c85d6b Remove legacy virtio_find_vqs() and virtio_find_vqs_ctx() helpers torvalds/linux@3e8d51c
1 parent a940502 commit 8a2d9c4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

vwifi.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3167,8 +3167,23 @@ static int vwifi_virtio_init_vqs(struct virtio_device *vdev)
31673167
[VWIFI_VQ_TX] = "tx",
31683168
};
31693169

3170+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 11, 0)
3171+
struct virtqueue_info vqs_info[VWIFI_NUM_VQS];
3172+
/* Set ctx to false to maintain compatibility with legacy
3173+
* virtio_find_vqs() behavior, which implicitly passed NULL for ctx.
3174+
*/
3175+
for (int i = 0; i < VWIFI_NUM_VQS; i++) {
3176+
vqs_info[i].callback = callbacks[i];
3177+
vqs_info[i].name = names[i];
3178+
vqs_info[i].ctx = false;
3179+
}
3180+
3181+
return virtio_find_vqs(vdev, VWIFI_NUM_VQS, vwifi_vqs, vqs_info, NULL);
3182+
3183+
#else
31703184
return virtio_find_vqs(vdev, VWIFI_NUM_VQS, vwifi_vqs, callbacks, names,
31713185
NULL);
3186+
#endif
31723187
}
31733188

31743189
static void vwifi_virtio_fill_vq(struct virtqueue *vq, u8 vnet_hdr_len)

0 commit comments

Comments
 (0)