Skip to contentSkip to conversation

iw: add support for retry limit

RFC In review Ujjal Roy 2 participants 4 messages Jan 9, 2014 – Jan 30, 2014

lore
Share & tools
lore

Ujjal Roy

author
#0 lore raw

RFC 1/1 iw: add support for retry limit

Show the retry limit in phy details and also configure the retry limit.

---
 info.c | 16 ++++++++++++++++
 phy.c  | 39 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)
info.c +16 -0
index a696503..08b3292 100644
@@ -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;
 
phy.c +39 -0
index 68f40f6..da05103 100644
@@ -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,
Signature · 1 line
1.8.1.4
#1 lore raw

On Thu, 2014-01-09 at 18:52 +0530, Ujjal Roy wrote:

Sorry for the late reply.

phy.c COMMAND(set, rts, "<rts threshold|off>", · line 238

Quoted 8 lines
phy.c +4 -0
@@ -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)

indentation is a bit off

phy.c COMMAND(set, rts, "<rts threshold|off>", · line 272

Quoted 3 lines
phy.c +3 -0
+COMMAND(set, retry, "<short limit> [<long limit>]",
+	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_retry,
+	"Set retry limit.");

This seems odd to me, why would you want to allow setting the short limit while not changing the long one, but not the other way around?

johannes

author
#2 lore raw

Re: [PATCHv2] iw: add support to set/get retry limit

Quoted 6 lines · Johannes Berg

Review

Quoted 3 lines
(quoted diff) +3 -0
+COMMAND(set, retry, "<short limit> [<long limit>]",
+	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_retry,
+	"Set retry limit.");

This seems odd to me, why would you want to allow setting the short limit while not changing the long one, but not the other way around?

Sorry for late response and thanks for the suggestion. The modified patch is below after 3 dashes.

---
Show the retry limit in phy details and also configure the retry limit.

---
 info.c | 16 ++++++++++++++++
 phy.c  | 64 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
info.c +6 -0
index a696503..001b317 100644
@@ -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_short = 0, retry_long = 0;
+
+		if (tb_msg[NL80211_ATTR_WIPHY_RETRY_SHORT])
+			retry_short = 

nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_RETRY_SHORT]);
+ if (tb_msg[NL80211_ATTR_WIPHY_RETRY_LONG])
+ retry_long =
nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_RETRY_LONG]);
+ if (retry_short == retry_long) {
+ printf("\tRetry short long limit: %d\n",
retry_short);
+ } else {
+ printf("\tRetry short limit: %d\n", retry_short);
+ printf("\tRetry long limit: %d\n", retry_long);
+ }
+ }
+
if (tb_msg[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) {
unsigned char coverage;

phy.c +53 -0

56 lines not on this page · raw message

retry_short);
+ if (have_retry_l)
+ 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,

Signature · 1 line
1.8.1.4
author
#3 lore raw

Re: [PATCHv2] iw: add support to set/get retry limit

In reply to Johannes Berg
Quoted 6 lines · Johannes Berg

Review

Quoted 3 lines
(quoted diff) +3 -0
+COMMAND(set, retry, "<short limit> [<long limit>]",
+	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_retry,
+	"Set retry limit.");

This seems odd to me, why would you want to allow setting the short limit while not changing the long one, but not the other way around?

Sorry for late response and thanks for the suggestion. The modified patch is below after 3 dashes.

---
Show the retry limit in phy details and also configure the retry limit.

---
 info.c | 16 ++++++++++++++++
 phy.c  | 64 
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
info.c +6 -0
index a696503..001b317 100644
@@ -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_short = 0, retry_long = 0;
+
+		if (tb_msg[NL80211_ATTR_WIPHY_RETRY_SHORT])
+			retry_short = 

nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_RETRY_SHORT]);
+ if (tb_msg[NL80211_ATTR_WIPHY_RETRY_LONG])
+ retry_long =
nla_get_u8(tb_msg[NL80211_ATTR_WIPHY_RETRY_LONG]);
+ if (retry_short == retry_long) {
+ printf("\tRetry short long limit: %d\n",
retry_short);
+ } else {
+ printf("\tRetry short limit: %d\n", retry_short);
+ printf("\tRetry long limit: %d\n", retry_long);
+ }
+ }
+
if (tb_msg[NL80211_ATTR_WIPHY_COVERAGE_CLASS]) {
unsigned char coverage;

phy.c +53 -0

56 lines not on this page · raw message

retry_short);
+ if (have_retry_l)
+ 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,

Signature · 1 line
1.8.1.4