linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] iw: Add command to set airtime weight
@ 2019-02-11 17:04 Toke Høiland-Jørgensen
  2019-02-11 17:04 ` [PATCH 3/3] iw: Print airtime fairness feature Toke Høiland-Jørgensen
  2019-02-11 17:04 ` [PATCH 2/3] iw: Add printing of station tx duration and airtime weight Toke Høiland-Jørgensen
  0 siblings, 2 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-02-11 17:04 UTC (permalink / raw)
  To: linux-wireless

This adds a new iw command to set the airtime weight for a station, support
for which was recently introduced into mac80211.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
---
 station.c |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/station.c b/station.c
index e1477ef..536120c 100644
--- a/station.c
+++ b/station.c
@@ -651,6 +651,7 @@ COMMAND(station, del, "<MAC address> [subtype <subtype>] [reason-code <code>]",
 static const struct cmd *station_set_plink;
 static const struct cmd *station_set_vlan;
 static const struct cmd *station_set_mesh_power_mode;
+static const struct cmd *station_set_airtime_weight;
 
 static const struct cmd *select_station_cmd(int argc, char **argv)
 {
@@ -662,6 +663,8 @@ static const struct cmd *select_station_cmd(int argc, char **argv)
 		return station_set_vlan;
 	if (strcmp(argv[1], "mesh_power_mode") == 0)
 		return station_set_mesh_power_mode;
+	if (strcmp(argv[1], "airtime_weight") == 0)
+		return station_set_airtime_weight;
 	return NULL;
 }
 
@@ -813,6 +816,54 @@ COMMAND_ALIAS(station, set, "<MAC address> mesh_power_mode "
 	"Set link-specific mesh power mode for this station",
 	select_station_cmd, station_set_mesh_power_mode);
 
+static int handle_station_set_airtime_weight(struct nl80211_state *state,
+					     struct nl_msg *msg,
+					     int argc, char **argv,
+					     enum id_input id)
+{
+	unsigned char mac_addr[ETH_ALEN];
+	unsigned long airtime_weight = 0;
+	char *err = NULL;
+
+	if (argc < 3)
+		return 1;
+
+	if (mac_addr_a2n(mac_addr, argv[0])) {
+		fprintf(stderr, "invalid mac address\n");
+		return 2;
+	}
+	argc--;
+	argv++;
+
+	if (strcmp("airtime_weight", argv[0]) != 0)
+		return 1;
+	argc--;
+	argv++;
+
+	airtime_weight = strtoul(argv[0], &err, 0);
+	if (err && *err) {
+		fprintf(stderr, "invalid airtime weight\n");
+		return 2;
+	}
+	argc--;
+	argv++;
+
+	if (argc)
+		return 1;
+
+	NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr);
+	NLA_PUT_U16(msg, NL80211_ATTR_AIRTIME_WEIGHT, airtime_weight);
+
+	return 0;
+ nla_put_failure:
+	return -ENOBUFS;
+
+}
+COMMAND_ALIAS(station, set, "<MAC address> airtime_weight <weight>",
+	NL80211_CMD_SET_STATION, 0, CIB_NETDEV, handle_station_set_airtime_weight,
+	"Set airtime weight for this station.",
+	select_station_cmd, station_set_airtime_weight);
+
 static int handle_station_dump(struct nl80211_state *state,
 			       struct nl_msg *msg,
 			       int argc, char **argv,


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

* [PATCH 2/3] iw: Add printing of station tx duration and airtime weight
  2019-02-11 17:04 [PATCH 1/3] iw: Add command to set airtime weight Toke Høiland-Jørgensen
  2019-02-11 17:04 ` [PATCH 3/3] iw: Print airtime fairness feature Toke Høiland-Jørgensen
@ 2019-02-11 17:04 ` Toke Høiland-Jørgensen
  1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-02-11 17:04 UTC (permalink / raw)
  To: linux-wireless

This adds printing of the station TX duration (along with the existing RX
duration), and the airtime weight, both of which were added as part of the
airtime fairness patches that were recently merged into mac80211.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
---
 station.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/station.c b/station.c
index 536120c..25cbbc3 100644
--- a/station.c
+++ b/station.c
@@ -309,6 +309,7 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 		[NL80211_STA_INFO_TID_STATS] = { .type = NLA_NESTED },
 		[NL80211_STA_INFO_BSS_PARAM] = { .type = NLA_NESTED },
 		[NL80211_STA_INFO_RX_DURATION] = { .type = NLA_U64 },
+		[NL80211_STA_INFO_TX_DURATION] = { .type = NLA_U64 },
 		[NL80211_STA_INFO_ACK_SIGNAL] = {.type = NLA_U8 },
 		[NL80211_STA_INFO_ACK_SIGNAL_AVG] = { .type = NLA_U8 },
 	};
@@ -401,6 +402,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 		printf("\n\ttx bitrate:\t%s", buf);
 	}
 
+	if (sinfo[NL80211_STA_INFO_TX_DURATION])
+		printf("\n\ttx duration:\t%lld us",
+		       (unsigned long long)nla_get_u64(sinfo[NL80211_STA_INFO_TX_DURATION]));
+
 	if (sinfo[NL80211_STA_INFO_RX_BITRATE]) {
 		char buf[100];
 
@@ -420,6 +425,10 @@ static int print_sta_handler(struct nl_msg *msg, void *arg)
 		printf("\n\tavg ack signal:\t%d dBm",
 			(int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_ACK_SIGNAL_AVG]));
 
+	if (sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]) {
+		printf("\n\tairtime weight: %d", nla_get_u16(sinfo[NL80211_STA_INFO_AIRTIME_WEIGHT]));
+	}
+
 	if (sinfo[NL80211_STA_INFO_EXPECTED_THROUGHPUT]) {
 		uint32_t thr;
 


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

* [PATCH 3/3] iw: Print airtime fairness feature
  2019-02-11 17:04 [PATCH 1/3] iw: Add command to set airtime weight Toke Høiland-Jørgensen
@ 2019-02-11 17:04 ` Toke Høiland-Jørgensen
  2019-02-11 17:04 ` [PATCH 2/3] iw: Add printing of station tx duration and airtime weight Toke Høiland-Jørgensen
  1 sibling, 0 replies; 3+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-02-11 17:04 UTC (permalink / raw)
  To: linux-wireless

This adds printing of the newly introduced airtime fairness EXT_FEATURE
flag to iw.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
---
 info.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/info.c b/info.c
index f1a25da..92c7d1d 100644
--- a/info.c
+++ b/info.c
@@ -694,6 +694,8 @@ broken_combination:
 			       "control port over nl80211");
 		ext_feat_print(tb, NL80211_EXT_FEATURE_TXQS,
 			       "TXQS", "FQ-CoDel-enabled intermediate TXQs");
+		ext_feat_print(tb, NL80211_EXT_FEATURE_AIRTIME_FAIRNESS,
+			       "AIRTIME_FAIRNESS", "airtime fairness scheduling");
 	}
 
 	if (tb_msg[NL80211_ATTR_COALESCE_RULE]) {


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

end of thread, other threads:[~2019-02-11 17:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-11 17:04 [PATCH 1/3] iw: Add command to set airtime weight Toke Høiland-Jørgensen
2019-02-11 17:04 ` [PATCH 3/3] iw: Print airtime fairness feature Toke Høiland-Jørgensen
2019-02-11 17:04 ` [PATCH 2/3] iw: Add printing of station tx duration and airtime weight Toke Høiland-Jørgensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).