* [PATCH] iw: Allow basic rates to be configured when joining mesh
@ 2013-05-11 0:52 Ashok Nagarajan
2013-05-30 18:20 ` Ashok Nagarajan
0 siblings, 1 reply; 4+ messages in thread
From: Ashok Nagarajan @ 2013-05-11 0:52 UTC (permalink / raw)
To: linux-wireless; +Cc: javier, johannes, devel, ashok
This patch adds option to configure basic rates during mesh join
Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
---
mesh.c | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/mesh.c b/mesh.c
index 5a09b62..c6aa9ce 100644
--- a/mesh.c
+++ b/mesh.c
@@ -431,8 +431,11 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
{
struct nlattr *container;
float rate;
+ unsigned char rates[NL80211_MAX_SUPP_RATES];
+ int n_rates = 0;
int bintval, dtim_period;
char *end;
+ char *value = NULL, *sptr = NULL;
if (argc < 1)
return 1;
@@ -441,6 +444,34 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
argc--;
argv++;
+ /* basic rates */
+ if (argc > 1 && strcmp(argv[0], "basic-rates") == 0) {
+ argv++;
+ argc--;
+
+ value = strtok_r(argv[0], ",", &sptr);
+
+ while (value && n_rates < NL80211_MAX_SUPP_RATES) {
+ rate = strtod(value, &end);
+ rates[n_rates] = rate * 2;
+
+ /* filter out suspicious values */
+ if (*end != '\0' || !rates[n_rates] ||
+ rate*2 != rates[n_rates])
+ return 1;
+
+ n_rates++;
+ value = strtok_r(NULL, ",", &sptr);
+ }
+
+ NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, n_rates, rates);
+
+ argv++;
+ argc--;
+ }
+
+ /* multicast rate */
+
if (argc > 1 && strcmp(argv[0], "mcast-rate") == 0) {
argv++;
argc--;
@@ -506,11 +537,13 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>]"
+COMMAND(mesh, join, "<mesh ID> [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>]*",
NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
- "Join a mesh with the given mesh ID with mcast-rate and mesh parameters.");
+ "Join a mesh with the given mesh ID with basic-rates, "
+ "mcast-rate and mesh parameters.");
static int leave_mesh(struct nl80211_state *state, struct nl_cb *cb,
struct nl_msg *msg, int argc, char **argv,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] iw: Allow basic rates to be configured when joining mesh
2013-05-11 0:52 [PATCH] iw: Allow basic rates to be configured when joining mesh Ashok Nagarajan
@ 2013-05-30 18:20 ` Ashok Nagarajan
2013-06-03 15:02 ` Johannes Berg
0 siblings, 1 reply; 4+ messages in thread
From: Ashok Nagarajan @ 2013-05-30 18:20 UTC (permalink / raw)
To: linux-wireless; +Cc: Javier Cardona, Johannes Berg, devel, Ashok Nagarajan
Hi Johannes,
I am changing the API for mesh join here as per our recent discussion,
which is to accept basic-rates only when passed the 'freq' attribute.
I was wondering what would be an acceptable style in iw to convey this
to user.
1. mesh join <mesh ID> [freq in MHz [HT20|HT40+|HT40-|NOHT]
[basic-rates <rate in Mbps,rate2,...>]] or
2. mesh join <mesh ID> [freq in MHz] [HT20|HT40+|HT40-|NOHT]
[basic-rates <rate in Mbps,rate2,...>]
Note the nested brackets in style 1.
Please let me know what you think.
Thanks,
Ashok
On Fri, May 10, 2013 at 5:52 PM, Ashok Nagarajan <ashok@cozybit.com> wrote:
> This patch adds option to configure basic rates during mesh join
>
> Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
> ---
> mesh.c | 37 +++++++++++++++++++++++++++++++++++--
> 1 files changed, 35 insertions(+), 2 deletions(-)
>
> diff --git a/mesh.c b/mesh.c
> index 5a09b62..c6aa9ce 100644
> --- a/mesh.c
> +++ b/mesh.c
> @@ -431,8 +431,11 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
> {
> struct nlattr *container;
> float rate;
> + unsigned char rates[NL80211_MAX_SUPP_RATES];
> + int n_rates = 0;
> int bintval, dtim_period;
> char *end;
> + char *value = NULL, *sptr = NULL;
>
> if (argc < 1)
> return 1;
> @@ -441,6 +444,34 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
> argc--;
> argv++;
>
> + /* basic rates */
> + if (argc > 1 && strcmp(argv[0], "basic-rates") == 0) {
> + argv++;
> + argc--;
> +
> + value = strtok_r(argv[0], ",", &sptr);
> +
> + while (value && n_rates < NL80211_MAX_SUPP_RATES) {
> + rate = strtod(value, &end);
> + rates[n_rates] = rate * 2;
> +
> + /* filter out suspicious values */
> + if (*end != '\0' || !rates[n_rates] ||
> + rate*2 != rates[n_rates])
> + return 1;
> +
> + n_rates++;
> + value = strtok_r(NULL, ",", &sptr);
> + }
> +
> + NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, n_rates, rates);
> +
> + argv++;
> + argc--;
> + }
> +
> + /* multicast rate */
> +
> if (argc > 1 && strcmp(argv[0], "mcast-rate") == 0) {
> argv++;
> argc--;
> @@ -506,11 +537,13 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
> nla_put_failure:
> return -ENOBUFS;
> }
> -COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>]"
> +COMMAND(mesh, join, "<mesh ID> [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>]*",
> NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
> - "Join a mesh with the given mesh ID with mcast-rate and mesh parameters.");
> + "Join a mesh with the given mesh ID with basic-rates, "
> + "mcast-rate and mesh parameters.");
>
> static int leave_mesh(struct nl80211_state *state, struct nl_cb *cb,
> struct nl_msg *msg, int argc, char **argv,
> --
> 1.7.5.4
>
--
Ashok Raj Nagarajan,
cozybit Inc.
http://www.cozybit.com
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] iw: Allow basic rates to be configured when joining mesh
2013-05-30 18:20 ` Ashok Nagarajan
@ 2013-06-03 15:02 ` Johannes Berg
0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2013-06-03 15:02 UTC (permalink / raw)
To: Ashok Nagarajan; +Cc: linux-wireless, Javier Cardona, devel
On Thu, 2013-05-30 at 11:20 -0700, Ashok Nagarajan wrote:
> Hi Johannes,
>
> I am changing the API for mesh join here as per our recent discussion,
> which is to accept basic-rates only when passed the 'freq' attribute.
> I was wondering what would be an acceptable style in iw to convey this
> to user.
>
> 1. mesh join <mesh ID> [freq in MHz [HT20|HT40+|HT40-|NOHT]
> [basic-rates <rate in Mbps,rate2,...>]] or
> 2. mesh join <mesh ID> [freq in MHz] [HT20|HT40+|HT40-|NOHT]
> [basic-rates <rate in Mbps,rate2,...>]
>
> Note the nested brackets in style 1.
>
> Please let me know what you think.
Honestly? I don't really care. The first might be clearer, but it
doesn't matter all that much to me, I don't use mesh anyway ;-)
johannes
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] iw: Allow basic rates to be configured when joining mesh
@ 2012-06-08 2:23 Ashok Nagarajan
0 siblings, 0 replies; 4+ messages in thread
From: Ashok Nagarajan @ 2012-06-08 2:23 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, javier, devel, Ashok Nagarajan
Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
---
mesh.c | 38 +++++++++++++++++++++++++++++++++++---
1 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/mesh.c b/mesh.c
index f678dc0..76bd6e4 100644
--- a/mesh.c
+++ b/mesh.c
@@ -376,7 +376,10 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
{
struct nlattr *container;
float rate;
+ unsigned char rates[NL80211_MAX_SUPP_RATES];
+ int n_rates = 0;
char *end;
+ char *value = NULL, *sptr = NULL;
if (argc < 1)
return 1;
@@ -385,6 +388,34 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
argc--;
argv++;
+ /* basic rates */
+ if (argc > 1 && strcmp(argv[0], "basic-rates") == 0) {
+ argv++;
+ argc--;
+
+ value = strtok_r(argv[0], ",", &sptr);
+
+ while (value && n_rates < NL80211_MAX_SUPP_RATES) {
+ rate = strtod(value, &end);
+ rates[n_rates] = rate * 2;
+
+ /* filter out suspicious values */
+ if (*end != '\0' || !rates[n_rates] ||
+ rate*2 != rates[n_rates])
+ return 1;
+
+ n_rates++;
+ value = strtok_r(NULL, ",", &sptr);
+ }
+
+ NLA_PUT(msg, NL80211_ATTR_BSS_BASIC_RATES, n_rates, rates);
+
+ argv++;
+ argc--;
+ }
+
+ /* multicast rate */
+
if (argc > 1 && strcmp(argv[0], "mcast-rate") == 0) {
argv++;
argc--;
@@ -424,10 +455,11 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(mesh, join, "<mesh ID> [mcast-rate <rate in Mbps>] [vendor_sync on|off]"
- " [<param>=<value>]*",
+COMMAND(mesh, join, "<mesh ID> [basic-rates <rate in Mbps,rate2,...>]"
+ "[mcast-rate <rate in Mbps>] [vendor_sync on|off] [<param>=<value>]*",
NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
- "Join a mesh with the given mesh ID with mcast-rate and mesh parameters.");
+ "Join a mesh with the given mesh ID with basic-rates,"
+ "mcast-rate and mesh parameters.");
static int leave_mesh(struct nl80211_state *state, struct nl_cb *cb,
struct nl_msg *msg, int argc, char **argv)
--
1.7.5.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-06-03 15:02 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-11 0:52 [PATCH] iw: Allow basic rates to be configured when joining mesh Ashok Nagarajan
2013-05-30 18:20 ` Ashok Nagarajan
2013-06-03 15:02 ` Johannes Berg
-- strict thread matches above, loose matches on Subject: below --
2012-06-08 2:23 Ashok Nagarajan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox