From: Ujjal Roy <royujjal@gmail.com>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: WiFi Mailing List <linux-wireless@vger.kernel.org>
Subject: [RFC] iw: add support for retry limit
Date: Thu, 9 Jan 2014 18:52:16 +0530 [thread overview]
Message-ID: <1389273736-9486-1-git-send-email-royujjal@gmail.com> (raw)
Show the retry limit in phy details and also configure the
retry limit.
Signed-off-by: Ujjal Roy <royujjal@gmail.com>
---
info.c | 16 ++++++++++++++++
phy.c | 39 +++++++++++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/info.c b/info.c
index a696503..08b3292 100644
--- a/info.c
+++ b/info.c
@@ -246,6 +246,22 @@ next:
printf("\tRTS threshold: %d\n", rts);
}
+ if (tb_msg[NL80211_ATTR_WIPHY_RETRY_SHORT] ||
+ tb_msg[NL80211_ATTR_WIPHY_RETRY_LONG]) {
+ unsigned char retry_s = 0, retry_l = 0;
+
+ if (tb_msg[NL80211_ATTR_WIPHY_RETRY_SHORT])
+ retry_s = nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_RETRY_SHORT]);
+ if (tb_msg[NL80211_ATTR_WIPHY_RETRY_LONG])
+ retry_l = nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_RETRY_LONG]);
+ if (retry_s == retry_l) {
+ printf("\tRetry short long limit: %d\n", retry_s);
+ } else {
+ printf("\tRetry short limit: %d\n", retry_s);
+ printf("\tRetry long limit: %d\n", retry_l);
+ }
+ }
+
if (tb_msg[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) {
unsigned char coverage;
diff --git a/phy.c b/phy.c
index 68f40f6..da05103 100644
--- a/phy.c
+++ b/phy.c
@@ -232,6 +232,45 @@ COMMAND(set, rts, "<rts threshold|off>",
NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts,
"Set rts threshold.");
+static int handle_retry(struct nl80211_state *state,
+ struct nl_cb *cb, struct nl_msg *msg,
+ int argc, char **argv,
+ enum id_input id)
+{
+ unsigned int retry_short = 0, retry_long = 0;
+ char *end;
+
+ if (!argc || argc > 2)
+ return 1;
+
+ if (!*argv[0])
+ return 1;
+ retry_short = strtoul(argv[0], &end, 10);
+ if (*end != '\0')
+ return 1;
+ if (!retry_short || retry_short > 255)
+ return -EINVAL;
+ NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, retry_short);
+
+ if (argc == 2) {
+ if (!*argv[1])
+ return 1;
+ retry_long = strtoul(argv[1], &end, 10);
+ if (*end != '\0')
+ return 1;
+ if (!retry_long || retry_long > 255)
+ return -EINVAL;
+ NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, retry_long);
+ }
+
+ return 0;
+ nla_put_failure:
+ return -ENOBUFS;
+}
+COMMAND(set, retry, "<short limit> [<long limit>]",
+ NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_retry,
+ "Set retry limit.");
+
static int handle_netns(struct nl80211_state *state,
struct nl_cb *cb,
struct nl_msg *msg,
--
1.8.1.4
next reply other threads:[~2014-01-09 13:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-09 13:22 Ujjal Roy [this message]
2014-01-24 15:00 ` [RFC] iw: add support for retry limit Johannes Berg
2014-01-30 11:13 ` [PATCHv2] iw: add support to set/get " Ujjal Roy
2014-01-30 11:20 ` Ujjal Roy
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=1389273736-9486-1-git-send-email-royujjal@gmail.com \
--to=royujjal@gmail.com \
--cc=johannes@sipsolutions.net \
--cc=linux-wireless@vger.kernel.org \
/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