* [PATCH v3 1/4] iw: prepare get_cf1 for use in join_* functions
@ 2015-11-25 13:59 Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 2/4] iw: add VHT80 support for 802.11s Sven Eckelmann
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sven Eckelmann @ 2015-11-25 13:59 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Julian Calaby, Sven Eckelmann
The chanmode structure and the function get_cf1 to calculate the center
frequency one can be used by not only the ibss join code but also by the
mesh and ocb join code.
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
---
v3:
* split patch into two different patches (0001/0002) as request by
Julian Calaby <julian.calaby@gmail.com>
* change join_ocb to also use get_cf1
* move NOHT to the last entry in the mesh/ibss join usage texts as
requested by Julian Calaby <julian.calaby@gmail.com>
v2:
* rebase from v4.3-ish version to current master
ibss.c | 33 ---------------------------------
iw.h | 9 +++++++++
mesh.c | 10 +++-------
util.c | 26 ++++++++++++++++++++++++++
4 files changed, 38 insertions(+), 40 deletions(-)
diff --git a/ibss.c b/ibss.c
index 024981a..a761794 100644
--- a/ibss.c
+++ b/ibss.c
@@ -16,39 +16,6 @@
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)
-{
- unsigned int cf1 = freq, j;
- unsigned 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,
diff --git a/iw.h b/iw.h
index 263e8b1..d91a33e 100644
--- a/iw.h
+++ b/iw.h
@@ -59,6 +59,13 @@ struct cmd {
const struct cmd *parent;
};
+struct chanmode {
+ const char *name;
+ unsigned int width;
+ int freq1_diff;
+ int chantype; /* for older kernel */
+};
+
#define ARRAY_SIZE(ar) (sizeof(ar)/sizeof(ar[0]))
#define DIV_ROUND_UP(x, y) (((x) + (y - 1)) / (y))
@@ -174,6 +181,8 @@ void print_ies(unsigned char *ie, int ielen, bool unknown,
void parse_bitrate(struct nlattr *bitrate_attr, char *buf, int buflen);
void iw_hexdump(const char *prefix, const __u8 *data, size_t len);
+int get_cf1(const struct chanmode *chanmode, unsigned long freq);
+
#define SCHED_SCAN_OPTIONS "interval <in_msecs> [delay <in_secs>] " \
"[freqs <freq>+] [matches [ssid <ssid>]+]] [active [ssid <ssid>]+|passive] [randomise[=<addr>/<mask>]]"
int parse_sched_scan(struct nl_msg *msg, int *argc, char ***argv);
diff --git a/mesh.c b/mesh.c
index f2415f3..593ab7a 100644
--- a/mesh.c
+++ b/mesh.c
@@ -448,12 +448,8 @@ static int join_mesh(struct nl80211_state *state,
char *end, *value = NULL, *sptr = NULL;
unsigned int i;
unsigned long freq = 0;
- 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,
@@ -506,7 +502,7 @@ static int join_mesh(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,
diff --git a/util.c b/util.c
index 55e1e26..da3be32 100644
--- a/util.c
+++ b/util.c
@@ -726,3 +726,29 @@ void iw_hexdump(const char *prefix, const __u8 *buf, size_t size)
}
printf("\n\n");
}
+
+int get_cf1(const struct chanmode *chanmode, unsigned long freq)
+{
+ unsigned int cf1 = freq, j;
+ unsigned 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;
+}
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 2/4] iw: add VHT80 support for 802.11s
2015-11-25 13:59 [PATCH v3 1/4] iw: prepare get_cf1 for use in join_* functions Sven Eckelmann
@ 2015-11-25 13:59 ` Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 3/4] iw: use get_cf1 and struct chanmode for ocb Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 4/4] iw: print NOHT always as last in usage texts Sven Eckelmann
2 siblings, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2015-11-25 13:59 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Julian Calaby, Sven Eckelmann
iw mesh supports non-HT and HT channel widths like HT20 or NOHT. But the
Linux 802.11s implementation also supports VHT80 which can be specified
during the mesh join.
iw dev mesh0 mesh join "meshnet" freq 5180 80MHz
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
---
v3:
* split patch into two different patches (0001/0002) as request by
Julian Calaby <julian.calaby@gmail.com>
* change join_ocb to also use get_cf1
* move NOHT to the last entry in the mesh/ibss join usage texts as
requested by Julian Calaby <julian.calaby@gmail.com>
v2:
* rebase from v4.3-ish version to current master
mesh.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/mesh.c b/mesh.c
index 593ab7a..d674d61 100644
--- a/mesh.c
+++ b/mesh.c
@@ -466,6 +466,10 @@ static int join_mesh(struct nl80211_state *state,
.width = NL80211_CHAN_WIDTH_20_NOHT,
.freq1_diff = 0,
.chantype = NL80211_CHAN_NO_HT },
+ { .name = "80MHz",
+ .width = NL80211_CHAN_WIDTH_80,
+ .freq1_diff = 0,
+ .chantype = -1 },
};
if (argc < 1)
@@ -604,7 +608,7 @@ static int join_mesh(struct nl80211_state *state,
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(mesh, join, "<mesh ID> [[freq <freq in MHz> <HT20|HT40+|HT40-|NOHT>]"
+COMMAND(mesh, join, "<mesh ID> [[freq <freq in MHz> <HT20|HT40+|HT40-|NOHT|80MHz>]"
" [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
" [beacon-interval <time in TUs>] [dtim-period <value>]"
" [vendor_sync on|off] [<param>=<value>]*",
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 3/4] iw: use get_cf1 and struct chanmode for ocb
2015-11-25 13:59 [PATCH v3 1/4] iw: prepare get_cf1 for use in join_* functions Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 2/4] iw: add VHT80 support for 802.11s Sven Eckelmann
@ 2015-11-25 13:59 ` Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 4/4] iw: print NOHT always as last in usage texts Sven Eckelmann
2 siblings, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2015-11-25 13:59 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, Julian Calaby, Sven Eckelmann
The struct chanmode and the function get_cf1 is already used by ibss and
mesh. Also use it for ocb to make it consistent for for all join functions.
Signed-off-by: Sven Eckelmann <sven@open-mesh.com>
---
v3:
* split patch into two different patches (0001/0002) as request by
Julian Calaby <julian.calaby@gmail.com>
* change join_ocb to also use get_cf1
* move NOHT to the last entry in the mesh/ibss join usage texts as
requested by Julian Calaby <julian.calaby@gmail.com>
v2:
* rebase from v4.3-ish version to current master
ocb.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/ocb.c b/ocb.c
index 767eb82..bcf0474 100644
--- a/ocb.c
+++ b/ocb.c
@@ -13,14 +13,16 @@ static int join_ocb(struct nl80211_state *state,
unsigned long freq;
char *end;
unsigned int i;
- static const struct {
- const char *name;
- unsigned int width;
- } *chanmode_selected, chanmode[] = {
+ const struct chanmode *chanmode_selected = NULL;
+ static const struct chanmode chanmode[] = {
{ .name = "5MHz",
- .width = NL80211_CHAN_WIDTH_5 },
+ .width = NL80211_CHAN_WIDTH_5,
+ .freq1_diff = 0,
+ .chantype = -1 },
{ .name = "10MHz",
- .width = NL80211_CHAN_WIDTH_10 },
+ .width = NL80211_CHAN_WIDTH_10,
+ .freq1_diff = 0,
+ .chantype = -1 },
};
if (argc < 2)
@@ -45,7 +47,8 @@ static int join_ocb(struct nl80211_state *state,
if (chanmode_selected) {
NLA_PUT_U32(msg, NL80211_ATTR_CHANNEL_WIDTH,
chanmode_selected->width);
- NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1, freq);
+ NLA_PUT_U32(msg, NL80211_ATTR_CENTER_FREQ1,
+ get_cf1(chanmode_selected, freq));
argv++;
argc--;
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v3 4/4] iw: print NOHT always as last in usage texts
2015-11-25 13:59 [PATCH v3 1/4] iw: prepare get_cf1 for use in join_* functions Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 2/4] iw: add VHT80 support for 802.11s Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 3/4] iw: use get_cf1 and struct chanmode for ocb Sven Eckelmann
@ 2015-11-25 13:59 ` Sven Eckelmann
2 siblings, 0 replies; 4+ messages in thread
From: Sven Eckelmann @ 2015-11-25 13:59 UTC (permalink / raw)
To: Johannes Berg
Cc: linux-wireless, Julian Calaby, Sven Eckelmann, Sven Eckelmann
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
v3:
* split patch into two different patches (0001/0002) as request by
Julian Calaby <julian.calaby@gmail.com>
* change join_ocb to also use get_cf1
* move NOHT to the last entry in the mesh/ibss join usage texts as
requested by Julian Calaby <julian.calaby@gmail.com>
v2:
* rebase from v4.3-ish version to current master
ibss.c | 2 +-
mesh.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/ibss.c b/ibss.c
index a761794..58c3bcd 100644
--- a/ibss.c
+++ b/ibss.c
@@ -192,7 +192,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-|5MHz|10MHz|80MHz|NOHT] [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/mesh.c b/mesh.c
index d674d61..76b9fa8 100644
--- a/mesh.c
+++ b/mesh.c
@@ -608,7 +608,7 @@ static int join_mesh(struct nl80211_state *state,
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(mesh, join, "<mesh ID> [[freq <freq in MHz> <HT20|HT40+|HT40-|NOHT|80MHz>]"
+COMMAND(mesh, join, "<mesh ID> [[freq <freq in MHz> <HT20|HT40+|HT40-|80MHz|NOHT>]"
" [basic-rates <rate in Mbps,rate2,...>]], [mcast-rate <rate in Mbps>]"
" [beacon-interval <time in TUs>] [dtim-period <value>]"
" [vendor_sync on|off] [<param>=<value>]*",
--
2.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-11-25 13:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-25 13:59 [PATCH v3 1/4] iw: prepare get_cf1 for use in join_* functions Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 2/4] iw: add VHT80 support for 802.11s Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 3/4] iw: use get_cf1 and struct chanmode for ocb Sven Eckelmann
2015-11-25 13:59 ` [PATCH v3 4/4] iw: print NOHT always as last in usage texts Sven Eckelmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).