All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] iw: support EHT and link id for setting bitrate
@ 2025-09-12  9:54 Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 1/5] iw: update nl80211.h Zong-Zhe Yang
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Zong-Zhe Yang @ 2025-09-12  9:54 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

Update nl80211.h for EHT txrate definitions. Then, extend bitrate
handling for EHT rate/gi/ltf and link id.

Zong-Zhe Yang (5):
  iw: update nl80211.h
  iw: info: extended features print EHT beacon rate
  iw: bitrate: refactor description
  iw: bitrate: support EHT rate/gi/ltf
  iw: bitrate: support link id

 bitrate.c   | 228 +++++++++++++++++++++++++++++++++++++++++++++++++---
 info.c      |   1 +
 interface.c |  32 ++++++--
 iw.h        |   2 +-
 nl80211.h   |  51 +++++++++++-
 5 files changed, 294 insertions(+), 20 deletions(-)

-- 
2.39.0


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

* [PATCH 1/5] iw: update nl80211.h
  2025-09-12  9:54 [PATCH 0/5] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
@ 2025-09-12  9:54 ` Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 2/5] iw: info: extended features print EHT beacon rate Zong-Zhe Yang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Zong-Zhe Yang @ 2025-09-12  9:54 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
---
 nl80211.h | 51 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 48 insertions(+), 3 deletions(-)

diff --git a/nl80211.h b/nl80211.h
index d1a14f2892d9..aed0b4c5d5e8 100644
--- a/nl80211.h
+++ b/nl80211.h
@@ -1943,8 +1943,9 @@ enum nl80211_commands {
  *	The driver must also specify support for this with the extended
  *	features NL80211_EXT_FEATURE_BEACON_RATE_LEGACY,
  *	NL80211_EXT_FEATURE_BEACON_RATE_HT,
- *	NL80211_EXT_FEATURE_BEACON_RATE_VHT and
- *	NL80211_EXT_FEATURE_BEACON_RATE_HE.
+ *	NL80211_EXT_FEATURE_BEACON_RATE_VHT,
+ *	NL80211_EXT_FEATURE_BEACON_RATE_HE and
+ *	NL80211_EXT_FEATURE_BEACON_RATE_EHT.
  *
  * @NL80211_ATTR_FRAME_MATCH: A binary attribute which typically must contain
  *	at least one byte, currently used with @NL80211_CMD_REGISTER_FRAME.
@@ -2283,7 +2284,8 @@ enum nl80211_commands {
  * @NL80211_ATTR_PEER_AID: Association ID for the peer TDLS station (u16).
  *	This is similar to @NL80211_ATTR_STA_AID but with a difference of being
  *	allowed to be used with the first @NL80211_CMD_SET_STATION command to
- *	update a TDLS peer STA entry.
+ *	update a TDLS peer STA entry. For S1G interfaces, this is limited to
+ *	1600 for the current mac80211 implementation.
  *
  * @NL80211_ATTR_COALESCE_RULE: Coalesce rule information.
  *
@@ -2928,6 +2930,12 @@ enum nl80211_commands {
  *	required alongside this attribute. Refer to
  *	@enum nl80211_s1g_short_beacon_attrs for the attribute definitions.
  *
+ * @NL80211_ATTR_BSS_PARAM: nested attribute used with %NL80211_CMD_GET_WIPHY
+ *	which indicates which BSS parameters can be modified. The attribute can
+ *	also be used as flag attribute by user-space in %NL80211_CMD_SET_BSS to
+ *	indicate that it wants strict checking on the BSS parameters to be
+ *	modified.
+ *
  * @NUM_NL80211_ATTR: total number of nl80211_attrs available
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3489,6 +3497,7 @@ enum nl80211_attrs {
 
 	NL80211_ATTR_S1G_LONG_BEACON_PERIOD,
 	NL80211_ATTR_S1G_SHORT_BEACON,
+	NL80211_ATTR_BSS_PARAM,
 
 	/* add attributes here, update the policy in nl80211.c */
 
@@ -3735,6 +3744,22 @@ enum nl80211_eht_gi {
 	NL80211_RATE_INFO_EHT_GI_3_2,
 };
 
+/**
+ * enum nl80211_eht_ltf - EHT long training field
+ * @NL80211_RATE_INFO_EHT_1XLTF: 3.2 usec
+ * @NL80211_RATE_INFO_EHT_2XLTF: 6.4 usec
+ * @NL80211_RATE_INFO_EHT_4XLTF: 12.8 usec
+ * @NL80211_RATE_INFO_EHT_6XLTF: 19.2 usec
+ * @NL80211_RATE_INFO_EHT_8XLTF: 25.6 usec
+ */
+enum nl80211_eht_ltf {
+	NL80211_RATE_INFO_EHT_1XLTF,
+	NL80211_RATE_INFO_EHT_2XLTF,
+	NL80211_RATE_INFO_EHT_4XLTF,
+	NL80211_RATE_INFO_EHT_6XLTF,
+	NL80211_RATE_INFO_EHT_8XLTF,
+};
+
 /**
  * enum nl80211_eht_ru_alloc - EHT RU allocation values
  * @NL80211_RATE_INFO_EHT_RU_ALLOC_26: 26-tone RU allocation
@@ -5481,6 +5506,10 @@ enum nl80211_key_attributes {
  *	see &struct nl80211_txrate_he
  * @NL80211_TXRATE_HE_GI: configure HE GI, 0.8us, 1.6us and 3.2us.
  * @NL80211_TXRATE_HE_LTF: configure HE LTF, 1XLTF, 2XLTF and 4XLTF.
+ * @NL80211_TXRATE_EHT: EHT rates allowed for TX rate selection,
+ *	see &struct nl80211_txrate_eht
+ * @NL80211_TXRATE_EHT_GI: configure EHT GI, (u8, see &enum nl80211_eht_gi)
+ * @NL80211_TXRATE_EHT_LTF: configure EHT LTF, (u8, see &enum nl80211_eht_ltf)
  * @__NL80211_TXRATE_AFTER_LAST: internal
  * @NL80211_TXRATE_MAX: highest TX rate attribute
  */
@@ -5493,6 +5522,9 @@ enum nl80211_tx_rate_attributes {
 	NL80211_TXRATE_HE,
 	NL80211_TXRATE_HE_GI,
 	NL80211_TXRATE_HE_LTF,
+	NL80211_TXRATE_EHT,
+	NL80211_TXRATE_EHT_GI,
+	NL80211_TXRATE_EHT_LTF,
 
 	/* keep last */
 	__NL80211_TXRATE_AFTER_LAST,
@@ -5525,6 +5557,15 @@ enum nl80211_txrate_gi {
 	NL80211_TXRATE_FORCE_LGI,
 };
 
+#define NL80211_EHT_NSS_MAX             16
+/**
+ * struct nl80211_txrate_eht - EHT MCS/NSS txrate bitmap
+ * @mcs: MCS bitmap table for each NSS (array index 0 for 1 stream, etc.)
+ */
+struct nl80211_txrate_eht {
+	__u16 mcs[NL80211_EHT_NSS_MAX];
+};
+
 /**
  * enum nl80211_band - Frequency band
  * @NL80211_BAND_2GHZ: 2.4 GHz ISM band
@@ -6649,6 +6690,9 @@ enum nl80211_feature_flags {
  *	(signaling and payload protected) A-MSDUs and this shall be advertised
  *	in the RSNXE.
  *
+ * @NL80211_EXT_FEATURE_BEACON_RATE_EHT: Driver supports beacon rate
+ *	configuration (AP/mesh) with EHT rates.
+ *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -6724,6 +6768,7 @@ enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_OWE_OFFLOAD_AP,
 	NL80211_EXT_FEATURE_DFS_CONCURRENT,
 	NL80211_EXT_FEATURE_SPP_AMSDU_SUPPORT,
+	NL80211_EXT_FEATURE_BEACON_RATE_EHT,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
-- 
2.39.0


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

* [PATCH 2/5] iw: info: extended features print EHT beacon rate
  2025-09-12  9:54 [PATCH 0/5] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 1/5] iw: update nl80211.h Zong-Zhe Yang
@ 2025-09-12  9:54 ` Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 3/5] iw: bitrate: refactor description Zong-Zhe Yang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Zong-Zhe Yang @ 2025-09-12  9:54 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

Deal with BEACON_RATE_EHT in ext_feat_print.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
---
 info.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/info.c b/info.c
index 18dcd368d0f8..5ce3f78688a0 100644
--- a/info.c
+++ b/info.c
@@ -174,6 +174,7 @@ static void ext_feat_print(enum nl80211_ext_feature_index idx)
 	ext_feat_case(OWE_OFFLOAD_AP, "OWE DH element handling offload (AP)");
 	ext_feat_case(DFS_CONCURRENT, "DFS channel use under concurrent DFS master");
 	ext_feat_case(SPP_AMSDU_SUPPORT, "SPP A-MSDU support");
+	ext_feat_case(BEACON_RATE_EHT, "EHT beacon rate support (AP/mesh)");
 	}
 }
 
-- 
2.39.0


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

* [PATCH 3/5] iw: bitrate: refactor description
  2025-09-12  9:54 [PATCH 0/5] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 1/5] iw: update nl80211.h Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 2/5] iw: info: extended features print EHT beacon rate Zong-Zhe Yang
@ 2025-09-12  9:54 ` Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 4/5] iw: bitrate: support EHT rate/gi/ltf Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 5/5] iw: bitrate: support link id Zong-Zhe Yang
  4 siblings, 0 replies; 8+ messages in thread
From: Zong-Zhe Yang @ 2025-09-12  9:54 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

The description is too long to read, and some parameters
have been described incorrectly, e.g. vht-mcs.

Re-plan macro for description and use it.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
---
 bitrate.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/bitrate.c b/bitrate.c
index 87146699937b..8c575b086eba 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -456,9 +456,22 @@ static int handle_bitrates(struct nl80211_state *state,
 }
 
 #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>  [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5]"
-
-COMMAND(set, bitrates, "[legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*] [vht-mcs-<2.4|5> [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*] [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [he-ltf-<2.4|5|6> <1|2|4>]",
+#define DESCR_HT " [ht-mcs-<2.4|5> <MCS index>*]"
+#define DESCR_VHT " [vht-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*]"
+#define DESCR_HE " [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*]"
+#define DESCR_GI " [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>]"
+#define DESCR_LTF " [he-ltf-<2.4|5|6> <1|2|4>]"
+
+#define DESCR \
+	DESCR_LEGACY \
+	DESCR_HT \
+	DESCR_VHT \
+	DESCR_HE \
+	DESCR_GI \
+	DESCR_LTF \
+	/* end of DESCR */
+
+COMMAND(set, bitrates, DESCR,
 	NL80211_CMD_SET_TX_BITRATE_MASK, 0, CIB_NETDEV, handle_bitrates,
 	"Sets up the specified rate masks.\n"
 	"Not passing any arguments would clear the existing mask (if any).");
-- 
2.39.0


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

* [PATCH 4/5] iw: bitrate: support EHT rate/gi/ltf
  2025-09-12  9:54 [PATCH 0/5] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
                   ` (2 preceding siblings ...)
  2025-09-12  9:54 ` [PATCH 3/5] iw: bitrate: refactor description Zong-Zhe Yang
@ 2025-09-12  9:54 ` Zong-Zhe Yang
  2025-09-12  9:54 ` [PATCH 5/5] iw: bitrate: support link id Zong-Zhe Yang
  4 siblings, 0 replies; 8+ messages in thread
From: Zong-Zhe Yang @ 2025-09-12  9:54 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

Support eht-mcs-*/eht-gi-*/eht-ltf-* fields when iw set bitrates.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
---
 bitrate.c | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 176 insertions(+), 8 deletions(-)

diff --git a/bitrate.c b/bitrate.c
index 8c575b086eba..16f118cce4ec 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -7,7 +7,7 @@
 static int parse_rate_chunk(const char *arg, __u8 *nss, __u16 *mcs, unsigned int mode)
 {
 	unsigned int count, i;
-	unsigned int inss, mcs_start, mcs_end, tab[12];
+	unsigned int inss, mcs_start, mcs_end, tab[16];
 	unsigned int max_mcs = 0, max_nss = 0;
 
 	*nss = 0; *mcs = 0;
@@ -15,6 +15,9 @@ static int parse_rate_chunk(const char *arg, __u8 *nss, __u16 *mcs, unsigned int
 	if (mode == NL80211_TXRATE_HE) {
 		max_mcs = 11;
 		max_nss = NL80211_HE_NSS_MAX;
+	} else if (mode == NL80211_TXRATE_EHT) {
+		max_mcs = 15;
+		max_nss = NL80211_EHT_NSS_MAX;
 	} else {
 		max_mcs = 9;
 		max_nss = NL80211_VHT_NSS_MAX;
@@ -47,6 +50,12 @@ static int parse_rate_chunk(const char *arg, __u8 *nss, __u16 *mcs, unsigned int
 				       &inss, &tab[0], &tab[1], &tab[2], &tab[3],
 				       &tab[4], &tab[5], &tab[6], &tab[7], &tab[8],
 				       &tab[9], &tab[10], &tab[11]);
+		} else if (mode == NL80211_TXRATE_EHT) {
+			count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u",
+				       &inss, &tab[0], &tab[1], &tab[2], &tab[3],
+				       &tab[4], &tab[5], &tab[6], &tab[7], &tab[8],
+				       &tab[9], &tab[10], &tab[11], &tab[12], &tab[13],
+				       &tab[14], &tab[15]);
 		} else {
 			count = sscanf(arg, "%u:%u,%u,%u,%u,%u,%u,%u,%u,%u,%u", &inss,
 				       &tab[0], &tab[1], &tab[2], &tab[3], &tab[4],
@@ -80,6 +89,11 @@ static int parse_he_chunk(const char *arg, __u8 *nss, __u16 *mcs)
 	return parse_rate_chunk(arg, nss, mcs, NL80211_TXRATE_HE);
 }
 
+static int parse_eht_chunk(const char *arg, __u8 *nss, __u16 *mcs)
+{
+	return parse_rate_chunk(arg, nss, mcs, NL80211_TXRATE_EHT);
+}
+
 static int setup_vht(struct nl80211_txrate_vht *txrate_vht,
 		     int argc, char **argv)
 {
@@ -120,6 +134,26 @@ static int setup_he(struct nl80211_txrate_he *txrate_he,
 	return 1;
 }
 
+static int setup_eht(struct nl80211_txrate_eht *txrate_eht,
+		     int argc, char **argv)
+{
+	__u8 nss;
+	__u16 mcs;
+	int i;
+
+	memset(txrate_eht, 0, sizeof(*txrate_eht));
+
+	for (i = 0; i < argc; i++) {
+		if (!parse_eht_chunk(argv[i], &nss, &mcs))
+			return 0;
+
+		nss--;
+		txrate_eht->mcs[nss] |= mcs;
+	}
+
+	return 1;
+}
+
 #define HE_GI_STR_MAX	16
 #define HE_GI_08_STR "0.8"
 #define HE_GI_16_STR "1.6"
@@ -139,6 +173,24 @@ static int parse_he_gi(char *he_gi)
 	return -1;
 }
 
+#define EHT_GI_08_STR "0.8"
+#define EHT_GI_16_STR "1.6"
+#define EHT_GI_32_STR "3.2"
+static int parse_eht_gi(char *eht_gi)
+{
+	if (eht_gi == NULL)
+		return 0;
+
+	if (!strncmp(eht_gi, EHT_GI_08_STR, sizeof(EHT_GI_08_STR)))
+		return NL80211_RATE_INFO_EHT_GI_0_8;
+	if (!strncmp(eht_gi, EHT_GI_16_STR, sizeof(EHT_GI_16_STR)))
+		return NL80211_RATE_INFO_EHT_GI_1_6;
+	if (!strncmp(eht_gi, EHT_GI_32_STR, sizeof(EHT_GI_32_STR)))
+		return NL80211_RATE_INFO_EHT_GI_3_2;
+
+	return -1;
+}
+
 #define VHT_ARGC_MAX	100
 
 int set_bitrates(struct nl_msg *msg,
@@ -156,6 +208,7 @@ int set_bitrates(struct nl_msg *msg,
 	bool have_vht_mcs_24 = false, have_vht_mcs_5 = false;
 	bool have_he_mcs_24 = false, have_he_mcs_5 = false;
 	bool have_he_mcs_6 = false;
+	bool have_eht_mcs_24 = false, have_eht_mcs_5 = false, have_eht_mcs_6 = false;
 	uint8_t ht_mcs_24[77], ht_mcs_5[77];
 	int n_ht_mcs_24 = 0, n_ht_mcs_5 = 0;
 	struct nl80211_txrate_vht txrate_vht_24 = {};
@@ -163,21 +216,32 @@ int set_bitrates(struct nl_msg *msg,
 	struct nl80211_txrate_he txrate_he_24 = {};
 	struct nl80211_txrate_he txrate_he_5 = {};
 	struct nl80211_txrate_he txrate_he_6 = {};
+	struct nl80211_txrate_eht txrate_eht_24 = {};
+	struct nl80211_txrate_eht txrate_eht_5 = {};
+	struct nl80211_txrate_eht txrate_eht_6 = {};
 	uint8_t *mcs = NULL;
 	int *n_mcs = NULL;
 	char *vht_argv_5[VHT_ARGC_MAX] = {}; char *vht_argv_24[VHT_ARGC_MAX] = {};
 	char *he_argv_5[VHT_ARGC_MAX] = {}; char *he_argv_24[VHT_ARGC_MAX] = {};
 	char *he_argv_6[VHT_ARGC_MAX] = {};
-	char **vht_argv = NULL, **he_argv = NULL;
+	char *eht_argv_24[VHT_ARGC_MAX] = {};
+	char *eht_argv_5[VHT_ARGC_MAX] = {};
+	char *eht_argv_6[VHT_ARGC_MAX] = {};
+	char **vht_argv = NULL, **he_argv = NULL, **eht_argv = NULL;
 	int vht_argc_5 = 0; int vht_argc_24 = 0;
 	int he_argc_5 = 0; int he_argc_24 = 0;
 	int he_argc_6 = 0;
-	int *vht_argc = NULL, *he_argc = NULL;
+	int eht_argc_24 = 0, eht_argc_5 = 0, eht_argc_6 = 0;
+	int *vht_argc = NULL, *he_argc = NULL, *eht_argc = NULL;
 	int sgi_24 = 0, sgi_5 = 0, lgi_24 = 0, lgi_5 = 0;
 	int has_he_gi_24 = 0, has_he_gi_5 = 0, has_he_ltf_24 = 0, has_he_ltf_5 = 0;
 	int has_he_gi_6 = 0, has_he_ltf_6 = 0;
+	int has_eht_gi_24 = 0, has_eht_gi_5 = 0, has_eht_gi_6 = 0;
+	int has_eht_ltf_24 = 0, has_eht_ltf_5 = 0, has_eht_ltf_6 = 0;
 	int he_gi = 0, he_ltf = 0;
 	char *he_gi_argv = NULL;
+	int eht_gi = 0, eht_ltf = 0;
+	char *eht_gi_argv = NULL;
 
 	enum {
 		S_NONE,
@@ -185,9 +249,12 @@ int set_bitrates(struct nl_msg *msg,
 		S_HT,
 		S_VHT,
 		S_HE,
+		S_EHT,
 		S_GI,
 		S_HE_GI,
 		S_HE_LTF,
+		S_EHT_GI,
+		S_EHT_LTF,
 	} parser_state = S_NONE;
 
 	for (i = 0; i < argc; i++) {
@@ -259,6 +326,27 @@ int set_bitrates(struct nl_msg *msg,
 			he_argv = he_argv_6;
 			he_argc = &he_argc_6;
 			have_he_mcs_6 = true;
+		} else if (strcmp(argv[i], "eht-mcs-2.4") == 0) {
+			if (have_eht_mcs_24)
+				return 1;
+			parser_state = S_EHT;
+			eht_argv = eht_argv_24;
+			eht_argc = &eht_argc_24;
+			have_eht_mcs_24 = true;
+		} else if (strcmp(argv[i], "eht-mcs-5") == 0) {
+			if (have_eht_mcs_5)
+				return 1;
+			parser_state = S_EHT;
+			eht_argv = eht_argv_5;
+			eht_argc = &eht_argc_5;
+			have_eht_mcs_5 = true;
+		} else if (strcmp(argv[i], "eht-mcs-6") == 0) {
+			if (have_eht_mcs_6)
+				return 1;
+			parser_state = S_EHT;
+			eht_argv = eht_argv_6;
+			eht_argc = &eht_argc_6;
+			have_eht_mcs_6 = true;
 		} else if (strcmp(argv[i], "sgi-2.4") == 0) {
 			sgi_24 = 1;
 			parser_state = S_GI;
@@ -289,6 +377,24 @@ int set_bitrates(struct nl_msg *msg,
 		} else if (strcmp(argv[i], "he-ltf-6") == 0) {
 			has_he_ltf_6 = 1;
 			parser_state = S_HE_LTF;
+		} else if (strcmp(argv[i], "eht-gi-2.4") == 0) {
+			has_eht_gi_24 = 1;
+			parser_state = S_EHT_GI;
+		} else if (strcmp(argv[i], "eht-gi-5") == 0) {
+			has_eht_gi_5 = 1;
+			parser_state = S_EHT_GI;
+		} else if (strcmp(argv[i], "eht-gi-6") == 0) {
+			has_eht_gi_6 = 1;
+			parser_state = S_EHT_GI;
+		} else if (strcmp(argv[i], "eht-ltf-2.4") == 0) {
+			has_eht_ltf_24 = 1;
+			parser_state = S_EHT_LTF;
+		} else if (strcmp(argv[i], "eht-ltf-5") == 0) {
+			has_eht_ltf_5 = 1;
+			parser_state = S_EHT_LTF;
+		} else if (strcmp(argv[i], "eht-ltf-6") == 0) {
+			has_eht_ltf_6 = 1;
+			parser_state = S_EHT_LTF;
 		} else switch (parser_state) {
 		case S_LEGACY:
 			tmpd = strtod(argv[i], &end);
@@ -316,6 +422,11 @@ int set_bitrates(struct nl_msg *msg,
 				return 1;
 			he_argv[(*he_argc)++] = argv[i];
 			break;
+		case S_EHT:
+			if (*eht_argc >= VHT_ARGC_MAX)
+				return 1;
+			eht_argv[(*eht_argc)++] = argv[i];
+			break;
 		case S_GI:
 			break;
 		case S_HE_GI:
@@ -329,6 +440,19 @@ int set_bitrates(struct nl_msg *msg,
 				return 1;
 			he_ltf = he_ltf >> 1;
 			break;
+		case S_EHT_GI:
+			eht_gi_argv = argv[i];
+			break;
+		case S_EHT_LTF:
+			eht_ltf = strtol(argv[i], &end, 0);
+			if (*end != '\0')
+				return 1;
+			if (eht_ltf < 1 || eht_ltf > 8)
+				return 1;
+			if (eht_ltf != 1 && eht_ltf % 2)
+				return 1;
+			eht_ltf >>= 1;
+			break;
 		default:
 			if (attr != NL80211_ATTR_TX_RATES)
 				goto next;
@@ -360,6 +484,18 @@ next:
 		if (!setup_he(&txrate_he_6, he_argc_6, he_argv_6))
 			return -EINVAL;
 
+	if (have_eht_mcs_24)
+		if (!setup_eht(&txrate_eht_24, eht_argc_24, eht_argv_24))
+			return -EINVAL;
+
+	if (have_eht_mcs_5)
+		if (!setup_eht(&txrate_eht_5, eht_argc_5, eht_argv_5))
+			return -EINVAL;
+
+	if (have_eht_mcs_6)
+		if (!setup_eht(&txrate_eht_6, eht_argc_6, eht_argv_6))
+			return -EINVAL;
+
 	if (sgi_5 && lgi_5)
 		return 1;
 
@@ -372,12 +508,19 @@ next:
 			return 1;
 	}
 
+	if (eht_gi_argv) {
+		eht_gi = parse_eht_gi(eht_gi_argv);
+		if (eht_gi < 0)
+			return 1;
+	}
+
 	nl_rates = nla_nest_start(msg, attr);
 	if (!nl_rates)
 		goto nla_put_failure;
 
 	if (have_legacy_24 || have_ht_mcs_24 || have_vht_mcs_24 || have_he_mcs_24 ||
-	    sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24) {
+	    sgi_24 || lgi_24 || has_he_gi_24 || has_he_ltf_24 ||
+	    have_eht_mcs_24 || has_eht_gi_24 || has_eht_ltf_24) {
 		nl_band = nla_nest_start(msg, NL80211_BAND_2GHZ);
 		if (!nl_band)
 			goto nla_put_failure;
@@ -390,6 +533,9 @@ next:
 		if (have_he_mcs_24)
 			nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_24),
 				&txrate_he_24);
+		if (have_eht_mcs_24)
+			nla_put(msg, NL80211_TXRATE_EHT, sizeof(txrate_eht_24),
+				&txrate_eht_24);
 		if (sgi_24)
 			nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_SGI);
 		if (lgi_24)
@@ -398,11 +544,16 @@ next:
 			nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
 		if (has_he_ltf_24)
 			nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
+		if (has_eht_gi_24)
+			nla_put_u8(msg, NL80211_TXRATE_EHT_GI, eht_gi);
+		if (has_eht_ltf_24)
+			nla_put_u8(msg, NL80211_TXRATE_EHT_LTF, eht_ltf);
 		nla_nest_end(msg, nl_band);
 	}
 
 	if (have_legacy_5 || have_ht_mcs_5 || have_vht_mcs_5 || have_he_mcs_5 ||
-	    sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5) {
+	    sgi_5 || lgi_5 || has_he_gi_5 || has_he_ltf_5 ||
+	    have_eht_mcs_5 || has_eht_gi_5 || has_eht_ltf_5) {
 		nl_band = nla_nest_start(msg, NL80211_BAND_5GHZ);
 		if (!nl_band)
 			goto nla_put_failure;
@@ -415,6 +566,9 @@ next:
 		if (have_he_mcs_5)
 			nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_5),
 				&txrate_he_5);
+		if (have_eht_mcs_5)
+			nla_put(msg, NL80211_TXRATE_EHT, sizeof(txrate_eht_5),
+				&txrate_eht_5);
 		if (sgi_5)
 			nla_put_u8(msg, NL80211_TXRATE_GI, NL80211_TXRATE_FORCE_SGI);
 		if (lgi_5)
@@ -423,20 +577,32 @@ next:
 			nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
 		if (has_he_ltf_5)
 			nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
+		if (has_eht_gi_5)
+			nla_put_u8(msg, NL80211_TXRATE_EHT_GI, eht_gi);
+		if (has_eht_ltf_5)
+			nla_put_u8(msg, NL80211_TXRATE_EHT_LTF, eht_ltf);
 		nla_nest_end(msg, nl_band);
 	}
 
-	if (have_he_mcs_6 || has_he_gi_6 || has_he_ltf_6) {
+	if (have_he_mcs_6 || has_he_gi_6 || has_he_ltf_6 ||
+	    have_eht_mcs_6 || has_eht_gi_6 || has_eht_ltf_6) {
 		nl_band = nla_nest_start(msg, NL80211_BAND_6GHZ);
 		if (!nl_band)
 			goto nla_put_failure;
 		if (have_he_mcs_6)
 			nla_put(msg, NL80211_TXRATE_HE, sizeof(txrate_he_6),
 				&txrate_he_6);
+		if (have_eht_mcs_6)
+			nla_put(msg, NL80211_TXRATE_EHT, sizeof(txrate_eht_6),
+				&txrate_eht_6);
 		if (has_he_gi_6)
 			nla_put_u8(msg, NL80211_TXRATE_HE_GI, he_gi);
 		if (has_he_ltf_6)
 			nla_put_u8(msg, NL80211_TXRATE_HE_LTF, he_ltf);
+		if (has_eht_gi_6)
+			nla_put_u8(msg, NL80211_TXRATE_EHT_GI, eht_gi);
+		if (has_eht_ltf_6)
+			nla_put_u8(msg, NL80211_TXRATE_EHT_LTF, eht_ltf);
 		nla_nest_end(msg, nl_band);
 	}
 
@@ -459,14 +625,16 @@ static int handle_bitrates(struct nl80211_state *state,
 #define DESCR_HT " [ht-mcs-<2.4|5> <MCS index>*]"
 #define DESCR_VHT " [vht-mcs-<2.4|5> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*]"
 #define DESCR_HE " [he-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*]"
-#define DESCR_GI " [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>]"
-#define DESCR_LTF " [he-ltf-<2.4|5|6> <1|2|4>]"
+#define DESCR_EHT " [eht-mcs-<2.4|5|6> <NSS:MCSx,MCSy... | NSS:MCSx-MCSy>*]"
+#define DESCR_GI " [sgi-2.4|lgi-2.4] [sgi-5|lgi-5] [he-gi-<2.4|5|6> <0.8|1.6|3.2>] [eht-gi-<2.4|5|6> <0.8|1.6|3.2>]"
+#define DESCR_LTF " [he-ltf-<2.4|5|6> <1|2|4>] [eht-ltf-<2.4|5|6> <1|2|4|6|8>]"
 
 #define DESCR \
 	DESCR_LEGACY \
 	DESCR_HT \
 	DESCR_VHT \
 	DESCR_HE \
+	DESCR_EHT \
 	DESCR_GI \
 	DESCR_LTF \
 	/* end of DESCR */
-- 
2.39.0


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

* [PATCH 5/5] iw: bitrate: support link id
  2025-09-12  9:54 [PATCH 0/5] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
                   ` (3 preceding siblings ...)
  2025-09-12  9:54 ` [PATCH 4/5] iw: bitrate: support EHT rate/gi/ltf Zong-Zhe Yang
@ 2025-09-12  9:54 ` Zong-Zhe Yang
  2025-09-15  4:26   ` Raja Mani
  4 siblings, 1 reply; 8+ messages in thread
From: Zong-Zhe Yang @ 2025-09-12  9:54 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

Since nl80211 requires valid link id (NL80211_FLAG_MLO_VALID_LINK_ID),
support link-id field for MLD. For non-MLD, just as before, no need to
assign link-id field.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
---
 bitrate.c   | 29 +++++++++++++++++++++++++++--
 interface.c | 32 +++++++++++++++++++++++++++-----
 iw.h        |  2 +-
 3 files changed, 55 insertions(+), 8 deletions(-)

diff --git a/bitrate.c b/bitrate.c
index 16f118cce4ec..78d399d227e2 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -195,7 +195,7 @@ static int parse_eht_gi(char *eht_gi)
 
 int set_bitrates(struct nl_msg *msg,
 		 int argc, char **argv,
-		 enum nl80211_attrs attr)
+		 enum nl80211_attrs attr, int *link_id)
 {
 	struct nlattr *nl_rates, *nl_band;
 	int i, ret = 0;
@@ -242,6 +242,7 @@ int set_bitrates(struct nl_msg *msg,
 	char *he_gi_argv = NULL;
 	int eht_gi = 0, eht_ltf = 0;
 	char *eht_gi_argv = NULL;
+	bool has_link_id = false;
 
 	enum {
 		S_NONE,
@@ -250,6 +251,7 @@ int set_bitrates(struct nl_msg *msg,
 		S_VHT,
 		S_HE,
 		S_EHT,
+		S_LINK_ID,
 		S_GI,
 		S_HE_GI,
 		S_HE_LTF,
@@ -347,6 +349,11 @@ int set_bitrates(struct nl_msg *msg,
 			eht_argv = eht_argv_6;
 			eht_argc = &eht_argc_6;
 			have_eht_mcs_6 = true;
+		} else if (strcmp(argv[i], "link-id") == 0) {
+			if (has_link_id)
+				return 1;
+			parser_state = S_LINK_ID;
+			has_link_id = true;
 		} else if (strcmp(argv[i], "sgi-2.4") == 0) {
 			sgi_24 = 1;
 			parser_state = S_GI;
@@ -427,6 +434,11 @@ int set_bitrates(struct nl_msg *msg,
 				return 1;
 			eht_argv[(*eht_argc)++] = argv[i];
 			break;
+		case S_LINK_ID:
+			*link_id = strtol(argv[i], &end, 0);
+			if (*end != '\0')
+				return 1;
+			break;
 		case S_GI:
 			break;
 		case S_HE_GI:
@@ -618,7 +630,20 @@ static int handle_bitrates(struct nl80211_state *state,
 			   int argc, char **argv,
 			   enum id_input id)
 {
-	return set_bitrates(msg, argc, argv, NL80211_ATTR_TX_RATES);
+	int link_id = -1;
+	int ret;
+
+	ret = set_bitrates(msg, argc, argv, NL80211_ATTR_TX_RATES, &link_id);
+	if (ret)
+		return ret;
+
+	if (link_id >= 0)
+		NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
+
+	return 0;
+
+ nla_put_failure:
+	return -ENOBUFS;
 }
 
 #define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
diff --git a/interface.c b/interface.c
index 65a4006963e5..0f1e9647f0e4 100644
--- a/interface.c
+++ b/interface.c
@@ -796,10 +796,11 @@ static int toggle_tid_param(const char *argv0, const char *argv1,
 	return -ENOBUFS;
 }
 
-static int handle_tid_config(struct nl80211_state *state,
-			     struct nl_msg *msg,
-			     int argc, char **argv,
-			     enum id_input id)
+static int __handle_tid_config(struct nl80211_state *state,
+			       struct nl_msg *msg,
+			       int argc, char **argv,
+			       enum id_input id,
+			       int *link_id)
 {
 	struct nlattr *tids_array = NULL;
 	struct nlattr *tids_entry = NULL;
@@ -989,7 +990,7 @@ static int handle_tid_config(struct nl80211_state *state,
 				if (txrate_type != NL80211_TX_RATE_AUTOMATIC) {
 					attr = NL80211_TID_CONFIG_ATTR_TX_RATE;
 					ret = set_bitrates(msg, argc, argv,
-							   attr);
+							   attr, link_id);
 					if (ret < 2)
 						return 1;
 
@@ -1020,6 +1021,27 @@ nla_put_failure:
 	return -ENOBUFS;
 }
 
+static int handle_tid_config(struct nl80211_state *state,
+			     struct nl_msg *msg,
+			     int argc, char **argv,
+			     enum id_input id)
+{
+	int link_id = -1;
+	int ret;
+
+	ret = __handle_tid_config(state, msg, argc, argv, id, &link_id);
+	if (ret)
+		return ret;
+
+	if (link_id >= 0)
+		NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
+
+	return 0;
+
+ nla_put_failure:
+	return -ENOBUFS;
+}
+
 COMMAND(set, tidconf, "[peer <MAC address>] tids <mask> [override] [sretry <num>] [lretry <num>] "
 	"[ampdu [on|off]] [amsdu [on|off]] [noack [on|off]] [rtscts [on|off]]"
 	"[bitrates <type [auto|fixed|limit]> [legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*]"
diff --git a/iw.h b/iw.h
index 145b058d86ba..5c4ab6b0b38e 100644
--- a/iw.h
+++ b/iw.h
@@ -302,7 +302,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,
-		 enum nl80211_attrs attr);
+		 enum nl80211_attrs attr, int *link_id);
 
 int calc_s1g_ch_center_freq(__u8 ch_index, __u8 s1g_oper_class);
 
-- 
2.39.0


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

* Re: [PATCH 5/5] iw: bitrate: support link id
  2025-09-12  9:54 ` [PATCH 5/5] iw: bitrate: support link id Zong-Zhe Yang
@ 2025-09-15  4:26   ` Raja Mani
  2025-09-16  2:27     ` Zong-Zhe Yang
  0 siblings, 1 reply; 8+ messages in thread
From: Raja Mani @ 2025-09-15  4:26 UTC (permalink / raw)
  To: Zong-Zhe Yang, johannes; +Cc: linux-wireless



On 9/12/2025 3:24 PM, Zong-Zhe Yang wrote:
> Since nl80211 requires valid link id (NL80211_FLAG_MLO_VALID_LINK_ID),
> support link-id field for MLD. For non-MLD, just as before, no need to
> assign link-id field.
> 
> Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
> ---
>   bitrate.c   | 29 +++++++++++++++++++++++++++--
>   interface.c | 32 +++++++++++++++++++++++++++-----
>   iw.h        |  2 +-
>   3 files changed, 55 insertions(+), 8 deletions(-)
> 
> diff --git a/bitrate.c b/bitrate.c
> index 16f118cce4ec..78d399d227e2 100644
> --- a/bitrate.c
> +++ b/bitrate.c
> @@ -195,7 +195,7 @@ static int parse_eht_gi(char *eht_gi)
>   
>   int set_bitrates(struct nl_msg *msg,
>   		 int argc, char **argv,
> -		 enum nl80211_attrs attr)
> +		 enum nl80211_attrs attr, int *link_id)
>   {
>   	struct nlattr *nl_rates, *nl_band;
>   	int i, ret = 0;
> @@ -242,6 +242,7 @@ int set_bitrates(struct nl_msg *msg,
>   	char *he_gi_argv = NULL;
>   	int eht_gi = 0, eht_ltf = 0;
>   	char *eht_gi_argv = NULL;
> +	bool has_link_id = false;
>   
>   	enum {
>   		S_NONE,
> @@ -250,6 +251,7 @@ int set_bitrates(struct nl_msg *msg,
>   		S_VHT,
>   		S_HE,
>   		S_EHT,
> +		S_LINK_ID,
>   		S_GI,
>   		S_HE_GI,
>   		S_HE_LTF,
> @@ -347,6 +349,11 @@ int set_bitrates(struct nl_msg *msg,
>   			eht_argv = eht_argv_6;
>   			eht_argc = &eht_argc_6;
>   			have_eht_mcs_6 = true;
> +		} else if (strcmp(argv[i], "link-id") == 0) {

Missed to include this new arg in 'tidconf' and 'bitrates' option's
help text ?

> +			if (has_link_id)
> +				return 1;
> +			parser_state = S_LINK_ID;
> +			has_link_id = true;
>   		} else if (strcmp(argv[i], "sgi-2.4") == 0) {
>   			sgi_24 = 1;
>   			parser_state = S_GI;
> @@ -427,6 +434,11 @@ int set_bitrates(struct nl_msg *msg,
>   				return 1;
>   			eht_argv[(*eht_argc)++] = argv[i];
>   			break;
> +		case S_LINK_ID:
> +			*link_id = strtol(argv[i], &end, 0);
> +			if (*end != '\0')
> +				return 1;
> +			break;
>   		case S_GI:
>   			break;
>   		case S_HE_GI:
> @@ -618,7 +630,20 @@ static int handle_bitrates(struct nl80211_state *state,
>   			   int argc, char **argv,
>   			   enum id_input id)
>   {
> -	return set_bitrates(msg, argc, argv, NL80211_ATTR_TX_RATES);
> +	int link_id = -1;
> +	int ret;
> +
> +	ret = set_bitrates(msg, argc, argv, NL80211_ATTR_TX_RATES, &link_id);
> +	if (ret)
> +		return ret;
> +
> +	if (link_id >= 0)
> +		NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
> +
> +	return 0;
> +
> + nla_put_failure:
> +	return -ENOBUFS;
>   }
>   
>   #define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
> diff --git a/interface.c b/interface.c
> index 65a4006963e5..0f1e9647f0e4 100644
> --- a/interface.c
> +++ b/interface.c
> @@ -796,10 +796,11 @@ static int toggle_tid_param(const char *argv0, const char *argv1,
>   	return -ENOBUFS;
>   }
>   
> -static int handle_tid_config(struct nl80211_state *state,
> -			     struct nl_msg *msg,
> -			     int argc, char **argv,
> -			     enum id_input id)
> +static int __handle_tid_config(struct nl80211_state *state,
> +			       struct nl_msg *msg,
> +			       int argc, char **argv,
> +			       enum id_input id,
> +			       int *link_id)
>   {
>   	struct nlattr *tids_array = NULL;
>   	struct nlattr *tids_entry = NULL;
> @@ -989,7 +990,7 @@ static int handle_tid_config(struct nl80211_state *state,
>   				if (txrate_type != NL80211_TX_RATE_AUTOMATIC) {
>   					attr = NL80211_TID_CONFIG_ATTR_TX_RATE;
>   					ret = set_bitrates(msg, argc, argv,
> -							   attr);
> +							   attr, link_id);
>   					if (ret < 2)
>   						return 1;
>   
> @@ -1020,6 +1021,27 @@ nla_put_failure:
>   	return -ENOBUFS;
>   }
>   
> +static int handle_tid_config(struct nl80211_state *state,
> +			     struct nl_msg *msg,
> +			     int argc, char **argv,
> +			     enum id_input id)
> +{
> +	int link_id = -1;
> +	int ret;
> +
> +	ret = __handle_tid_config(state, msg, argc, argv, id, &link_id);
> +	if (ret)
> +		return ret;
> +
> +	if (link_id >= 0)
> +		NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
> +
> +	return 0;
> +
> + nla_put_failure:
> +	return -ENOBUFS;
> +}
> +
>   COMMAND(set, tidconf, "[peer <MAC address>] tids <mask> [override] [sretry <num>] [lretry <num>] "
>   	"[ampdu [on|off]] [amsdu [on|off]] [noack [on|off]] [rtscts [on|off]]"
>   	"[bitrates <type [auto|fixed|limit]> [legacy-<2.4|5> <legacy rate in Mbps>*] [ht-mcs-<2.4|5> <MCS index>*]"
> diff --git a/iw.h b/iw.h
> index 145b058d86ba..5c4ab6b0b38e 100644
> --- a/iw.h
> +++ b/iw.h
> @@ -302,7 +302,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,
> -		 enum nl80211_attrs attr);
> +		 enum nl80211_attrs attr, int *link_id);
>   
>   int calc_s1g_ch_center_freq(__u8 ch_index, __u8 s1g_oper_class);
>   


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

* RE: [PATCH 5/5] iw: bitrate: support link id
  2025-09-15  4:26   ` Raja Mani
@ 2025-09-16  2:27     ` Zong-Zhe Yang
  0 siblings, 0 replies; 8+ messages in thread
From: Zong-Zhe Yang @ 2025-09-16  2:27 UTC (permalink / raw)
  To: Raja Mani, johannes@sipsolutions.net; +Cc: linux-wireless@vger.kernel.org

Raja Mani <raja.mani@oss.qualcomm.com> wrote:
> 
> On 9/12/2025 3:24 PM, Zong-Zhe Yang wrote:
> > Since nl80211 requires valid link id (NL80211_FLAG_MLO_VALID_LINK_ID),
> > support link-id field for MLD. For non-MLD, just as before, no need to
> > assign link-id field.
> >
> > Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
> > ---
> >   bitrate.c   | 29 +++++++++++++++++++++++++++--
> >   interface.c | 32 +++++++++++++++++++++++++++-----
> >   iw.h        |  2 +-
> >   3 files changed, 55 insertions(+), 8 deletions(-)
> >
> > diff --git a/bitrate.c b/bitrate.c
> > index 16f118cce4ec..78d399d227e2 100644
> > --- a/bitrate.c
> > +++ b/bitrate.c
> > @@ -195,7 +195,7 @@ static int parse_eht_gi(char *eht_gi)
> >
> >   int set_bitrates(struct nl_msg *msg,
> >                int argc, char **argv,
> > -              enum nl80211_attrs attr)
> > +              enum nl80211_attrs attr, int *link_id)
> >   {
> >       struct nlattr *nl_rates, *nl_band;
> >       int i, ret = 0;
> > @@ -242,6 +242,7 @@ int set_bitrates(struct nl_msg *msg,
> >       char *he_gi_argv = NULL;
> >       int eht_gi = 0, eht_ltf = 0;
> >       char *eht_gi_argv = NULL;
> > +     bool has_link_id = false;
> >
> >       enum {
> >               S_NONE,
> > @@ -250,6 +251,7 @@ int set_bitrates(struct nl_msg *msg,
> >               S_VHT,
> >               S_HE,
> >               S_EHT,
> > +             S_LINK_ID,
> >               S_GI,
> >               S_HE_GI,
> >               S_HE_LTF,
> > @@ -347,6 +349,11 @@ int set_bitrates(struct nl_msg *msg,
> >                       eht_argv = eht_argv_6;
> >                       eht_argc = &eht_argc_6;
> >                       have_eht_mcs_6 = true;
> > +             } else if (strcmp(argv[i], "link-id") == 0) {
> 
> Missed to include this new arg in 'tidconf' and 'bitrates' option's help text ?

Thanks.
I will send v2.

> 
> > +                     if (has_link_id)
> > +                             return 1;
> > +                     parser_state = S_LINK_ID;
> > +                     has_link_id = true;
> >               } else if (strcmp(argv[i], "sgi-2.4") == 0) {
> >                       sgi_24 = 1;
> >                       parser_state = S_GI; @@ -427,6 +434,11 @@ int
> > set_bitrates(struct nl_msg *msg,
> >                               return 1;
> >                       eht_argv[(*eht_argc)++] = argv[i];
> >                       break;
> > +             case S_LINK_ID:
> > +                     *link_id = strtol(argv[i], &end, 0);
> > +                     if (*end != '\0')
> > +                             return 1;
> > +                     break;
> >               case S_GI:
> >                       break;
> >               case S_HE_GI:
> > @@ -618,7 +630,20 @@ static int handle_bitrates(struct nl80211_state *state,
> >                          int argc, char **argv,
> >                          enum id_input id)
> >   {
> > -     return set_bitrates(msg, argc, argv, NL80211_ATTR_TX_RATES);
> > +     int link_id = -1;
> > +     int ret;
> > +
> > +     ret = set_bitrates(msg, argc, argv, NL80211_ATTR_TX_RATES, &link_id);
> > +     if (ret)
> > +             return ret;
> > +
> > +     if (link_id >= 0)
> > +             NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
> > +
> > +     return 0;
> > +
> > + nla_put_failure:
> > +     return -ENOBUFS;
> >   }
> >
> >   #define DESCR_LEGACY "[legacy-<2.4|5> <legacy rate in Mbps>*]"
> > diff --git a/interface.c b/interface.c index
> > 65a4006963e5..0f1e9647f0e4 100644
> > --- a/interface.c
> > +++ b/interface.c
> > @@ -796,10 +796,11 @@ static int toggle_tid_param(const char *argv0, const char *argv1,
> >       return -ENOBUFS;
> >   }
> >
> > -static int handle_tid_config(struct nl80211_state *state,
> > -                          struct nl_msg *msg,
> > -                          int argc, char **argv,
> > -                          enum id_input id)
> > +static int __handle_tid_config(struct nl80211_state *state,
> > +                            struct nl_msg *msg,
> > +                            int argc, char **argv,
> > +                            enum id_input id,
> > +                            int *link_id)
> >   {
> >       struct nlattr *tids_array = NULL;
> >       struct nlattr *tids_entry = NULL; @@ -989,7 +990,7 @@ static int
> > handle_tid_config(struct nl80211_state *state,
> >                               if (txrate_type != NL80211_TX_RATE_AUTOMATIC) {
> >                                       attr =
> NL80211_TID_CONFIG_ATTR_TX_RATE;
> >                                       ret = set_bitrates(msg, argc, argv,
> > -                                                        attr);
> > +                                                        attr,
> > + link_id);
> >                                       if (ret < 2)
> >                                               return 1;
> >
> > @@ -1020,6 +1021,27 @@ nla_put_failure:
> >       return -ENOBUFS;
> >   }
> >
> > +static int handle_tid_config(struct nl80211_state *state,
> > +                          struct nl_msg *msg,
> > +                          int argc, char **argv,
> > +                          enum id_input id) {
> > +     int link_id = -1;
> > +     int ret;
> > +
> > +     ret = __handle_tid_config(state, msg, argc, argv, id, &link_id);
> > +     if (ret)
> > +             return ret;
> > +
> > +     if (link_id >= 0)
> > +             NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
> > +
> > +     return 0;
> > +
> > + nla_put_failure:
> > +     return -ENOBUFS;
> > +}
> > +
> >   COMMAND(set, tidconf, "[peer <MAC address>] tids <mask> [override] [sretry <num>]
> [lretry <num>] "
> >       "[ampdu [on|off]] [amsdu [on|off]] [noack [on|off]] [rtscts [on|off]]"
> >       "[bitrates <type [auto|fixed|limit]> [legacy-<2.4|5> <legacy rate in Mbps>*]
> [ht-mcs-<2.4|5> <MCS index>*]"
> > diff --git a/iw.h b/iw.h
> > index 145b058d86ba..5c4ab6b0b38e 100644
> > --- a/iw.h
> > +++ b/iw.h
> > @@ -302,7 +302,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,
> > -              enum nl80211_attrs attr);
> > +              enum nl80211_attrs attr, int *link_id);
> >
> >   int calc_s1g_ch_center_freq(__u8 ch_index, __u8 s1g_oper_class);
> >


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

end of thread, other threads:[~2025-09-16  2:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-12  9:54 [PATCH 0/5] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
2025-09-12  9:54 ` [PATCH 1/5] iw: update nl80211.h Zong-Zhe Yang
2025-09-12  9:54 ` [PATCH 2/5] iw: info: extended features print EHT beacon rate Zong-Zhe Yang
2025-09-12  9:54 ` [PATCH 3/5] iw: bitrate: refactor description Zong-Zhe Yang
2025-09-12  9:54 ` [PATCH 4/5] iw: bitrate: support EHT rate/gi/ltf Zong-Zhe Yang
2025-09-12  9:54 ` [PATCH 5/5] iw: bitrate: support link id Zong-Zhe Yang
2025-09-15  4:26   ` Raja Mani
2025-09-16  2:27     ` Zong-Zhe Yang

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.