|
| 1 | +From: Florian Maurer <fmaurer@disroot.org> |
| 2 | +Date: Mon, 24 Aug 2026 12:05:07 +0000 |
| 3 | +Subject: wifi: mt76: add optional support for 5 and 10 MHz channels |
| 4 | + |
| 5 | +diff --git a/package/kernel/mt76/patches/902-wifi-mt76-add-optional-support-for-5-and-10-MHz-chan.patch b/package/kernel/mt76/patches/902-wifi-mt76-add-optional-support-for-5-and-10-MHz-chan.patch |
| 6 | +new file mode 100644 |
| 7 | +--- /dev/null |
| 8 | ++++ b/package/kernel/mt76/patches/902-wifi-mt76-add-optional-support-for-5-and-10-MHz-chan.patch |
| 9 | +@@ -0,0 +1,120 @@ |
| 10 | ++From a412cf60d684eb29a85446d5a1ee91dd937f56b2 Mon Sep 17 00:00:00 2001 |
| 11 | ++From: Florian Maurer <fmaurer@disroot.org> |
| 12 | ++Date: Mon, 24 Aug 2026 12:04:23 +0000 |
| 13 | ++Subject: [PATCH mt76] wifi: mt76: add optional support for 5 and 10 MHz |
| 14 | ++ channels |
| 15 | ++ |
| 16 | ++IEEE 802.11p / ETSI ITS-G5 uses half-clocked 10 MHz channels in the |
| 17 | ++5.9 GHz band. The connac channel switch command already carries the |
| 18 | ++narrow bandwidths through mt76_connac_chan_bw(), but cfg80211 rejects a |
| 19 | ++10 MHz chandef before it ever reaches the driver because the wiphy does |
| 20 | ++not advertise WIPHY_FLAG_SUPPORTS_5_10_MHZ, and the 5 GHz channel list |
| 21 | ++ends at channel 177. |
| 22 | ++ |
| 23 | ++Add an enable_5_10mhz module parameter, off by default, that advertises |
| 24 | ++the capability and registers the ITS-G5 channel centres. The extra |
| 25 | ++channels are appended to the end of the channel table so that leaving |
| 26 | ++the parameter unset registers exactly the same channel list as before |
| 27 | ++and sets exactly the same wiphy flags as before. |
| 28 | ++ |
| 29 | ++No regulatory domain permits regular operation on these channels, so |
| 30 | ++they are marked IEEE80211_CHAN_CAN_MONITOR: a monitor interface can tune |
| 31 | ++them for passive reception, while any attempt to transmit is still |
| 32 | ++refused by the regulatory code. |
| 33 | ++ |
| 34 | ++Signed-off-by: Florian Maurer <fmaurer@disroot.org> |
| 35 | ++--- |
| 36 | ++ mac80211.c | 43 +++++++++++++++++++++++++++++++++++++++++-- |
| 37 | ++ 1 file changed, 41 insertions(+), 2 deletions(-) |
| 38 | ++ |
| 39 | ++diff --git a/mac80211.c b/mac80211.c |
| 40 | ++index ff86f4f5..89afee40 100644 |
| 41 | ++--- a/mac80211.c |
| 42 | +++++ b/mac80211.c |
| 43 | ++@@ -4,8 +4,14 @@ |
| 44 | ++ */ |
| 45 | ++ #include <linux/sched.h> |
| 46 | ++ #include <linux/of.h> |
| 47 | +++#include <linux/moduleparam.h> |
| 48 | ++ #include "mt76.h" |
| 49 | ++ |
| 50 | +++static bool enable_5_10mhz; |
| 51 | +++module_param(enable_5_10mhz, bool, 0444); |
| 52 | +++MODULE_PARM_DESC(enable_5_10mhz, |
| 53 | +++ "Enable 5 and 10 MHz channel widths and expose the 5.9 GHz ITS-G5 channels for monitoring (default: off)"); |
| 54 | +++ |
| 55 | ++ #define CHAN2G(_idx, _freq) { \ |
| 56 | ++ .band = NL80211_BAND_2GHZ, \ |
| 57 | ++ .center_freq = (_freq), \ |
| 58 | ++@@ -20,6 +26,18 @@ |
| 59 | ++ .max_power = 30, \ |
| 60 | ++ } |
| 61 | ++ |
| 62 | +++/* Channels that are only ever usable for passive monitoring. They carry |
| 63 | +++ * IEEE80211_CHAN_CAN_MONITOR so that a monitor interface may tune them even |
| 64 | +++ * though no regulatory domain permits regular operation there. |
| 65 | +++ */ |
| 66 | +++#define CHAN5G_MON(_idx, _freq) { \ |
| 67 | +++ .band = NL80211_BAND_5GHZ, \ |
| 68 | +++ .center_freq = (_freq), \ |
| 69 | +++ .hw_value = (_idx), \ |
| 70 | +++ .max_power = 30, \ |
| 71 | +++ .flags = IEEE80211_CHAN_CAN_MONITOR, \ |
| 72 | +++} |
| 73 | +++ |
| 74 | ++ #define CHAN6G(_idx, _freq) { \ |
| 75 | ++ .band = NL80211_BAND_6GHZ, \ |
| 76 | ++ .center_freq = (_freq), \ |
| 77 | ++@@ -76,8 +94,22 @@ static const struct ieee80211_channel mt76_channels_5ghz[] = { |
| 78 | ++ CHAN5G(169, 5845), |
| 79 | ++ CHAN5G(173, 5865), |
| 80 | ++ CHAN5G(177, 5885), |
| 81 | +++ |
| 82 | +++ /* IEEE 802.11p / ETSI ITS-G5 channels in the 5.9 GHz band. These are |
| 83 | +++ * appended after the regular channels so that they can be left out |
| 84 | +++ * simply by registering fewer of them, see mt76_init_sband_5g(). |
| 85 | +++ */ |
| 86 | +++ CHAN5G_MON(172, 5860), |
| 87 | +++ CHAN5G_MON(174, 5870), |
| 88 | +++ CHAN5G_MON(176, 5880), |
| 89 | +++ CHAN5G_MON(178, 5890), |
| 90 | +++ CHAN5G_MON(180, 5900), |
| 91 | +++ CHAN5G_MON(182, 5910), |
| 92 | +++ CHAN5G_MON(184, 5920), |
| 93 | ++ }; |
| 94 | ++ |
| 95 | +++#define MT76_N_CHANNELS_5GHZ_ITS 7 |
| 96 | +++ |
| 97 | ++ static const struct ieee80211_channel mt76_channels_6ghz[] = { |
| 98 | ++ /* UNII-5 */ |
| 99 | ++ CHAN6G(1, 5955), |
| 100 | ++@@ -373,11 +405,15 @@ static int |
| 101 | ++ mt76_init_sband_5g(struct mt76_phy *phy, struct ieee80211_rate *rates, |
| 102 | ++ int n_rates, bool vht) |
| 103 | ++ { |
| 104 | +++ int n_chan = ARRAY_SIZE(mt76_channels_5ghz); |
| 105 | +++ |
| 106 | ++ phy->hw->wiphy->bands[NL80211_BAND_5GHZ] = &phy->sband_5g.sband; |
| 107 | ++ |
| 108 | +++ if (!enable_5_10mhz) |
| 109 | +++ n_chan -= MT76_N_CHANNELS_5GHZ_ITS; |
| 110 | +++ |
| 111 | ++ return mt76_init_sband(phy, &phy->sband_5g, mt76_channels_5ghz, |
| 112 | ++- ARRAY_SIZE(mt76_channels_5ghz), rates, |
| 113 | ++- n_rates, true, vht); |
| 114 | +++ n_chan, rates, n_rates, true, vht); |
| 115 | ++ } |
| 116 | ++ |
| 117 | ++ static int |
| 118 | ++@@ -445,6 +481,9 @@ mt76_phy_init(struct mt76_phy *phy, struct ieee80211_hw *hw) |
| 119 | ++ WIPHY_FLAG_SUPPORTS_TDLS | |
| 120 | ++ WIPHY_FLAG_AP_UAPSD; |
| 121 | ++ |
| 122 | +++ if (enable_5_10mhz) |
| 123 | +++ wiphy->flags |= WIPHY_FLAG_SUPPORTS_5_10_MHZ; |
| 124 | +++ |
| 125 | ++ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST); |
| 126 | ++ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS); |
| 127 | ++ wiphy_ext_feature_set(wiphy, NL80211_EXT_FEATURE_AQL); |
| 128 | ++-- |
| 129 | ++2.47.3 |
0 commit comments