public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] iw: support EHT and link id for setting bitrate
@ 2025-09-17  5:55 Zong-Zhe Yang
  2025-09-17  5:55 ` [PATCH v2 1/6] iw: update nl80211.h Zong-Zhe Yang
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Zong-Zhe Yang @ 2025-09-17  5:55 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, raja.mani

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

---
Changes in v2:
	- introduce parse_link_id() in util.c
	- tweak implementation in bitrate.c by using parse_link_id()
	- extend bitrate help text
---

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

 bitrate.c | 207 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 info.c    |   1 +
 iw.h      |   1 +
 nl80211.h |  51 +++++++++++++-
 util.c    |  40 +++++++++++
 5 files changed, 288 insertions(+), 12 deletions(-)

-- 
2.39.0


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

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

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] 9+ messages in thread

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

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] 9+ messages in thread

* [PATCH v2 3/6] iw: util: support parsing link id
  2025-09-17  5:55 [PATCH v2 0/6] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
  2025-09-17  5:55 ` [PATCH v2 1/6] iw: update nl80211.h Zong-Zhe Yang
  2025-09-17  5:55 ` [PATCH v2 2/6] iw: info: extended features print EHT beacon rate Zong-Zhe Yang
@ 2025-09-17  5:55 ` Zong-Zhe Yang
  2025-09-19 10:33   ` Johannes Berg
  2025-09-17  5:55 ` [PATCH v2 4/6] iw: bitrate: refactor description Zong-Zhe Yang
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 9+ messages in thread
From: Zong-Zhe Yang @ 2025-09-17  5:55 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, raja.mani

For NL80211_FLAG_MLO_VALID_LINK_ID cases, MLD needs to assign link id,
but non-MLD doesn't. Add support of parsing link id where the pattern
is as below.

	[link-id <LINK ID>]

If found, put NL80211_ATTR_MLO_LINK_ID and remove the assignment from
the argv range.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
---
v2: newly added
---
 iw.h   |  1 +
 util.c | 40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/iw.h b/iw.h
index 145b058d86ba..1d87f011e7be 100644
--- a/iw.h
+++ b/iw.h
@@ -305,6 +305,7 @@ int set_bitrates(struct nl_msg *msg, int argc, char **argv,
 		 enum nl80211_attrs attr);
 
 int calc_s1g_ch_center_freq(__u8 ch_index, __u8 s1g_oper_class);
+int parse_link_id(struct nl_msg *msg, int *argc, char **argv);
 
 /* sections */
 DECLARE_SECTION(ap);
diff --git a/util.c b/util.c
index 36c118513e3f..ad265c1dc007 100644
--- a/util.c
+++ b/util.c
@@ -2378,3 +2378,43 @@ void print_s1g_capability(const uint8_t *caps)
 	/* Last 2 bits are reserved */
 #undef PRINT_S1G_CAP
 }
+
+int parse_link_id(struct nl_msg *msg, int *argc, char **argv)
+{
+	unsigned int link_id;
+	char *endptr;
+	int pos = -1;
+	int i;
+
+	for (i = 0; i < *argc; i++) {
+		if (strcmp(argv[i], "link-id") == 0) {
+			if (pos >= 0)
+				goto usage;
+
+			if (i + 1 >= *argc)
+				goto usage;
+
+			link_id = strtol(argv[i + 1], &endptr, 0);
+			if (*endptr != '\0')
+				goto usage;
+
+			pos = i;
+		}
+	}
+
+	if (pos == -1)
+		return 0;
+
+	memmove(argv + pos, argv + pos + 2,
+		sizeof(*argv) * (*argc - pos - 2));
+	*argc -= 2;
+
+	NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
+	return 0;
+
+usage:
+	return HANDLER_RET_USAGE;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
-- 
2.39.0


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

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

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] 9+ messages in thread

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

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] 9+ messages in thread

* [PATCH v2 6/6] iw: bitrate: support link id
  2025-09-17  5:55 [PATCH v2 0/6] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
                   ` (4 preceding siblings ...)
  2025-09-17  5:55 ` [PATCH v2 5/6] iw: bitrate: support EHT rate/gi/ltf Zong-Zhe Yang
@ 2025-09-17  5:55 ` Zong-Zhe Yang
  5 siblings, 0 replies; 9+ messages in thread
From: Zong-Zhe Yang @ 2025-09-17  5:55 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, raja.mani

For MLD, support to assign link-id field. For non-MLD, just as before,
no need to assign it.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
---
v2: based on newly added parse_link_id() and add help text
---
 bitrate.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/bitrate.c b/bitrate.c
index 16f118cce4ec..144faeac88be 100644
--- a/bitrate.c
+++ b/bitrate.c
@@ -618,6 +618,12 @@ static int handle_bitrates(struct nl80211_state *state,
 			   int argc, char **argv,
 			   enum id_input id)
 {
+	int ret;
+
+	ret = parse_link_id(msg, &argc, argv);
+	if (ret)
+		return ret;
+
 	return set_bitrates(msg, argc, argv, NL80211_ATTR_TX_RATES);
 }
 
@@ -628,6 +634,7 @@ static int handle_bitrates(struct nl80211_state *state,
 #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_MLO " [link-id <LINK ID>]"
 
 #define DESCR \
 	DESCR_LEGACY \
@@ -637,6 +644,7 @@ static int handle_bitrates(struct nl80211_state *state,
 	DESCR_EHT \
 	DESCR_GI \
 	DESCR_LTF \
+	DESCR_MLO \
 	/* end of DESCR */
 
 COMMAND(set, bitrates, DESCR,
-- 
2.39.0


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

* Re: [PATCH v2 3/6] iw: util: support parsing link id
  2025-09-17  5:55 ` [PATCH v2 3/6] iw: util: support parsing link id Zong-Zhe Yang
@ 2025-09-19 10:33   ` Johannes Berg
  2025-09-19 12:12     ` Zong-Zhe Yang
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2025-09-19 10:33 UTC (permalink / raw)
  To: Zong-Zhe Yang; +Cc: linux-wireless, raja.mani

On Wed, 2025-09-17 at 13:55 +0800, Zong-Zhe Yang wrote:
> For NL80211_FLAG_MLO_VALID_LINK_ID cases, MLD needs to assign link id,
> but non-MLD doesn't. Add support of parsing link id where the pattern
> is as below.
> 
> 	[link-id <LINK ID>]
> 
> If found, put NL80211_ATTR_MLO_LINK_ID and remove the assignment from
> the argv range.
> 
> +	memmove(argv + pos, argv + pos + 2,
> +		sizeof(*argv) * (*argc - pos - 2));

Honestly, I don't really like this, it's a bit too magic? What if you
have something in there that is like

 ... ssid link-id foo bar

and then it *meant* the SSID to be "link-id", but with this it now
actually fails or so? I don't think it's a good idea.

So I think it should just be parsing it where it is at the beginning,
and then for the last patch just put it at the beginning in the help,
call parse_link_id() first like you did already, and we don't get any
such potential mixups?

johannes

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

* RE: [PATCH v2 3/6] iw: util: support parsing link id
  2025-09-19 10:33   ` Johannes Berg
@ 2025-09-19 12:12     ` Zong-Zhe Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Zong-Zhe Yang @ 2025-09-19 12:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless@vger.kernel.org, raja.mani@oss.qualcomm.com

Johannes Berg <johannes@sipsolutions.net> wrote:
> On Wed, 2025-09-17 at 13:55 +0800, Zong-Zhe Yang wrote:
> > For NL80211_FLAG_MLO_VALID_LINK_ID cases, MLD needs to assign link id,
> > but non-MLD doesn't. Add support of parsing link id where the pattern
> > is as below.
> >
> >       [link-id <LINK ID>]
> >
> > If found, put NL80211_ATTR_MLO_LINK_ID and remove the assignment from
> > the argv range.
> >
> > +     memmove(argv + pos, argv + pos + 2,
> > +             sizeof(*argv) * (*argc - pos - 2));
> 
> Honestly, I don't really like this, it's a bit too magic? What if you have something in there that
> is like
> 
>  ... ssid link-id foo bar
> 
> and then it *meant* the SSID to be "link-id", but with this it now actually fails or so? I don't
> think it's a good idea.

I missed to consider this kind of cases, sorry.

> 
> So I think it should just be parsing it where it is at the beginning, and then for the last patch
> just put it at the beginning in the help, call parse_link_id() first like you did already, and we
> don't get any such potential mixups?
> 

Thanks. I think it works.
I will send v3, which turns to parse link-id field at the beginning of argv.


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

end of thread, other threads:[~2025-09-19 12:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-17  5:55 [PATCH v2 0/6] iw: support EHT and link id for setting bitrate Zong-Zhe Yang
2025-09-17  5:55 ` [PATCH v2 1/6] iw: update nl80211.h Zong-Zhe Yang
2025-09-17  5:55 ` [PATCH v2 2/6] iw: info: extended features print EHT beacon rate Zong-Zhe Yang
2025-09-17  5:55 ` [PATCH v2 3/6] iw: util: support parsing link id Zong-Zhe Yang
2025-09-19 10:33   ` Johannes Berg
2025-09-19 12:12     ` Zong-Zhe Yang
2025-09-17  5:55 ` [PATCH v2 4/6] iw: bitrate: refactor description Zong-Zhe Yang
2025-09-17  5:55 ` [PATCH v2 5/6] iw: bitrate: support EHT rate/gi/ltf Zong-Zhe Yang
2025-09-17  5:55 ` [PATCH v2 6/6] iw: bitrate: support link id Zong-Zhe Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox