[openwrt/openwrt] mac80211: fix build error on kernel 6.6

LEDE Commits lede-commits at lists.infradead.org
Thu Sep 26 23:20:31 PDT 2024


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/f03163adc5b43b008bd19ea8b3ffcf6589857e85

commit f03163adc5b43b008bd19ea8b3ffcf6589857e85
Author: Shiji Yang <yangshiji66 at qq.com>
AuthorDate: Fri Sep 27 09:51:22 2024 +0800

    mac80211: fix build error on kernel 6.6
    
    The virtio_find_vqs() ABI has been changed since the 6.11 kernel.
    Switch back to using the old ABI to fix the build error:
    
    ../mac80211-regular/backports-6.11/drivers/net/wireless/virtual/mac80211_hwsim.c: In function 'init_vqs':
    ../mac80211-regular/backports-6.11/drivers/net/wireless/virtual/mac80211_hwsim.c:6632:31: error: array type has incomplete element type 'struct virtqueue_info'
     6632 |         struct virtqueue_info vqs_info[HWSIM_NUM_VQS] = {
          |                               ^~~~~~~~
    ../mac80211-regular/backports-6.11/drivers/net/wireless/virtual/mac80211_hwsim.c:6637:16: error: too few arguments to function 'virtio_find_vqs'
     6637 |         return virtio_find_vqs(vdev, HWSIM_NUM_VQS,
          |                ^~~~~~~~~~~~~~~
    In file included from ../mac80211-regular/backports-6.11/drivers/net/wireless/virtual/mac80211_hwsim.c:38:
    ./include/linux/virtio_config.h:224:5: note: declared here
      224 | int virtio_find_vqs(struct virtio_device *vdev, unsigned nvqs,
          |     ^~~~~~~~~~~~~~~
    ../mac80211-regular/backports-6.11/drivers/net/wireless/virtual/mac80211_hwsim.c:6632:31: error: unused variable 'vqs_info' [-Werror=unused-variable]
     6632 |         struct virtqueue_info vqs_info[HWSIM_NUM_VQS] = {
          |                               ^~~~~~~~
    ../mac80211-regular/backports-6.11/drivers/net/wireless/virtual/mac80211_hwsim.c:6639:1: error: control reaches end of non-void function [-Werror=return-type]
     6639 | }
          | ^
    
    Signed-off-by: Shiji Yang <yangshiji66 at qq.com>
---
 ...35-fix-init_vqs-build-error-on-kernel-6.6.patch | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch b/package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch
new file mode 100644
index 0000000000..4b0fe6003f
--- /dev/null
+++ b/package/kernel/mac80211/patches/build/235-fix-init_vqs-build-error-on-kernel-6.6.patch
@@ -0,0 +1,30 @@
+--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
++++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
+@@ -6629,6 +6629,7 @@ static void hwsim_virtio_rx_done(struct
+ 
+ static int init_vqs(struct virtio_device *vdev)
+ {
++#if LINUX_VERSION_IS_GEQ(6,11,0)
+ 	struct virtqueue_info vqs_info[HWSIM_NUM_VQS] = {
+ 		[HWSIM_VQ_TX] = { "tx", hwsim_virtio_tx_done },
+ 		[HWSIM_VQ_RX] = { "rx", hwsim_virtio_rx_done },
+@@ -6636,6 +6637,19 @@ static int init_vqs(struct virtio_device
+ 
+ 	return virtio_find_vqs(vdev, HWSIM_NUM_VQS,
+ 			       hwsim_vqs, vqs_info, NULL);
++#else /* Using the old ABI, copied from kernel 6.6 */
++	vq_callback_t *callbacks[HWSIM_NUM_VQS] = {
++		[HWSIM_VQ_TX] = hwsim_virtio_tx_done,
++		[HWSIM_VQ_RX] = hwsim_virtio_rx_done,
++	};
++	const char *names[HWSIM_NUM_VQS] = {
++		[HWSIM_VQ_TX] = "tx",
++		[HWSIM_VQ_RX] = "rx",
++	};
++
++	return virtio_find_vqs(vdev, HWSIM_NUM_VQS,
++			       hwsim_vqs, callbacks, names, NULL);
++#endif
+ }
+ 
+ static int fill_vq(struct virtqueue *vq)




More information about the lede-commits mailing list