developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 1 | From f885f9be220545bc3d62c369d68ded69e2711b52 Mon Sep 17 00:00:00 2001 |
| 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Thu, 30 May 2024 10:17:29 +0800 |
| 4 | Subject: [PATCH 07/10] iw: support link id in set bitrates command |
| 5 | |
| 6 | Since NL80211_CMD_SET_TX_BITRATE_MASK includes flag |
| 7 | NL80211_FLAG_MLO_VALID_LINK_ID, nl80211_pre_do_it() will check whether |
| 8 | nl80211_msg includes LINK_ID. Without this patch, iw set bitrates |
| 9 | command must failed. |
| 10 | |
| 11 | Usage: |
| 12 | iw dev <intf> set bitrates -l <link_id> [legacy | he-gi-xx ...] |
| 13 | |
| 14 | CR-Id: WCNCR00261410 |
| 15 | Change-Id: I4984054543f63c9324d9b81a240382023fbc0b0b |
| 16 | --- |
| 17 | bitrate.c | 19 +++++++++++++++++-- |
| 18 | 1 file changed, 17 insertions(+), 2 deletions(-) |
| 19 | |
| 20 | diff --git a/bitrate.c b/bitrate.c |
| 21 | index 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 | -- |
| 58 | 2.18.0 |
| 59 | |