| From f885f9be220545bc3d62c369d68ded69e2711b52 Mon Sep 17 00:00:00 2001 |
| From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| Date: Thu, 30 May 2024 10:17:29 +0800 |
| Subject: [PATCH 07/10] iw: support link id in set bitrates command |
| |
| Since NL80211_CMD_SET_TX_BITRATE_MASK includes flag |
| NL80211_FLAG_MLO_VALID_LINK_ID, nl80211_pre_do_it() will check whether |
| nl80211_msg includes LINK_ID. Without this patch, iw set bitrates |
| command must failed. |
| |
| Usage: |
| iw dev <intf> set bitrates -l <link_id> [legacy | he-gi-xx ...] |
| |
| CR-Id: WCNCR00261410 |
| Change-Id: I4984054543f63c9324d9b81a240382023fbc0b0b |
| --- |
| bitrate.c | 19 +++++++++++++++++-- |
| 1 file changed, 17 insertions(+), 2 deletions(-) |
| |
| diff --git a/bitrate.c b/bitrate.c |
| index 8714669..f0f81a0 100644 |
| --- a/bitrate.c |
| +++ b/bitrate.c |
| @@ -146,7 +146,7 @@ int set_bitrates(struct nl_msg *msg, |
| enum nl80211_attrs attr) |
| { |
| struct nlattr *nl_rates, *nl_band; |
| - int i, ret = 0; |
| + int i, ret = 0, index = 0; |
| bool have_legacy_24 = false, have_legacy_5 = false; |
| uint8_t legacy_24[32], legacy_5[32]; |
| int n_legacy_24 = 0, n_legacy_5 = 0; |
| @@ -190,7 +190,22 @@ int set_bitrates(struct nl_msg *msg, |
| S_HE_LTF, |
| } parser_state = S_NONE; |
| |
| - for (i = 0; i < argc; i++) { |
| + if (!strcmp(argv[0], "-l")) { |
| + unsigned int link_id; |
| + char *endptr; |
| + |
| + link_id = strtol(argv[1], &endptr, 10); |
| + if (*endptr) |
| + return 1; |
| + |
| + if (link_id > 15) |
| + return 1; |
| + |
| + nla_put_u8(msg, NL80211_ATTR_MLO_LINK_ID, link_id); |
| + index = 2; |
| + } |
| + |
| + for (i = index; i < argc; i++) { |
| char *end; |
| double tmpd; |
| long tmpl; |
| -- |
| 2.18.0 |
| |