From: Ashok Nagarajan <ashok@cozybit.com>
To: linux-wireless@vger.kernel.org
Cc: linville@tuxdriver.com, johannes@sipsolutions.net,
devel@lists.open80211s.org, javier@cozybit.com,
ashok@cozybit.com
Subject: [PATCH 2/2] iw: Allow basic rates to be configured when joining mesh
Date: Mon, 3 Jun 2013 10:34:19 -0700 [thread overview]
Message-ID: <1370280859-9860-2-git-send-email-ashok@cozybit.com> (raw)
In-Reply-To: <1370280859-9860-1-git-send-email-ashok@cozybit.com>
This patch adds option to configure basic rates during mesh join. basic-rates
has to be passed along with "freq" attribute. For instance:
iw $MESH_IFACE mesh join mymeshid freq 2437 basic-rates 5.5,11
Signed-off-by: Ashok Nagarajan <ashok@cozybit.com>
---
mesh.c | 42 ++++++++++++++++++++++++++++++++++++------
1 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/mesh.c b/mesh.c
index ec202c9..f7c4c35 100644
--- a/mesh.c
+++ b/mesh.c
@@ -431,8 +431,9 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
{
struct nlattr *container;
float rate;
- int bintval, dtim_period, i;
- char *end;
+ unsigned char rates[NL80211_MAX_SUPP_RATES];
+ int bintval, dtim_period, i, n_rates = 0;
+ char *end, *value = NULL, *sptr = NULL;
static const struct {
const char *name;
unsigned int val;
@@ -482,6 +483,34 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
}
+ /* 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--;
@@ -547,13 +576,14 @@ static int join_mesh(struct nl80211_state *state, struct nl_cb *cb,
nla_put_failure:
return -ENOBUFS;
}
-COMMAND(mesh, join, "<mesh ID> [freq in MHz] [HT20|HT40+|HT40-|NOHT]"
- " [mcast-rate <rate in Mbps>]"
+COMMAND(mesh, join, "<mesh ID> [freq in MHz [HT20|HT40+|HT40-|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>]*",
NL80211_CMD_JOIN_MESH, 0, CIB_NETDEV, join_mesh,
- "Join a mesh with the given mesh ID with freq, mcast-rate, "
- "and mesh parameters.");
+ "Join a mesh with the given mesh ID with frequency, basic-rates,\n"
+ "mcast-rate and mesh parameters. basic-rates are be applied only if\n"
+ "frequency is provided.");
static int leave_mesh(struct nl80211_state *state, struct nl_cb *cb,
struct nl_msg *msg, int argc, char **argv,
--
1.7.5.4
next prev parent reply other threads:[~2013-06-03 17:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 17:34 [PATCH 1/2] iw: Allow user to provide freq during mesh join Ashok Nagarajan
2013-06-03 17:34 ` Ashok Nagarajan [this message]
2013-06-11 12:26 ` Johannes Berg
2013-06-14 21:39 ` Ashok Nagarajan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1370280859-9860-2-git-send-email-ashok@cozybit.com \
--to=ashok@cozybit.com \
--cc=devel@lists.open80211s.org \
--cc=javier@cozybit.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox