Currently, setting RTS threshold changes the threshold for all radios in a multi-radio wiphy. But different radios in a multi-radio wiphy can have different RTS threshold requirements. Modify the iw command to get radio index from user to operate on per-radio attributes in a multi-radio wiphy. Modify the command such that the legacy userspace will still interact with traditional drivers as well as multi-radio wiphy drivers. Also, print the RTS threshold along with other per-radio attributes for each radio under the section - "Supported wiphy radios" in iw phy#XXX info command. In order to be able to set RTS threshold for a particular radio from user space, without disturbing the other radios in a wiphy, pass the radio index for which RTS threshold needs to be changed as optional pair of arguments, along with its corresponding RTS threshold value. The valid radio index values can be checked in iw phy#XXX info, under "Supported wiphy radios". If radio index is not available, i.e., in case of single radio wiphy, passing radio index is not required. If the radio index is not provided, then the current behavior of setting passed RTS threshold to all radios will be retained. Command Usage: iw phyX set rts <rts threshold|off> [radio <radio index>] Sample output: root@buildroot:~# iw phyXXX info Wiphy phy0 wiphy index: 0 max # scan SSIDs: 16 max scan IEs length: 339 bytes RTS threshold: 536 Retry short limit: 7 Retry long limit: 4 ..... Supported wiphy radios: * Idx 0: RTS Threshold: 536 Frequency Range: 5170 MHz - 5835 MHz ..... * Idx 1: RTS Threshold: 231 Frequency Range: 2312 MHz - 2732 MHz ..... * Idx 2: RTS Threshold: 425 Frequency Range: 5945 MHz - 7125 MHz ..... Globally valid interface combinations: ..... Signed-off-by: Roopni Devanathan <quic_rdevanat@xxxxxxxxxxx> --- v2: - Made changes to adhere to kernel code. - Dropped patch "[PATCH 2/2] iw: Add support to set per-radio Tx power config in multi-radio wiphy" from the series. This has to wait until changes related to tx power are merged. --- info.c | 4 ++++ phy.c | 28 ++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/info.c b/info.c index 986eaa6..18dcd36 100644 --- a/info.c +++ b/info.c @@ -926,6 +926,10 @@ next: if (!have_combinations) printf("\t\t\tRadio level interface combinations are not supported\n"); break; + case NL80211_WIPHY_RADIO_ATTR_RTS_THRESHOLD: + printf("\t\t\tRTS Threshold: %d\n", + nla_get_u32(radio_prop)); + break; default: printf("\t\t\t* <failed to parse>\n"); } diff --git a/phy.c b/phy.c index 584b103..0c7f844 100644 --- a/phy.c +++ b/phy.c @@ -449,15 +449,14 @@ static int handle_rts(struct nl80211_state *state, enum id_input id) { unsigned int rts; + char *end; - if (argc != 1) + if (argc != 1 && argc != 3) return 1; if (strcmp("off", argv[0]) == 0) rts = -1; else { - char *end; - if (!*argv[0]) return 1; rts = strtoul(argv[0], &end, 10); @@ -467,11 +466,32 @@ static int handle_rts(struct nl80211_state *state, NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, rts); + argv++; + argc--; + + if (argc > 1 && strcmp("radio", argv[0]) == 0) { + int radio_idx; + + argv++; + argc--; + + radio_idx = strtoul(argv[0], &end, 10); + if (*end != '\0') + return 1; + + NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RADIO_INDEX, radio_idx); + argv++; + argc--; + } + + if (argc) + return 1; + return 0; nla_put_failure: return -ENOBUFS; } -COMMAND(set, rts, "<rts threshold|off>", +COMMAND(set, rts, "<rts threshold|off> [radio <radio index>]", NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts, "Set rts threshold."); base-commit: 8d52fb4ccc5398a89dd99eba132a7faa3136e1ce -- 2.25.1