All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iw: allow to set wmm parameters from iw
@ 2019-02-21 23:18 Andrea Greco
  2019-02-22 11:03 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Greco @ 2019-02-21 23:18 UTC (permalink / raw)
  To: johannes; +Cc: johannes.berg, linux-wireless, Andrea Greco

From: Andrea Greco <a.greco@4sigma.it>

---
 phy.c | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/phy.c b/phy.c
index 77df7a7..3154754 100644
--- a/phy.c
+++ b/phy.c
@@ -843,3 +843,83 @@ static int handle_get_txq(struct nl80211_state *state,
 COMMAND(get, txq, "",
 	NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq,
 	"Get TXQ parameters.");
+
+static int handle_wmm_params(struct nl80211_state *state,
+			     struct nl_msg *msg,
+			     int argc, char **argv,
+			     enum id_input id)
+{
+	char *end;
+	struct nlattr *txq, *params;
+	int queue, cw_min, cw_max, aifs, txop;
+
+	if (argc != 5)
+		return 1;
+
+	if (!strcmp(argv[0], "VO"))
+		queue = NL80211_TXQ_Q_VO;
+	else if (!strcmp(argv[0], "VI"))
+		queue = NL80211_TXQ_Q_VI;
+	else if (!strcmp(argv[0], "BK"))
+		queue = NL80211_TXQ_Q_BK;
+	else if (!strcmp(argv[0], "BE"))
+		queue = NL80211_TXQ_Q_BE;
+	else {
+		printf("Invalid parameter: %s\n", argv[0]);
+		return 2;
+	}
+
+	if (!*argv[1] || !*argv[2] || !*argv[3] || !*argv[4])
+		return 1;
+
+	cw_min = strtoul(argv[1], &end, 0);
+	if (*end)
+		return 1;
+
+	cw_max = strtoul(argv[2], &end, 0);
+	if (*end)
+		return 1;
+
+	aifs = strtoul(argv[3], &end, 0);
+	if (*end)
+		return 1;
+
+	txop = strtoul(argv[4], &end, 0);
+	if (*end)
+		return 1;
+
+	txq = nla_nest_start(msg, NL80211_ATTR_WIPHY_TXQ_PARAMS);
+	if (!txq) {
+		goto nla_put_failure;
+	}
+
+	params = nla_nest_start(msg, 1);
+	if (!params) {
+		goto nla_put_failure;
+	}
+
+	NLA_PUT_U8(msg, NL80211_TXQ_ATTR_QUEUE, queue);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_CWMIN, cw_min);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_CWMAX, cw_max);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_TXOP, txop);
+	NLA_PUT_U8(msg, NL80211_TXQ_ATTR_AIFS, aifs);
+
+	nla_nest_end(msg,params);
+	nla_nest_end(msg,txq);
+
+	printf("cw_min:%d, cw_max:%d txop:%d aifs:%d\n", cw_min, cw_max, txop, aifs);
+
+	return 0;
+
+ nla_put_failure:
+	return -ENOBUFS;
+}
+
+COMMAND(set, wmm_params, "<VO|VI|BE|BK> <cw_min> <cw_max> <aifs> <txop>",
+	NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_wmm_params,
+	"Set WMM parameters for a queue (VO, VI, BE, or BK):\n"
+	" * cw_min/cw_max - contention window minimum/maximum\n"
+	"                   (a value of the form 2^n-1 in the range 1..32767)\n"
+	" * aifs - arbitration interframe spacing (0..255)\n"
+	" * txop - maximum burst time in units of 32 usecs, 0 meaning disabled\n"
+	);
-- 
2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iw: allow to set wmm parameters from iw
  2019-02-21 23:18 [PATCH] iw: allow to set wmm parameters from iw Andrea Greco
@ 2019-02-22 11:03 ` Johannes Berg
  2019-02-24 15:25   ` [PATCH v2] " Andrea Greco
  0 siblings, 1 reply; 4+ messages in thread
From: Johannes Berg @ 2019-02-22 11:03 UTC (permalink / raw)
  To: Andrea Greco; +Cc: johannes.berg, linux-wireless, Andrea Greco

Andrea Greco <a.greco@4sigma.it> wrote:

> From: Andrea Greco <a.greco@4sigma.it>

please review the contributing file and resend your patch with signed-
off-by. also, i think the printf shouldn't be there.

Patch set to Changes Requested.

-- 
https://patchwork.kernel.org/patch/10824843/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] iw: allow to set wmm parameters from iw
  2019-02-22 11:03 ` Johannes Berg
@ 2019-02-24 15:25   ` Andrea Greco
  0 siblings, 0 replies; 4+ messages in thread
From: Andrea Greco @ 2019-02-24 15:25 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Andrea Greco

From: Andrea Greco <a.greco@4sigma.it>

Allow iw modify cw_min cw_max aifs txop

Signed-off-by: Andrea Greco <a.greco@4sigma.it>
---
Changelog:
  - Removed useless printf
 phy.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/phy.c b/phy.c
index 77df7a7..d723dde 100644
--- a/phy.c
+++ b/phy.c
@@ -843,3 +843,81 @@ static int handle_get_txq(struct nl80211_state *state,
 COMMAND(get, txq, "",
 	NL80211_CMD_GET_WIPHY, 0, CIB_PHY, handle_get_txq,
 	"Get TXQ parameters.");
+
+static int handle_wmm_params(struct nl80211_state *state,
+			     struct nl_msg *msg,
+			     int argc, char **argv,
+			     enum id_input id)
+{
+	char *end;
+	struct nlattr *txq, *params;
+	int queue, cw_min, cw_max, aifs, txop;
+
+	if (argc != 5)
+		return 1;
+
+	if (!strcmp(argv[0], "VO"))
+		queue = NL80211_TXQ_Q_VO;
+	else if (!strcmp(argv[0], "VI"))
+		queue = NL80211_TXQ_Q_VI;
+	else if (!strcmp(argv[0], "BK"))
+		queue = NL80211_TXQ_Q_BK;
+	else if (!strcmp(argv[0], "BE"))
+		queue = NL80211_TXQ_Q_BE;
+	else {
+		printf("Invalid parameter: %s\n", argv[0]);
+		return 2;
+	}
+
+	if (!*argv[1] || !*argv[2] || !*argv[3] || !*argv[4])
+		return 1;
+
+	cw_min = strtoul(argv[1], &end, 0);
+	if (*end)
+		return 1;
+
+	cw_max = strtoul(argv[2], &end, 0);
+	if (*end)
+		return 1;
+
+	aifs = strtoul(argv[3], &end, 0);
+	if (*end)
+		return 1;
+
+	txop = strtoul(argv[4], &end, 0);
+	if (*end)
+		return 1;
+
+	txq = nla_nest_start(msg, NL80211_ATTR_WIPHY_TXQ_PARAMS);
+	if (!txq) {
+		goto nla_put_failure;
+	}
+
+	params = nla_nest_start(msg, 1);
+	if (!params) {
+		goto nla_put_failure;
+	}
+
+	NLA_PUT_U8(msg, NL80211_TXQ_ATTR_QUEUE, queue);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_CWMIN, cw_min);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_CWMAX, cw_max);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_TXOP, txop);
+	NLA_PUT_U8(msg, NL80211_TXQ_ATTR_AIFS, aifs);
+
+	nla_nest_end(msg,params);
+	nla_nest_end(msg,txq);
+
+	return 0;
+
+ nla_put_failure:
+	return -ENOBUFS;
+}
+
+COMMAND(set, wmm_params, "<VO|VI|BE|BK> <cw_min> <cw_max> <aifs> <txop>",
+	NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_wmm_params,
+	"Set WMM parameters for a queue (VO, VI, BE, or BK):\n"
+	" * cw_min/cw_max - contention window minimum/maximum\n"
+	"                   (a value of the form 2^n-1 in the range 1..32767)\n"
+	" * aifs - arbitration interframe spacing (0..255)\n"
+	" * txop - maximum burst time in units of 32 usecs, 0 meaning disabled\n"
+	);
-- 
2.17.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] iw: allow to set wmm parameters from iw
  2012-11-27 18:50 [PATCH] Allow to set WMM parameters in IBSS mode Simon Wunderlich
@ 2012-11-27 18:50 ` Simon Wunderlich
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Wunderlich @ 2012-11-27 18:50 UTC (permalink / raw)
  To: linux-wireless; +Cc: linville, johannes, mathias.kretschmer, Simon Wunderlich

This is especially useful in IBSS mode.

Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
Signed-off-by: Mathias Kretschmer <mathias.kretschmer@fokus.fraunhofer.de>
---
 phy.c |   76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)

diff --git a/phy.c b/phy.c
index 860f299..b4f4726 100644
--- a/phy.c
+++ b/phy.c
@@ -359,3 +359,79 @@ COMMAND(set, antenna, "<bitmap> | all | <tx bitmap> <rx bitmap>",
 	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_antenna,
 	"Set a bitmap of allowed antennas to use for TX and RX.\n"
 	"The driver may reject antenna configurations it cannot support.");
+
+static int handle_wmm_params(struct nl80211_state *state,
+			     struct nl_cb *cb,
+			     struct nl_msg *msg,
+			     int argc, char **argv,
+			     enum id_input id)
+{
+	char *end;
+	struct nlattr *txq, *params;
+	int queue, cw_min, cw_max, aifs, txop;
+
+	if (argc != 5)
+		return 1;
+
+	if (!strcmp(argv[0], "VO"))
+		queue = NL80211_TXQ_Q_VO;
+	else if (!strcmp(argv[0], "VI"))
+		queue = NL80211_TXQ_Q_VI;
+	else if (!strcmp(argv[0], "BK"))
+		queue = NL80211_TXQ_Q_BK;
+	else if (!strcmp(argv[0], "BE"))
+		queue = NL80211_TXQ_Q_BE;
+	else {
+		printf("Invalid parameter: %s\n", argv[0]);
+		return 2;
+	}
+
+	if (!*argv[1] || !*argv[2] || !*argv[3] || !*argv[4])
+		return 1;
+
+	cw_min = strtoul(argv[1], &end, 0);
+	if (*end)
+		return 1;
+
+	cw_max = strtoul(argv[2], &end, 0);
+	if (*end)
+		return 1;
+
+	aifs = strtoul(argv[3], &end, 0);
+	if (*end)
+		return 1;
+
+	txop = strtoul(argv[4], &end, 0);
+	if (*end)
+		return 1;
+
+
+	txq = nla_nest_start(msg, NL80211_ATTR_WIPHY_TXQ_PARAMS);
+	if (!txq)
+		goto nla_put_failure;
+
+	params = nla_nest_start(msg, 1);
+	if (!params)
+		goto nla_put_failure;
+
+	NLA_PUT_U8(msg, NL80211_TXQ_ATTR_QUEUE, queue);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_CWMIN, cw_min);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_CWMAX, cw_max);
+	NLA_PUT_U8(msg, NL80211_TXQ_ATTR_AIFS, aifs);
+	NLA_PUT_U16(msg, NL80211_TXQ_ATTR_TXOP, txop);
+
+	nla_nest_end(msg, params);
+	nla_nest_end(msg, txq);
+
+return 0;
+
+ nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(set, wmm_params, "<VO|VI|BE|BK> <cw_min> <cw_max> <aifs> <txop>",
+	NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_wmm_params,
+	"Set WMM parameters for a queue (VO, VI, BE, or BK):\n"
+	" * cw_min/cw_max - contention window min/max (miliseconds)\n"
+	" * aifs - interframe spacing (ms)\n"
+	" * txop - time for tx operation limit (in units of 32 microseconds), 0 = off\n"
+	);
-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-02-24 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 23:18 [PATCH] iw: allow to set wmm parameters from iw Andrea Greco
2019-02-22 11:03 ` Johannes Berg
2019-02-24 15:25   ` [PATCH v2] " Andrea Greco
  -- strict thread matches above, loose matches on Subject: below --
2012-11-27 18:50 [PATCH] Allow to set WMM parameters in IBSS mode Simon Wunderlich
2012-11-27 18:50 ` [PATCH] iw: allow to set wmm parameters from iw Simon Wunderlich

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.