wlan-ap-Telecominfraproject/feeds/qca/iw/patches/609-04-iw-add-support-set-txpower-command-for-each-link.patch
John Crispin 008ca9618d
Some checks failed
Build OpenWrt/uCentral images / build (cig_wf186h) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf186w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf188n) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf189) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cig_wf196) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-a1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (cybertan_eww631-b1) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap102) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap104) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap105) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap111) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_eap112) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (edgecore_oap101e-6e) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_3) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4x_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xe) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi) (push) Has been cancelled
Build OpenWrt/uCentral images / build (hfcl_ion4xi_w) (push) Has been cancelled
Build OpenWrt/uCentral images / build (indio_um-305ax) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sercomm_ap72tip) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630c-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-211g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (sonicfi_rap630w-311g) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-id2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (udaya_a6-od2) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr5018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018) (push) Has been cancelled
Build OpenWrt/uCentral images / build (wallys_dr6018-v4) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax820) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_ax840) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap640) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap650) (push) Has been cancelled
Build OpenWrt/uCentral images / build (yuncore_fap655) (push) Has been cancelled
Build OpenWrt/uCentral images / trigger-testing (push) Has been cancelled
Build OpenWrt/uCentral images / create-x64_vm-ami (push) Has been cancelled
ipq95xx: import ath12.4-cs kernel and drivers
Signed-off-by: John Crispin <john@phrozen.org>
2024-10-20 09:25:13 +02:00

98 lines
2.7 KiB
Diff

From ae070708333cb4a08fde17590523d2adff401852 Mon Sep 17 00:00:00 2001
From: Aaradhana Sahu <quic_aarasahu@quicinc.com>
Date: Tue, 17 Jan 2023 11:44:47 +0530
Subject: [PATCH] iw: add support set txpower command for each link
Add support for set tx power by link id in multi-link operation.
Command:
iw wlan0 set txpower -l <link id> <auto|fixed|limit> [<tx power in mBm>]
Signed-off-by: Aaradhana Sahu <quic_aarasahu@quicinc.com>
---
phy.c | 43 +++++++++++++++++++++++++++++++++----------
1 files changed, 34 insertions(+), 10 deletions(-)
--- a/phy.c
+++ b/phy.c
@@ -666,20 +666,43 @@ static int handle_txpower(struct nl80211
enum id_input id)
{
enum nl80211_tx_power_setting type;
- int mbm;
+ int mbm, i, max_argc;
/* get the required args */
- if (argc != 1 && argc != 2)
- return 1;
+ if (argc == 3 || argc == 4) {
+ max_argc = 4;
- if (!strcmp(argv[0], "auto"))
+ 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 <= MAX_MLD_LINK) {
+ NLA_PUT_U8(msg, NL80211_ATTR_MLO_LINK_ID,
+ link_id);
+ i = 2;
+ }
+ } else {
+ printf("Invalid parameter: %s\n", argv[0]);
+ return 1;
+ }
+ } else {
+ if (argc != 1 && argc != 2)
+ return 1;
+ max_argc = 2;
+ i = 0;
+ }
+
+ if (!strcmp(argv[i], "auto"))
type = NL80211_TX_POWER_AUTOMATIC;
- else if (!strcmp(argv[0], "fixed"))
+ else if (!strcmp(argv[i], "fixed"))
type = NL80211_TX_POWER_FIXED;
- else if (!strcmp(argv[0], "limit"))
+ else if (!strcmp(argv[i], "limit"))
type = NL80211_TX_POWER_LIMITED;
else {
- printf("Invalid parameter: %s\n", argv[0]);
+ printf("Invalid parameter: %s\n", argv[i]);
return 2;
}
@@ -687,16 +710,16 @@ static int handle_txpower(struct nl80211
if (type != NL80211_TX_POWER_AUTOMATIC) {
char *endptr;
- if (argc != 2) {
+ if (argc != max_argc) {
printf("Missing TX power level argument.\n");
return 2;
}
- mbm = strtol(argv[1], &endptr, 10);
+ mbm = strtol(argv[++i], &endptr, 10);
if (*endptr)
return 2;
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, mbm);
- } else if (argc != 1)
+ } else if (argc != max_argc-1)
return 1;
return 0;
@@ -707,7 +730,7 @@ static int handle_txpower(struct nl80211
COMMAND(set, txpower, "<auto|fixed|limit> [<tx power in mBm>]",
NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_txpower,
"Specify transmit power level and setting type.");
-COMMAND(set, txpower, "<auto|fixed|limit> [<tx power in mBm>]",
+COMMAND(set, txpower, "[-l] <link id> <auto|fixed|limit> [<tx power in mBm>]",
NL80211_CMD_SET_WIPHY, 0, CIB_NETDEV, handle_txpower,
"Specify transmit power level and setting type.");