[OpenWrt-Devel] [PATCH 4/6] iw: add VHT80 support for IBSS
Sven Eckelmann
sven at open-mesh.com
Tue Nov 24 12:34:18 EST 2015
Signed-off-by: Sven Eckelmann <sven at open-mesh.com>
---
.../utils/iw/patches/301-ibss_add_VHT80.patch | 104 +++++++++++++++++++++
.../iw/patches/302-ibss_use_MHz_instead_MHZ.patch | 41 ++++++++
2 files changed, 145 insertions(+)
create mode 100644 package/network/utils/iw/patches/301-ibss_add_VHT80.patch
create mode 100644 package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
diff --git a/package/network/utils/iw/patches/301-ibss_add_VHT80.patch b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
new file mode 100644
index 0000000..709fbb2
--- /dev/null
+++ b/package/network/utils/iw/patches/301-ibss_add_VHT80.patch
@@ -0,0 +1,104 @@
+From: "Janusz.Dziedzic at tieto.com" <Janusz.Dziedzic at tieto.com>
+Date: Thu, 10 Sep 2015 12:04:13 +0200
+Subject: ibss: add VHT80 support for IBSS
+
+Add VHT80 support for IBSS.
+
+eg. iw wlan0 ibss join 5180 80MHZ
+ iw wlan0 ibbs join 5220 80MHZ
+
+Signed-off-by: Janusz Dziedzic <janusz.dziedzic at tieto.com>
+[fix formatting]
+Signed-off-by: Johannes Berg <johannes.berg at intel.com>
+---
+ ibss.c | 49 +++++++++++++++++++++++++++++++++++++++++--------
+ 1 file changed, 41 insertions(+), 8 deletions(-)
+
+diff --git a/ibss.c b/ibss.c
+index 7a0b707..a99a262 100644
+--- a/ibss.c
++++ b/ibss.c
+@@ -16,6 +16,39 @@
+
+ SECTION(ibss);
+
++struct chanmode {
++ const char *name;
++ unsigned int width;
++ int freq1_diff;
++ int chantype; /* for older kernel */
++};
++
++static int get_cf1(const struct chanmode *chanmode, unsigned long freq)
++{
++ int cf1 = freq, j;
++ int vht80[] = { 5180, 5260, 5500, 5580, 5660, 5745 };
++
++ switch (chanmode->width) {
++ case NL80211_CHAN_WIDTH_80:
++ /* setup center_freq1 */
++ for (j = 0; j < ARRAY_SIZE(vht80); j++) {
++ if (freq >= vht80[j] && freq < vht80[j] + 80)
++ break;
++ }
++
++ if (j == ARRAY_SIZE(vht80))
++ break;
++
++ cf1 = vht80[j] + 30;
++ break;
++ default:
++ cf1 = freq + chanmode->freq1_diff;
++ break;
++ }
++
++ return cf1;
++}
++
+ static int join_ibss(struct nl80211_state *state,
+ struct nl_msg *msg,
+ int argc, char **argv,
+@@ -30,12 +63,8 @@ static int join_ibss(struct nl80211_state *state,
+ int bintval;
+ int i;
+ unsigned long freq;
+- static const struct {
+- const char *name;
+- unsigned int width;
+- int freq1_diff;
+- int chantype; /* for older kernel */
+- } *chanmode_selected = NULL, chanmode[] = {
++ const struct chanmode *chanmode_selected = NULL;
++ static const struct chanmode chanmode[] = {
+ { .name = "HT20",
+ .width = NL80211_CHAN_WIDTH_20,
+ .freq1_diff = 0,
+@@ -60,6 +89,10 @@ static int join_ibss(struct nl80211_state *state,
+ .width = NL80211_CHAN_WIDTH_10,
+ .freq1_diff = 0,
+ .chantype = -1 },
++ { .name = "80MHZ",
++ .width = NL80211_CHAN_WIDTH_80,
++ .freq1_diff = 0,
++ .chantype = -1 },
+ };
+
+ if (argc < 2)
+@@ -90,7 +123,7 @@ static int join_ibss(struct nl80211_state *state,
+ NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
+ chanmode_selected->width);
+ NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
+- freq + chanmode_selected->freq1_diff);
++ get_cf1(chanmode_selected, freq));
+ if (chanmode_selected->chantype != -1)
+ NLA_PUT_U32(msg,
+ NL80211_ATTR_WIPHY_CHANNEL_TYPE,
+@@ -192,7 +225,7 @@ COMMAND(ibss, leave, NULL,
+ NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss,
+ "Leave the current IBSS cell.");
+ COMMAND(ibss, join,
+- "<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
++ "<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ|80MHZ] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
+ " [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] "
+ "[key d:0:abcde]",
+ NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,
diff --git a/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
new file mode 100644
index 0000000..fc44427
--- /dev/null
+++ b/package/network/utils/iw/patches/302-ibss_use_MHz_instead_MHZ.patch
@@ -0,0 +1,41 @@
+From: Johannes Berg <johannes.berg at intel.com>
+Date: Fri, 18 Sep 2015 11:11:38 +0200
+Subject: ibss: use correct "MHz" instead of "MHZ"
+
+Signed-off-by: Johannes Berg <johannes.berg at intel.com>
+---
+ ibss.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/ibss.c b/ibss.c
+index a99a262..23bda70 100644
+--- a/ibss.c
++++ b/ibss.c
+@@ -81,15 +81,15 @@ static int join_ibss(struct nl80211_state *state,
+ .width = NL80211_CHAN_WIDTH_20_NOHT,
+ .freq1_diff = 0,
+ .chantype = NL80211_CHAN_NO_HT },
+- { .name = "5MHZ",
++ { .name = "5MHz",
+ .width = NL80211_CHAN_WIDTH_5,
+ .freq1_diff = 0,
+ .chantype = -1 },
+- { .name = "10MHZ",
++ { .name = "10MHz",
+ .width = NL80211_CHAN_WIDTH_10,
+ .freq1_diff = 0,
+ .chantype = -1 },
+- { .name = "80MHZ",
++ { .name = "80MHz",
+ .width = NL80211_CHAN_WIDTH_80,
+ .freq1_diff = 0,
+ .chantype = -1 },
+@@ -225,7 +225,7 @@ COMMAND(ibss, leave, NULL,
+ NL80211_CMD_LEAVE_IBSS, 0, CIB_NETDEV, leave_ibss,
+ "Leave the current IBSS cell.");
+ COMMAND(ibss, join,
+- "<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT|5MHZ|10MHZ|80MHZ] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
++ "<SSID> <freq in MHz> [HT20|HT40+|HT40-|NOHT|5MHz|10MHz|80MHz] [fixed-freq] [<fixed bssid>] [beacon-interval <TU>]"
+ " [basic-rates <rate in Mbps,rate2,...>] [mcast-rate <rate in Mbps>] "
+ "[key d:0:abcde]",
+ NL80211_CMD_JOIN_IBSS, 0, CIB_NETDEV, join_ibss,
--
2.6.2
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
More information about the openwrt-devel
mailing list