commit 1343cb928fe8a036cbfa76648845f2a1c724b88d
parent ff6961fbc499244115924c734a787955b1f17520
Author: James Prestwood <prestwoj@gmail.com>
Date: Fri, 25 Feb 2022 09:58:03 -0800
band: add 6GHz support to {channel,freq}_to_{freq,channel}
Adds support for the channels and frequencies defined in the
802.11ax spec.
Diffstat:
| M | src/band.c | | | 35 | +++++++++++++++++++++++++++++++++++ |
1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/src/band.c b/src/band.c
@@ -1016,6 +1016,25 @@ uint8_t band_freq_to_channel(uint32_t freq, enum band_freq *out_band)
return channel;
}
+ if (freq > 5950 && freq <= 7115) {
+ if (freq % 5)
+ return 0;
+
+ channel = (freq - 5950) / 5;
+
+ if (out_band)
+ *out_band = BAND_FREQ_6_GHZ;
+
+ return channel;
+ }
+
+ if (freq == 5935) {
+ if (out_band)
+ *out_band = BAND_FREQ_6_GHZ;
+
+ return 2;
+ }
+
return 0;
}
@@ -1037,6 +1056,22 @@ uint32_t band_channel_to_freq(uint8_t channel, enum band_freq band)
return 4000 + 5 * channel;
}
+ if (band == BAND_FREQ_6_GHZ) {
+ /* operating class 136 */
+ if (channel == 2)
+ return 5935;
+
+ /* Channels increment by 4, starting with 1 */
+ if (channel % 4 != 1)
+ return 0;
+
+ if (channel < 1 || channel > 233)
+ return 0;
+
+ /* operating classes 131, 132, 133, 134, 135 */
+ return 5950 + 5 * channel;
+ }
+
return 0;
}