aredn/patches/701-extended-spectrum.patch

422 lines
13 KiB
Diff

--- /dev/null
+++ b/package/kernel/mac80211/patches/ath/301-extended-spectrum.patch
@@ -0,0 +1,185 @@
+Index: a/drivers/net/wireless/ath/ath9k/hw.h
+===================================================================
+--- a/drivers/net/wireless/ath/ath9k/hw.h
++++ b/drivers/net/wireless/ath/ath9k/hw.h
+@@ -74,7 +74,7 @@
+
+ #define ATH9K_RSSI_BAD -128
+
+-#define ATH9K_NUM_CHANNELS 38
++#define ATH9K_NUM_CHANNELS 114
+
+ /* Register read/write primitives */
+ #define REG_WRITE(_ah, _reg, _val) \
+Index: a/drivers/net/wireless/ath/regd.c
+===================================================================
+--- a/drivers/net/wireless/ath/regd.c
++++ b/drivers/net/wireless/ath/regd.c
+@@ -34,6 +34,7 @@ static struct reg_dmn_pair_mapping *ath_
+ */
+
+ /* Only these channels all allow active scan on all world regulatory domains */
++#define ATH_2GHZ_CHN02_00 REG_RULE(2387-10, 2407+10, 40, 0, 20, 0)
+ #define ATH_2GHZ_CH01_11 REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
+
+ /* We enable active scan on these a case by case basis by regulatory domain */
+@@ -47,17 +48,25 @@ static struct reg_dmn_pair_mapping *ath_
+ #define ATH_5GHZ_5150_5350 REG_RULE(5150-10, 5240+10, 80, 0, 30, 0),\
+ REG_RULE(5260-10, 5350+10, 80, 0, 30,\
+ NL80211_RRF_NO_IR)
++#define ATH_5GHZ_5320_5490 REG_RULE(5320-10, 5490+10, 80, 0, 30,\
++ NL80211_RRF_NO_IR)
+ #define ATH_5GHZ_5470_5850 REG_RULE(5470-10, 5850+10, 80, 0, 30,\
+ NL80211_RRF_NO_IR)
+ #define ATH_5GHZ_5725_5850 REG_RULE(5725-10, 5850+10, 80, 0, 30,\
+ NL80211_RRF_NO_IR)
++#define ATH_5GHZ_5850_5925 REG_RULE(5850-10, 5925+5, 80, 0, 30,\
++ NL80211_RRF_NO_IR)
++
+
+-#define ATH_2GHZ_ALL ATH_2GHZ_CH01_11, \
++#define ATH_2GHZ_ALL ATH_2GHZ_CHN02_00, \
++ ATH_2GHZ_CH01_11, \
+ ATH_2GHZ_CH12_13, \
+ ATH_2GHZ_CH14
+
+ #define ATH_5GHZ_ALL ATH_5GHZ_5150_5350, \
+- ATH_5GHZ_5470_5850
++ ATH_5GHZ_5320_5490, \
++ ATH_5GHZ_5470_5850, \
++ ATH_5GHZ_5850_5925
+
+ /* This one skips what we call "mid band" */
+ #define ATH_5GHZ_NO_MIDBAND ATH_5GHZ_5150_5350, \
+Index: a/net/wireless/util.c
+===================================================================
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -76,13 +76,16 @@ int ieee80211_channel_to_frequency(int c
+ return 0; /* not supported */
+ switch (band) {
+ case NL80211_BAND_2GHZ:
++ chan = (int)(unsigned char)chan;
+ if (chan == 14)
+ return MHZ_TO_KHZ(2484);
++ else if (chan > 14)
++ return MHZ_TO_KHZ(2402 - (255 - chan) * 5);
+ else if (chan < 14)
+ return MHZ_TO_KHZ(2407 + chan * 5);
+ break;
+ case NL80211_BAND_5GHZ:
+- if (chan >= 182 && chan <= 196)
++ if (chan >= 187 && chan <= 196)
+ return MHZ_TO_KHZ(4000 + chan * 5);
+ else
+ return MHZ_TO_KHZ(5000 + chan * 5);
+--- a/net/wireless/util.c
++++ b/net/wireless/util.c
+@@ -150,7 +150,7 @@
+ if (freq == 2484)
+ return 14;
+ else if (freq < 2484)
+- return (freq - 2407) / 5;
++ return ((int)freq - 2407) / 5;
+ else if (freq >= 4910 && freq <= 4980)
+ return (freq - 4000) / 5;
+ else if (freq < 5925)
+Index: a/drivers/net/wireless/ath/ath9k/common-init.c
+===================================================================
+--- a/drivers/net/wireless/ath/ath9k/common-init.c
++++ b/drivers/net/wireless/ath/ath9k/common-init.c
+***************
+*** 37,42 ****
+--- 37,46 ----
+ * we have calibration data for all cards though to make
+ * this static */
+ static const struct ieee80211_channel ath9k_2ghz_chantable[] = {
++ CHAN2G(2387, 38), /* Channel -4 */
++ CHAN2G(2392, 39), /* Channel -3 */
++ CHAN2G(2397, 40), /* Channel -2 */
++ CHAN2G(2402, 41), /* Channel -1 */
+ CHAN2G(2412, 0), /* Channel 1 */
+ CHAN2G(2417, 1), /* Channel 2 */
+ CHAN2G(2422, 2), /* Channel 3 */
+*************** static const struct ieee80211_channel at
+*** 68,73 ****
+--- 72,150 ----
+ CHAN5G(5280, 19), /* Channel 56 */
+ CHAN5G(5300, 20), /* Channel 60 */
+ CHAN5G(5320, 21), /* Channel 64 */
++ /* Added "For the HAMS" */
++ CHAN5G(5370, 42), /* Channel 74 */
++ CHAN5G(5375, 43), /* Channel 75 */
++ CHAN5G(5380, 44), /* Channel 76 */
++ CHAN5G(5385, 45), /* Channel 77 */
++ CHAN5G(5390, 46), /* Channel 78 */
++ CHAN5G(5395, 47), /* Channel 79 */
++ CHAN5G(5400, 48), /* Channel 80 */
++ CHAN5G(5405, 49), /* Channel 81 */
++ CHAN5G(5410, 50), /* Channel 82 */
++ CHAN5G(5415, 51), /* Channel 83 */
++ CHAN5G(5420, 52), /* Channel 84 */
++ CHAN5G(5425, 53), /* Channel 85 */
++ CHAN5G(5430, 54), /* Channel 86 */
++ CHAN5G(5435, 55), /* Channel 87 */
++ CHAN5G(5440, 56), /* Channel 88 */
++ CHAN5G(5445, 57), /* Channel 89 */
++ CHAN5G(5450, 58), /* Channel 90 */
++ CHAN5G(5455, 59), /* Channel 91 */
++ CHAN5G(5460, 60), /* Channel 92 */
++ CHAN5G(5465, 61), /* Channel 93 */
++ CHAN5G(5470, 62), /* Channel 94 */
++ CHAN5G(5475, 63), /* Channel 95 */
++ CHAN5G(5480, 64), /* Channel 96 */
++ CHAN5G(5485, 65), /* Channel 97 */
++ CHAN5G(5490, 66), /* Channel 98 */
++ CHAN5G(5495, 67), /* Channel 99 */
++ CHAN5G(5655, 68), /* Channel 131 */
++ CHAN5G(5665, 69), /* Channel 133 */
++ CHAN5G(5670, 70), /* Channel 134 */
++ CHAN5G(5675, 71), /* Channel 135 */
++ CHAN5G(5685, 72), /* Channel 137 */
++ CHAN5G(5690, 73), /* Channel 138 */
++ CHAN5G(5695, 74), /* Channel 139 */
++ CHAN5G(5705, 75), /* Channel 141 */
++ CHAN5G(5710, 76), /* Channel 142 */
++ CHAN5G(5715, 77), /* Channel 143 */
++ CHAN5G(5720, 78), /* Channel 144 */
++ CHAN5G(5725, 79), /* Channel 145 */
++ CHAN5G(5730, 80), /* Channel 146 */
++ CHAN5G(5735, 81), /* Channel 147 */
++ CHAN5G(5740, 82), /* Channel 148 */
++ CHAN5G(5750, 83), /* Channel 150 */
++ CHAN5G(5755, 84), /* Channel 151 */
++ CHAN5G(5760, 85), /* Channel 152 */
++ CHAN5G(5770, 86), /* Channel 154 */
++ CHAN5G(5775, 87), /* Channel 155 */
++ CHAN5G(5780, 88), /* Channel 156 */
++ CHAN5G(5790, 89), /* Channel 158 */
++ CHAN5G(5795, 90), /* Channel 159 */
++ CHAN5G(5800, 91), /* Channel 160 */
++ CHAN5G(5810, 92), /* Channel 162 */
++ CHAN5G(5815, 93), /* Channel 163 */
++ CHAN5G(5820, 94), /* Channel 164 */
++ CHAN5G(5830, 95), /* Channel 166 */
++ CHAN5G(5835, 96), /* Channel 167 */
++ CHAN5G(5840, 97), /* Channel 168 */
++ CHAN5G(5845, 98), /* Channel 169 */
++ CHAN5G(5850, 99), /* Channel 170 */
++ CHAN5G(5855, 100), /* Channel 171 */
++ CHAN5G(5860, 101), /* Channel 172 */
++ CHAN5G(5865, 102), /* Channel 173 */
++ CHAN5G(5870, 103), /* Channel 174 */
++ CHAN5G(5875, 104), /* Channel 175 */
++ CHAN5G(5880, 105), /* Channel 176 */
++ CHAN5G(5885, 106), /* Channel 177 */
++ CHAN5G(5890, 107), /* Channel 178 */
++ CHAN5G(5895, 108), /* Channel 179 */
++ CHAN5G(5900, 109), /* Channel 180 */
++ CHAN5G(5905, 110), /* Channel 181 */
++ CHAN5G(5910, 111), /* Channel 182 */
++ CHAN5G(5915, 112), /* Channel 183 */
++ CHAN5G(5920, 113), /* Channel 184 */
+ /* _We_ call this "Middle band" */
+ CHAN5G(5500, 22), /* Channel 100 */
+ CHAN5G(5520, 23), /* Channel 104 */
--- /dev/null
+++ b/package/network/utils/iw/patches/300-extended_spectrum.patch
@@ -0,0 +1,37 @@
+--- a/scan.c
++++ b/scan.c
+@@ -247,7 +247,16 @@ static void print_supprates(const uint8_
+
+ static void print_ds(const uint8_t type, uint8_t len, const uint8_t *data)
+ {
+- printf(" channel %d\n", data[0]);
++ switch (data[0]) {
++ case 252:
++ case 253:
++ case 254:
++ case 255:
++ printf(" channel %d\n", (int8_t)data[0]);
++ break;
++ default:
++ printf(" channel %d\n", data[0]);
++ }
+ }
+
+ static const char *country_env_str(char environment)
+--- a/util.c
++++ b/util.c
+@@ -274,11 +274,13 @@ int ieee80211_channel_to_frequency(int c
+ case NL80211_BAND_2GHZ:
+ if (chan == 14)
+ return 2484;
++ else if (chan == 255 || chan == 254 || chan == 253 || chan == 252)
++ return 2402 - 5 * (255 - chan);
+ else if (chan < 14)
+ return 2407 + chan * 5;
+ break;
+ case NL80211_BAND_5GHZ:
+- if (chan >= 182 && chan <= 196)
++ if (chan >= 187 && chan <= 196)
+ return 4000 + chan * 5;
+ else
+ return 5000 + chan * 5;
--- /dev/null
+++ b/package/network/utils/iwinfo/patches/300-extended-spectrum.patch
@@ -0,0 +1,65 @@
+--- a/iwinfo_cli.c
++++ b/iwinfo_cli.c
+@@ -48,10 +48,21 @@ static char * format_channel(int ch)
+ {
+ static char buf[8];
+
+- if (ch <= 0)
+- snprintf(buf, sizeof(buf), "unknown");
+- else
+- snprintf(buf, sizeof(buf), "%d", ch);
++
++ switch (ch) {
++ case 0:
++ snprintf(buf, sizeof(buf), "unknown");
++ break;
++ case 252:
++ case 253:
++ case 254:
++ case 255:
++ snprintf(buf, sizeof(buf), "%d", (int8_t)ch);
++ break;
++ default:
++ snprintf(buf, sizeof(buf), "%d", ch);
++ break;
++ }
+
+ return buf;
+ }
+@@ -409,7 +420,7 @@ static char * print_channel(const struct iwinfo_ops *iw, const char *ifname)
+ {
+ int ch;
+ if (iw->channel(ifname, &ch))
+- ch = -1;
++ ch = 0;
+
+ return format_channel(ch);
+ }
+--- a/iwinfo_nl80211.c 2019-05-25 14:36:00.660702602 -0500
++++ b/iwinfo_nl80211.c 2019-05-25 14:38:41.985324601 -0500
+@@ -709,13 +709,12 @@
+ */
+ static int nl80211_channel2freq(int channel, const char *band, bool ax)
+ {
+- if (channel < 1)
+- return 0;
+-
+ if (!band || band[0] != 'a')
+ {
+ if (channel == 14)
+ return 2484;
++ else if (channel == 255 || channel == 254 || channel == 253 || channel == 252)
++ return 2402 - 5 * (255 - channel);
+ else if (channel < 14)
+ return (channel * 5) + 2407;
+ }
+@@ -733,7 +732,7 @@
+ }
+ else
+ {
+- if (channel >= 182 && channel <= 196)
++ if (channel >= 187 && channel <= 196)
+ return (channel * 5) + 4000;
+ else
+ return (channel * 5) + 5000;
+
--- /dev/null
+++ b/package/kernel/ath10k-ct/patches/999-0000-ath10k-part97-chan-extend.patch
@@ -0,0 +1,100 @@
+--- a/ath10k-5.15/core.h
++++ b/ath10k-5.15/core.h
+@@ -49,8 +49,8 @@
+ #define WMI_READY_TIMEOUT (5 * HZ)
+ #define ATH10K_FLUSH_TIMEOUT_HZ (5 * HZ)
+ #define ATH10K_CONNECTION_LOSS_HZ (3 * HZ)
+-#define ATH10K_NUM_CHANS 41
+-#define ATH10K_MAX_5G_CHAN 173
++#define ATH10K_NUM_CHANS 88
++#define ATH10K_MAX_5G_CHAN 184
+
+ /* Antenna noise floor */
+ #define ATH10K_DEFAULT_NOISE_FLOOR -95
+--- a/ath10k-5.15/mac.c
++++ b/ath10k-5.15/mac.c
+@@ -9089,6 +9089,10 @@
+ }
+
+ static const struct ieee80211_channel ath10k_2ghz_channels[] = {
++ CHAN2G(252, 2387, 0),
++ CHAN2G(253, 2392, 0),
++ CHAN2G(254, 2397, 0),
++ CHAN2G(255, 2402, 0),
+ CHAN2G(1, 2412, 0),
+ CHAN2G(2, 2417, 0),
+ CHAN2G(3, 2422, 0),
+@@ -9122,17 +9124,60 @@
+ CHAN5G(120, 5600, 0),
+ CHAN5G(124, 5620, 0),
+ CHAN5G(128, 5640, 0),
++ CHAN5G(131, 5655, 0),
+ CHAN5G(132, 5660, 0),
++ CHAN5G(133, 5665, 0),
++ CHAN5G(134, 5670, 0),
++ CHAN5G(135, 5675, 0),
+ CHAN5G(136, 5680, 0),
++ CHAN5G(137, 5685, 0),
++ CHAN5G(138, 5690, 0),
++ CHAN5G(139, 5695, 0),
+ CHAN5G(140, 5700, 0),
++ CHAN5G(141, 5705, 0),
++ CHAN5G(142, 5710, 0),
++ CHAN5G(143, 5715, 0),
+ CHAN5G(144, 5720, 0),
++ CHAN5G(145, 5725, 0),
++ CHAN5G(146, 5730, 0),
++ CHAN5G(147, 5735, 0),
++ CHAN5G(148, 5740, 0),
+ CHAN5G(149, 5745, 0),
++ CHAN5G(150, 5750, 0),
++ CHAN5G(151, 5755, 0),
++ CHAN5G(152, 5760, 0),
+ CHAN5G(153, 5765, 0),
++ CHAN5G(154, 5770, 0),
++ CHAN5G(155, 5775, 0),
++ CHAN5G(156, 5780, 0),
+ CHAN5G(157, 5785, 0),
++ CHAN5G(158, 5790, 0),
++ CHAN5G(159, 5795, 0),
++ CHAN5G(160, 5800, 0),
+ CHAN5G(161, 5805, 0),
++ CHAN5G(162, 5810, 0),
++ CHAN5G(163, 5815, 0),
++ CHAN5G(164, 5820, 0),
+ CHAN5G(165, 5825, 0),
++ CHAN5G(166, 5830, 0),
++ CHAN5G(167, 5835, 0),
++ CHAN5G(168, 5840, 0),
+ CHAN5G(169, 5845, 0),
++ CHAN5G(170, 5850, 0),
++ CHAN5G(171, 5855, 0),
++ CHAN5G(172, 5860, 0),
+ CHAN5G(173, 5865, 0),
++ CHAN5G(174, 5870, 0),
++ CHAN5G(175, 5875, 0),
++ CHAN5G(176, 5880, 0),
++ CHAN5G(177, 5885, 0),
++ CHAN5G(178, 5890, 0),
++ CHAN5G(179, 5895, 0),
++ CHAN5G(180, 5900, 0),
++ CHAN5G(181, 5905, 0),
++ CHAN5G(182, 5910, 0),
++ CHAN5G(183, 5915, 0),
++ CHAN5G(184, 5920, 0),
+ /* If you add more, you may need to change ATH10K_MAX_5G_CHAN */
+ /* And you will definitely need to change ATH10K_NUM_CHANS in core.h */
+ };
+--- a/ath10k-5.15/wmi.h
++++ b/ath10k-5.15/wmi.h
+@@ -3355,6 +3355,10 @@
+
+ /* passively scan all channels including active channels */
+ #define WMI_SCAN_FLAG_PASSIVE 0x1
++/** set HALF (10MHz) rate support */
++#define WMI_SCAN_FLAG_HALF_RATE_SUPPORT 0x20000
++/** set Quarter (5MHz) rate support */
++#define WMI_SCAN_FLAG_QUARTER_RATE_SUPPORT 0x40000
+ /* add wild card ssid probe request even though ssid_list is specified. */
+ #define WMI_SCAN_ADD_BCAST_PROBE_REQ 0x2
+ /* add cck rates to rates/xrate ie for the generated probe request */
--- /dev/null
+++ b/package/kernel/ath10k-ct/patches/999-0001-ath10k-neg-chans.patch
@@ -0,0 +1,19 @@
+--- a/ath10k-5.15/wmi.c
++++ b/ath10k-5.15/wmi.c
+@@ -2709,13 +2709,15 @@
+ */
+ if (channel >= 1 && channel <= 14) {
+ status->band = NL80211_BAND_2GHZ;
++ } else if (channel >= -4 && channel <= -1) {
++ status->band = NL80211_BAND_2GHZ;
+ } else if (channel >= 36 && channel <= ATH10K_MAX_5G_CHAN) {
+ status->band = NL80211_BAND_5GHZ;
+ } else {
+ /* Shouldn't happen unless list of advertised channels to
+ * mac80211 has been changed.
+ */
+- WARN_ON_ONCE(1);
++ WARN_ONCE(1, "Bad channel %d\n", channel);
+ dev_kfree_skb(skb);
+ return 0;
+ }