From 4212f116b41ddcbce3aa3807afc11d7b75a40d97 Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 14 Dec 2022 01:52:15 +0800 Subject: [PATCH] mac80211: backports linux 6.1 support --- .../subsys/995-backport-pskb_pull.patch | 27 +++++++++++++++ .../subsys/996-use-prandom_u32_max.patch | 14 ++++++++ package/kernel/mt76/Makefile | 2 +- .../patches/091-fix-linux-6.1-build.patch | 33 +++++++++++++++++++ .../boot/dts/rockchip/rk3568-radxa-e25.dts | 4 +-- 5 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 package/kernel/mac80211/patches/subsys/995-backport-pskb_pull.patch create mode 100644 package/kernel/mac80211/patches/subsys/996-use-prandom_u32_max.patch create mode 100644 package/kernel/mt76/patches/091-fix-linux-6.1-build.patch diff --git a/package/kernel/mac80211/patches/subsys/995-backport-pskb_pull.patch b/package/kernel/mac80211/patches/subsys/995-backport-pskb_pull.patch new file mode 100644 index 000000000..915b54a32 --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/995-backport-pskb_pull.patch @@ -0,0 +1,27 @@ +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -49,7 +49,11 @@ + + if (present_fcs_len) + __pskb_trim(skb, skb->len - present_fcs_len); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0) + __pskb_pull(skb, rtap_space); ++#else ++ pskb_pull(skb, rtap_space); ++#endif + + hdr = (void *)skb->data; + fc = hdr->frame_control; +@@ -74,8 +78,11 @@ + + memmove(skb->data + IEEE80211_HT_CTL_LEN, skb->data, + hdrlen - IEEE80211_HT_CTL_LEN); ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0) + __pskb_pull(skb, IEEE80211_HT_CTL_LEN); +- ++#else ++ pskb_pull(skb, IEEE80211_HT_CTL_LEN); ++#endif + return skb; + } + diff --git a/package/kernel/mac80211/patches/subsys/996-use-prandom_u32_max.patch b/package/kernel/mac80211/patches/subsys/996-use-prandom_u32_max.patch new file mode 100644 index 000000000..08d49e57a --- /dev/null +++ b/package/kernel/mac80211/patches/subsys/996-use-prandom_u32_max.patch @@ -0,0 +1,14 @@ +--- a/net/mac80211/rc80211_minstrel_ht.c ++++ b/net/mac80211/rc80211_minstrel_ht.c +@@ -1867,7 +1867,11 @@ + + memset(sample_table, 0xff, sizeof(sample_table)); + for (col = 0; col < SAMPLE_COLUMNS; col++) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0) + prandom_bytes(rnd, sizeof(rnd)); ++#else ++ get_random_bytes(rnd, sizeof(rnd)); ++#endif + for (i = 0; i < MCS_GROUP_RATES; i++) { + new_idx = (i + rnd[i]) % MCS_GROUP_RATES; + while (sample_table[col][new_idx] != 0xff) diff --git a/package/kernel/mt76/Makefile b/package/kernel/mt76/Makefile index cd5dd5c0d..85a47ac63 100644 --- a/package/kernel/mt76/Makefile +++ b/package/kernel/mt76/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mt76 -PKG_RELEASE=5 +PKG_RELEASE=6 PKG_LICENSE:=GPLv2 PKG_LICENSE_FILES:= diff --git a/package/kernel/mt76/patches/091-fix-linux-6.1-build.patch b/package/kernel/mt76/patches/091-fix-linux-6.1-build.patch new file mode 100644 index 000000000..0b7ee7b3e --- /dev/null +++ b/package/kernel/mt76/patches/091-fix-linux-6.1-build.patch @@ -0,0 +1,33 @@ +--- a/mt7921/dma.c +--- b/mt7921/dma.c +@@ -283,10 +283,15 @@ + if (ret < 0) + return ret; + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) + netif_tx_napi_add(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi, + mt7921_poll_tx, NAPI_POLL_WEIGHT); + napi_enable(&dev->mt76.tx_napi); +- ++#else ++ netif_napi_add_tx_weight(&dev->mt76.tx_napi_dev, &dev->mt76.tx_napi, ++ mt7921_poll_tx, NAPI_POLL_WEIGHT); ++ napi_enable(&dev->mt76.tx_napi); ++#endif + return mt7921_dma_enable(dev); + } + +--- a/dma.c +--- b/dma.c +@@ -895,7 +895,11 @@ + dev->napi_dev.threaded = 1; + + mt76_for_each_q_rx(dev, i) { ++#if LINUX_VERSION_CODE < KERNEL_VERSION(6,1,0) + netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64); ++#else ++ netif_napi_add_weight(&dev->napi_dev, &dev->napi[i], poll, 64); ++#endif + mt76_dma_rx_fill(dev, &dev->q_rx[i]); + napi_enable(&dev->napi[i]); + } diff --git a/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts b/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts index 8687288e3..4341e266e 100644 --- a/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts +++ b/target/linux/rockchip/files/arch/arm64/boot/dts/rockchip/rk3568-radxa-e25.dts @@ -23,8 +23,8 @@ keyup-threshold-microvolt = <1750000>; button-power { - label = "Power"; - linux,code = ; + label = "Power Button"; + // linux,code = ; press-threshold-microvolt = <0>; }; };