developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 1 | From e243763029729ced434bcf7de3c5f7909d481c41 Mon Sep 17 00:00:00 2001 |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 2 | From: Howard Hsu <howard-yh.hsu@mediatek.com> |
| 3 | Date: Thu, 30 May 2024 10:17:29 +0800 |
developer | 05f3b2b | 2024-08-19 19:17:34 +0800 | [diff] [blame] | 4 | Subject: [PATCH 09/13] iw: support link id in set bitrates command |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 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 | |
developer | 42c7a43 | 2024-07-12 14:39:29 +0800 | [diff] [blame] | 14 | --- |
| 15 | bitrate.c | 19 +++++++++++++++++-- |
| 16 | 1 file changed, 17 insertions(+), 2 deletions(-) |
| 17 | |
| 18 | diff --git a/bitrate.c b/bitrate.c |
| 19 | index 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 | -- |
| 56 | 2.18.0 |
| 57 | |