1 From: "Janusz.Dziedzic@tieto.com" <Janusz.Dziedzic@tieto.com>
2 Date: Thu, 10 Sep 2015 12:04:13 +0200
3 Subject: ibss: add VHT80 support for IBSS
5 Add VHT80 support for IBSS.
7 eg. iw wlan0 ibss join 5180 80MHZ
8 iw wlan0 ibbs join 5220 80MHZ
10 Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
12 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
14 ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
15 1 file changed, 41 insertions(+), 8 deletions(-)
17 diff --git a/ibss.c b/ibss.c
18 index 7a0b707..a99a262 100644
29 + int chantype; /* for older kernel */
32 +static int get_cf1(const struct chanmode *chanmode, unsigned long freq)
35 + int vht80[] = { 5180, 5260, 5500, 5580, 5660, 5745 };
37 + switch (chanmode->width) {
38 + case NL80211_CHAN_WIDTH_80:
39 + /* setup center_freq1 */
40 + for (j = 0; j < ARRAY_SIZE(vht80); j++) {
41 + if (freq >= vht80[j] && freq < vht80[j] + 80)
45 + if (j == ARRAY_SIZE(vht80))
48 + cf1 = vht80[j] + 30;
51 + cf1 = freq + chanmode->freq1_diff;
58 static int join_ibss(struct nl80211_state *state,
60 int argc, char **argv,
61 @@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
65 - static const struct {
69 - int chantype; /* for older kernel */
70 - } *chanmode_selected = NULL, chanmode[] = {
71 + const struct chanmode *chanmode_selected = NULL;
72 + static const struct chanmode chanmode[] = {
74 .width = NL80211_CHAN_WIDTH_20,
76 @@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
77 .width = NL80211_CHAN_WIDTH_10,
81 + .width = NL80211_CHAN_WIDTH_80,
87 @@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
88 NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
89 chanmode_selected->width);
90 NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
91 - freq + chanmode_selected->freq1_diff);
92 + get_cf1(chanmode_selected, freq));
93 if (chanmode_selected->chantype != -1)
95 NL80211_ATTR_WIPHY_CHANNEL_TYPE,
96 @@ -192,7 +225,7 @@ COMMAND(ibss, leave, NULL,
97 NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss,
98 "Leave the current IBSS cell.");
100 - "<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
101 + "<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ|80MHZ] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
102 " [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] "
104 NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,