blob: 1914814461437486683a0cbe9c3c7b593cf35e53 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From e243763029729ced434bcf7de3c5f7909d481c41 Mon Sep 17 00:00:00 2001
developer42c7a432024-07-12 14:39:29 +08002From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Thu, 30 May 2024 10:17:29 +0800
developer05f3b2b2024-08-19 19:17:34 +08004Subject: [PATCH 09/13] iw: support link id in set bitrates command
developer42c7a432024-07-12 14:39:29 +08005
6Since NL80211_CMD_SET_TX_BITRATE_MASK includes flag
7NL80211_FLAG_MLO_VALID_LINK_ID, nl80211_pre_do_it() will check whether
8nl80211_msg includes LINK_ID. Without this patch, iw set bitrates
9command must failed.
10
11Usage:
12iw dev <intf> set bitrates -l <link_id> [legacy | he-gi-xx ...]
13
developer42c7a432024-07-12 14:39:29 +080014---
15 bitrate.c | 19 +++++++++++++++++--
16 1 file changed, 17 insertions(+), 2 deletions(-)
17
18diff --git a/bitrate.c b/bitrate.c
19index 8714669..f0f81a0 100644
20--- a/bitrate.c
21+++ b/bitrate.c
22@@ -146,7 +146,7 @@ int set_bitrates(struct nl_msg *msg,
23 enum nl80211_attrs attr)
24 {
25 struct nlattr *nl_rates, *nl_band;
26- int i, ret = 0;
27+ int i, ret = 0, index = 0;
28 bool have_legacy_24 = false, have_legacy_5 = false;
29 uint8_t legacy_24[32], legacy_5[32];
30 int n_legacy_24 = 0, n_legacy_5 = 0;
31@@ -190,7 +190,22 @@ int set_bitrates(struct nl_msg *msg,
32 S_HE_LTF,
33 } parser_state = S_NONE;
34
35- for (i = 0; i < argc; i++) {
36+ if (!strcmp(argv[0], "-l")) {
37+ unsigned int link_id;
38+ char *endptr;
39+
40+ link_id = strtol(argv[1], &endptr, 10);
41+ if (*endptr)
42+ return 1;
43+
44+ if (link_id > 15)
45+ return 1;
46+
47+ nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
48+ index = 2;
49+ }
50+
51+ for (i = index; i < argc; i++) {
52 char *end;
53 double tmpd;
54 long tmpl;
55--
562.18.0
57