wlan-ap-Telecominfraproject/feeds/ipq95xx/iw/patches/603-iw-Add-320-MHz-support.patch
John Crispin 460050a114 ipq50xx: add CIF WF-198 support
Signed-off-by: John Crispin <john@phrozen.org>
2024-02-28 18:56:21 +01:00

177 lines
6.7 KiB
Diff

From e25e37f7a45988bb7866b9685f35c0f933decc40 Mon Sep 17 00:00:00 2001
From: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Date: Thu, 3 Mar 2022 14:46:30 +0530
Subject: [PATCH] iw: Add 320 MHz support
320 MHz support in 6G band of EHT mode.
So added 320 MHz support as per P802.11be/D1.1, July 2021 section 36.3.23.2
Signed-off-by: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
---
event.c | 3 +++
interface.c | 8 +++++---
measurements.c | 1 +
nl80211.h | 3 +++
util.c | 36 +++++++++++++++++++++++++++++++++++-
5 files changed, 47 insertions(+), 4 deletions(-)
--- a/event.c
+++ b/event.c
@@ -856,6 +856,9 @@ static void parse_ch_switch_notify(struc
case NL80211_CHAN_WIDTH_160:
printf("\"160 MHz\"");
break;
+ case NL80211_CHAN_WIDTH_320:
+ printf("\"320 MHz\"");
+ break;
case NL80211_CHAN_WIDTH_5:
printf("\"5 MHz\"");
break;
--- a/interface.c
+++ b/interface.c
@@ -743,11 +743,11 @@ static int handle_chan(struct nl80211_st
SECTION(switch);
COMMAND(switch, freq,
- "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]\n"
- "<control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]] [beacons <count>] [block-tx]",
+ "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|320MHz] [beacons <count>] [block-tx]\n"
+ "<control freq> [5|10|20|40|80|80+80|160|320] [<center1_freq> [<center2_freq>]] [beacons <count>] [block-tx]",
NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_freq,
"Switch the operating channel by sending a channel switch announcement (CSA).");
-COMMAND(switch, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz] [beacons <count>] [block-tx]",
+COMMAND(switch, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|320MHz] [beacons <count>] [block-tx]",
NL80211_CMD_CHANNEL_SWITCH, 0, CIB_NETDEV, handle_chan,
"Switch the operating channel by sending a channel switch announcement (CSA)."
"6GHz channels expects '6G' in argument. Defaults to 5GHz or 2GHz channels");
--- a/measurements.c
+++ b/measurements.c
@@ -189,6 +189,7 @@ static int parse_ftm_target(struct nl_ms
case NL80211_CHAN_WIDTH_160:
preamble = NL80211_PREAMBLE_VHT;
break;
+ /* TODO: Need to handle 320 bandwidth after EHT preamble */
default:
return HANDLER_RET_USAGE;
}
--- a/util.c
+++ b/util.c
@@ -473,6 +473,7 @@ enum nl80211_chan_width str_to_bw(const
{ .name = "80", .val = NL80211_CHAN_WIDTH_80, },
{ .name = "80+80", .val = NL80211_CHAN_WIDTH_80P80, },
{ .name = "160", .val = NL80211_CHAN_WIDTH_160, },
+ { .name = "320", .val = NL80211_CHAN_WIDTH_320, },
};
unsigned int i;
@@ -581,12 +582,12 @@ static int parse_freqs(struct chandef *c
* user by giving "NOHT" instead.
*
* The working specifier if chan is set are:
- * <channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]
+ * <channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]
* channel number defaults to 5G or 2G band unless 6G is specified.
*
* And if frequency is set:
- * <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]
- * <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]
+ * <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]
+ * <control freq> [5|10|20|40|80|80+80|160|320] [<center1_freq> [<center2_freq>]]
*
* If the mode/channel width is not given the NOHT is assumed.
*
@@ -633,6 +634,10 @@ int parse_freqchan(struct chandef *chand
.width = NL80211_CHAN_WIDTH_320,
.freq1_diff = 0,
.chantype = -1 },
+ { .name = "320MHz",
+ .width = NL80211_CHAN_WIDTH_320,
+ .freq1_diff = 0,
+ .chantype = -1 },
};
const struct chanmode *chanmode_selected = NULL;
unsigned int freq;
@@ -1697,13 +1702,16 @@ void iw_hexdump(const char *prefix, cons
int get_cf1(const struct chanmode *chanmode, unsigned long freq)
{
- unsigned int cf1 = freq, j;
+ unsigned int cf1 = freq, j, i;
unsigned int bw80[] = { 5180, 5260, 5500, 5580, 5660, 5745,
5955, 6035, 6115, 6195, 6275, 6355,
6435, 6515, 6595, 6675, 6755, 6835,
6195, 6995 };
unsigned int bw160[] = { 5180, 5500, 5955, 6115, 6275, 6435,
6595, 6755, 6915 };
+ unsigned int eht320_1[] = { 5955, 6275, 6595 };
+ unsigned int eht320_2[] = { 6115, 6435, 6755 };
+ unsigned int eht320_1diff, eht320_2diff;
switch (chanmode->width) {
case NL80211_CHAN_WIDTH_80:
@@ -1730,6 +1738,31 @@ int get_cf1(const struct chanmode *chanm
cf1 = bw160[j] + 70;
break;
+ case NL80211_CHAN_WIDTH_320:
+ /* setup center_freq1 */
+ for (i = 0, eht320_1diff = 320; i < ARRAY_SIZE(eht320_1); i++) {
+ if (freq >= eht320_1[i] && freq < eht320_1[i] + 320) {
+ eht320_1diff = freq - eht320_1[i];
+ break;
+ }
+ }
+
+ for (j = 0, eht320_2diff = 320; j < ARRAY_SIZE(eht320_2); j++) {
+ if (freq >= eht320_2[j] && freq < eht320_2[j] + 320) {
+ eht320_2diff = freq - eht320_2[j];
+ break;
+ }
+ }
+
+ if (i == ARRAY_SIZE(eht320_1) && j == ARRAY_SIZE(eht320_2))
+ break;
+
+ /* Take the nearest start freq b/w two type of channel sets */
+ if (eht320_1diff < eht320_2diff)
+ cf1 = eht320_1[i] + 150;
+ else
+ cf1 = eht320_2[j] + 150;
+ break;
default:
cf1 = freq + chanmode->freq1_diff;
break;
--- a/phy.c
+++ b/phy.c
@@ -199,14 +199,14 @@ static int handle_freq(struct nl80211_st
}
COMMAND(set, freq,
- "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]\n"
- "<control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
+ "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]\n"
+ "<control freq> [5|10|20|40|80|80+80|160|320] [<center1_freq> [<center2_freq>]]",
NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_freq,
"Set frequency/channel the hardware is using, including HT\n"
"configuration.");
COMMAND(set, freq,
- "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]\n"
- "<control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
+ "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]\n"
+ "<control freq> [5|10|20|40|80|80+80|160|320] [<center1_freq> [<center2_freq>]]",
NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_freq, NULL);
static int handle_chan(struct nl80211_state *state, struct nl_msg *msg,
@@ -222,9 +222,9 @@ static int handle_chan(struct nl80211_st
return put_chandef(msg, &chandef);
}
-COMMAND(set, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]",
+COMMAND(set, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]",
NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_chan, NULL);
-COMMAND(set, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz] [6G]",
+COMMAND(set, channel, "<channel> [6G] [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz] [6G]",
NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_chan, NULL);