blob: 15aed5d0c64d4b71d99bce854d0d680a37fcb9e5 [file] [log] [blame]
developer66e89bc2024-04-23 14:50:01 +08001From 997e5f13e7bc2267b28e541a2904d7f7d84227d0 Mon Sep 17 00:00:00 2001
2From: Mordechay Goodstein <mordechay.goodstein@intel.com>
3Date: Sun, 29 May 2022 19:29:55 +0300
4Subject: [PATCH 08/28] util: add support for 320MHz bandwidth without cf1
5
6Based on user input for control central freq and 320 BW find the data
7central freq (cf1).
8
9Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
10Signed-off-by: Johannes Berg <johannes.berg@intel.com>
11---
12 phy.c | 4 ++--
13 util.c | 16 +++++++++++++++-
14 2 files changed, 17 insertions(+), 3 deletions(-)
15
16diff --git a/phy.c b/phy.c
17index 0a57ecb..15cea32 100644
18--- a/phy.c
19+++ b/phy.c
20@@ -199,13 +199,13 @@ static int handle_freq(struct nl80211_state *state, struct nl_msg *msg,
21 }
22
23 COMMAND(set, freq,
24- "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]\n"
25+ "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]\n"
26 "<control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
27 NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_freq,
28 "Set frequency/channel the hardware is using, including HT\n"
29 "configuration.");
30 COMMAND(set, freq,
31- "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]\n"
32+ "<freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]\n"
33 "<control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]",
34 NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_freq, NULL);
35
36diff --git a/util.c b/util.c
37index 93269ab..80dc301 100644
38--- a/util.c
39+++ b/util.c
40@@ -583,7 +583,7 @@ static int parse_freqs(struct chandef *chandef, int argc, char **argv,
41 * <channel> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]
42 *
43 * And if frequency is set:
44- * <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz]
45+ * <freq> [NOHT|HT20|HT40+|HT40-|5MHz|10MHz|80MHz|160MHz|320MHz]
46 * <control freq> [5|10|20|40|80|80+80|160] [<center1_freq> [<center2_freq>]]
47 *
48 * If the mode/channel width is not given the NOHT is assumed.
49@@ -1696,6 +1696,8 @@ int get_cf1(const struct chanmode *chanmode, unsigned long freq)
50 6195, 6995 };
51 unsigned int bw160[] = { 5180, 5500, 5955, 6115, 6275, 6435,
52 6595, 6755, 6915 };
53+ /* based on 11be D2 E.1 Country information and operating classes */
54+ unsigned int bw320[] = {5955, 6115, 6275, 6435, 6595, 6755};
55
56 switch (chanmode->width) {
57 case NL80211_CHAN_WIDTH_80:
58@@ -1722,6 +1724,18 @@ int get_cf1(const struct chanmode *chanmode, unsigned long freq)
59
60 cf1 = bw160[j] + 70;
61 break;
62+ case NL80211_CHAN_WIDTH_320:
63+ /* setup center_freq1 */
64+ for (j = 0; j < ARRAY_SIZE(bw320); j++) {
65+ if (freq >= bw320[j] && freq < bw320[j] + 160)
66+ break;
67+ }
68+
69+ if (j == ARRAY_SIZE(bw320))
70+ break;
71+
72+ cf1 = bw320[j] + 150;
73+ break;
74 default:
75 cf1 = freq + chanmode->freq1_diff;
76 break;
77--
782.39.2
79