1 From: Sven Eckelmann <sven@open-mesh.com>
2 Date: Tue, 24 Nov 2015 17:55:22 +0100
3 Subject: iw: add VHT80 support for 802.11s
5 Support next to the non-HT/HT channel widths like HT20 or NOHT also VHT80
6 channels during the mesh join
8 iw dev mesh0 mesh join "meshnet" freq 5180 80MHz
10 Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
12 ibss.c | 33 ---------------------------------
14 mesh.c | 16 ++++++++--------
15 util.c | 26 ++++++++++++++++++++++++++
16 4 files changed, 43 insertions(+), 41 deletions(-)
28 - int chantype; /* for older kernel */
31 -static int get_cf1(const struct chanmode *chanmode, unsigned long freq)
34 - int vht80[] = { 5180, 5260, 5500, 5580, 5660, 5745 };
36 - switch (chanmode->width) {
37 - case NL80211_CHAN_WIDTH_80:
38 - /* setup center_freq1 */
39 - for (j = 0; j < ARRAY_SIZE(vht80); j++) {
40 - if (freq >= vht80[j] && freq < vht80[j] + 80)
44 - if (j == ARRAY_SIZE(vht80))
47 - cf1 = vht80[j] + 30;
50 - cf1 = freq + chanmode->freq1_diff;
57 static int join_ibss(struct nl80211_state *state,
59 int argc, char **argv,
62 @@ -59,6 +59,13 @@ struct cmd {
63 const struct cmd *parent;
70 + int chantype; /* for older kernel */
73 #define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
74 #define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
76 @@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ie
77 void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
78 void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
80 +int get_cf1(const struct chanmode *chanmode, unsigned long freq);
82 #define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
83 "[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
84 int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
87 @@ -439,12 +439,8 @@ static int join_mesh(struct nl80211_stat
88 int bintval, dtim_period, i, n_rates = 0;
89 char *end, *value = NULL, *sptr = NULL;
90 unsigned long freq = 0;
91 - static const struct {
95 - int chantype; /* for older kernel */
96 - } *chanmode_selected = NULL, chanmode[] = {
97 + const struct chanmode *chanmode_selected = NULL;
98 + static const struct chanmode chanmode[] = {
100 .width = NL80211_CHAN_WIDTH_20,
102 @@ -461,6 +457,10 @@ static int join_mesh(struct nl80211_stat
103 .width = NL80211_CHAN_WIDTH_20_NOHT,
105 .chantype = NL80211_CHAN_NO_HT },
107 + .width = NL80211_CHAN_WIDTH_80,
113 @@ -497,7 +497,7 @@ static int join_mesh(struct nl80211_stat
114 NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
115 chanmode_selected->width);
116 NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
117 - freq + chanmode_selected->freq1_diff);
118 + get_cf1(chanmode_selected, freq));
119 if (chanmode_selected->chantype != -1)
121 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
122 @@ -599,7 +599,7 @@ static int join_mesh(struct nl80211_stat
126 -COMMAND(mesh, join, "<mesh ID> [[freq <freq in MHz> <HT20|HT40+|HT40-|NOHT>]"
127 +COMMAND(mesh, join, "<mesh ID> [[freq <freq in MHz> <HT20|HT40+|HT40-|NOHT|80MHz>]"
128 " [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
129 " [beacon-interval <time in TUs>] [dtim-period <value>]"
130 " [vendor_sync on|off] [<param>=<value>]*",
133 @@ -728,3 +728,29 @@ void iw_hexdump(const char *prefix, cons
138 +int get_cf1(const struct chanmode *chanmode, unsigned long freq)
141 + int vht80[] = { 5180, 5260, 5500, 5580, 5660, 5745 };
143 + switch (chanmode->width) {
144 + case NL80211_CHAN_WIDTH_80:
145 + /* setup center_freq1 */
146 + for (j = 0; j < ARRAY_SIZE(vht80); j++) {
147 + if (freq >= vht80[j] && freq < vht80[j] + 80)
151 + if (j == ARRAY_SIZE(vht80))
154 + cf1 = vht80[j] + 30;
157 + cf1 = freq + chanmode->freq1_diff;