blob: 8d0e0a0910d1cf85c3246ebed7e81492c4a584c9 [file] [log] [blame]
developer42c7a432024-07-12 14:39:29 +08001From f885f9be220545bc3d62c369d68ded69e2711b52 Mon Sep 17 00:00:00 2001
2From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Thu, 30 May 2024 10:17:29 +0800
4Subject: [PATCH 07/10] iw: support link id in set bitrates command
5
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
14CR-Id: WCNCR00261410
15Change-Id: I4984054543f63c9324d9b81a240382023fbc0b0b
16---
17 bitrate.c | 19 +++++++++++++++++--
18 1 file changed, 17 insertions(+), 2 deletions(-)
19
20diff --git a/bitrate.c b/bitrate.c
21index 8714669..f0f81a0 100644
22--- a/bitrate.c
23+++ b/bitrate.c
24@@ -146,7 +146,7 @@ int set_bitrates(struct nl_msg *msg,
25 enum nl80211_attrs attr)
26 {
27 struct nlattr *nl_rates, *nl_band;
28- int i, ret = 0;
29+ int i, ret = 0, index = 0;
30 bool have_legacy_24 = false, have_legacy_5 = false;
31 uint8_t legacy_24[32], legacy_5[32];
32 int n_legacy_24 = 0, n_legacy_5 = 0;
33@@ -190,7 +190,22 @@ int set_bitrates(struct nl_msg *msg,
34 S_HE_LTF,
35 } parser_state = S_NONE;
36
37- for (i = 0; i < argc; i++) {
38+ if (!strcmp(argv[0], "-l")) {
39+ unsigned int link_id;
40+ char *endptr;
41+
42+ link_id = strtol(argv[1], &endptr, 10);
43+ if (*endptr)
44+ return 1;
45+
46+ if (link_id > 15)
47+ return 1;
48+
49+ nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id);
50+ index = 2;
51+ }
52+
53+ for (i = index; i < argc; i++) {
54 char *end;
55 double tmpd;
56 long tmpl;
57--
582.18.0
59