Skip to contentSkip to conversation

iw: Add new command to support tid specific configuration

PATCH New Tamizh chelvam 1 participant 1 message Apr 10, 2019 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iw: Add new command to support tid specific configuration

Add "set tid_config" command to support tid specific configurations. This command accepts multiple tid configurations
like retry, ampdu, rtscts, noack and tx bitrate at a time.

Format:

iw dev <interface> set tid_config <configuration>

Example:

Noack configuration :

iw <interface> set tid_config tid <tid_number> peer <MAC_addr> noack enable|disable

Retry count :

iw <interface> set tid_config tid <tid_number> peer <MAC_addr> retry_count long <retry_value>

Aggregation :

iw <interface> set tid_config tid <tid_number> peer <MAC_addr> ampdu enable|disable

RTSCTS configuration :

iw <interface> set tid_config tid <tid_number> peer <MAC_addr> rtscts enable|disable

Bitrates configuration :

iw <interface> set tid_config tid <tid_number> peer <MAC_addr> bitrates <[auto] [fixed] [limit]> [legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>] [vht-mcs-<2.4|5> <NSS:MCSx]]

---
 Makefile     |   2 +-
 bitrate.c    |  40 +++++++++--
 iw.h         |   3 +
 tid_config.c | 230 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 267 insertions(+), 8 deletions(-)
 create mode 100644 tid_config.c
Makefile +1 -1
index 33aaf6a..ecb5df8 100644
@@ -24,7 +24,7 @@ OBJS = iw.o genl.o event.o info.o phy.o \
 	reason.o status.o connect.o link.o offch.o ps.o cqm.o \
 	bitrate.o wowlan.o coalesce.o roc.o p2p.o vendor.o mgmt.o \
 	ap.o sha256.o nan.o bloom.o \
-	measurements.o ftm.o
+	measurements.o ftm.o tid_config.o
 OBJS += sections.o
 
 OBJS-$(HWSIM) += hwsim.o
bitrate.c +33 -7
index 4a026a4..e287b13 100644
@@ -76,10 +76,9 @@ static int setup_vht(struct nl80211_txrate_vht *txrate_vht,
 
 #define VHT_ARGC_MAX	100
 
-static int handle_bitrates(struct nl80211_state *state,
-			   struct nl_msg *msg,
-			   int argc, char **argv,
-			   enum id_input id)
+int set_bitrates(struct nl_msg *msg,
+		 int argc, char **argv,
+		 int arg_idx, enum nl80211_attrs attr)
 {
 	struct nlattr *nl_rates, *nl_band;
 	int i;
@@ -110,7 +109,7 @@ static int handle_bitrates(struct nl80211_state *state,
 		S_GI,
 	} parser_state = S_NONE;
 
-	for (i = 0; i < argc; i++) {
+	for (i = arg_idx; i < argc; i++) {
 		char *end;
 		double tmpd;
 		long tmpl;
@@ -195,10 +194,14 @@ static int handle_bitrates(struct nl80211_state *state,
 		case S_GI:
 			break;
 		default:
+			if (attr != NL80211_ATTR_TX_RATES)
+				goto next;
+
 			return 1;
 		}
 	}
 
+next:
 	if (have_vht_mcs_24)
 		if(!setup_vht(&txrate_vht_24, vht_argc_24, vht_argv_24))
 			return -EINVAL;
@@ -213,7 +216,7 @@ static int handle_bitrates(struct nl80211_state *state,
 	if (sgi_24 && lgi_24)
 		return 1;
 
-	nl_rates = nla_nest_start(msg, NL80211_ATTR_TX_RATES);
+	nl_rates = nla_nest_start(msg, attr);
 	if (!nl_rates)
 		goto nla_put_failure;
 
@@ -253,11 +256,34 @@ static int handle_bitrates(struct nl80211_state *state,
 
 	nla_nest_end(msg, nl_rates);
 
-	return 0;
+	return i;
  nla_put_failure:
 	return -ENOBUFS;
 }
 
+static int handle_bitrates(struct nl80211_state *state,
+			   struct nl_msg *msg,
+			   int argc, char **argv,
+			   enum id_input id)
+{
+	int ret;
+	struct nl_msg *rate;
+
+	rate = nlmsg_alloc();
+	if (!rate) {
+		ret = -ENOMEM;
+		goto nla_put_failure;
+	}
+
+	ret = set_bitrates(rate, argc, argv, 0, NL80211_ATTR_TX_RATES);
+	if (ret < argc)
+		return 1;
+
+	return 0;
+nla_put_failure:
+	return -ENOBUFS;
+}
+
 #define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
 #define DESCR DESCR_LEGACY " [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]"
 
iw.h +3 -0
index 16ff076..274f02c 100644
@@ -242,4 +242,7 @@ void nan_bf(uint8_t idx, uint8_t *bf, uint16_t bf_len, const uint8_t *buf,
 
 char *hex2bin(const char *hex, char *buf);
 
+int set_bitrates(struct nl_msg *msg, int argc, char **argv, int arg_idx,
+		 enum nl80211_attrs attr);
+
 #endif /* __IW_H */
tid_config.c new file +230 -0

230 lines not on this page · raw message

Signature · 1 line
1.9.1