linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio
@ 2025-02-04  8:49 Roopni Devanathan
  2025-02-04  8:49 ` [PATCH 1/2] iw: Add support to set per-radio RTS threshold in multi-radio wiphy Roopni Devanathan
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Roopni Devanathan @ 2025-02-04  8:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Roopni Devanathan

Currently, setting per-radio attribute like RTS threshold and Tx power,
changes the threshold and power for all radios in a wiphy. But, in a
multi-radio wiphy, different radios can have different attribute value
requirements. Modify the iw command to handle per-radio attributes for
RTS threshold and Tx power.

Rameshkumar Sundaram (1):
  iw: Add support to set per-radio Tx power config in multi-radio wiphy

Roopni Devanathan (1):
  iw: Add support to set per-radio RTS threshold in multi-radio wiphy

 info.c |  4 +++
 phy.c  | 80 ++++++++++++++++++++++++++++++++++++++++++++++++++--------
 2 files changed, 73 insertions(+), 11 deletions(-)


base-commit: a0a7ddef29fc412cee7e3ca027905218b145a40f
-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] iw: Add support to set per-radio RTS threshold in multi-radio wiphy
  2025-02-04  8:49 [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Roopni Devanathan
@ 2025-02-04  8:49 ` Roopni Devanathan
  2025-02-04  8:50 ` [PATCH 2/2] iw: Add support to set per-radio Tx power config " Roopni Devanathan
  2025-07-08 12:42 ` [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Roopni Devanathan @ 2025-02-04  8:49 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Roopni Devanathan

Currently, setting RTS threshold changes the threshold for all radios
in a wiphy. But different radios in a wiphy can have different RTS
threshold requirements. Add a new iw command to handle this. This will
ensure that the legacy userspace will interact with traditional drivers
as well as multi-radio wiphy drivers.

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 id for which RTS threshold needs to be changed and its
corresponding RTS threshold value. The valid radio id values can be
checked in iw phy#XXX info, under "Supported wiphy radios". If the radio
index is not provided, the current behavior of setting passed RTS
threshold to all radios will be retained.

Command Usage:
iw phyXXX [radio_id <radio index>] rts <RTS Threshold value>

Sample output:
root@buildroot:~# iw phyXXX info
Wiphy phy0
        wiphy index: 0
        max # scan SSIDs: 16
        max scan IEs length: 339 bytes
        max # sched scan SSIDs: 0
        max # match sets: 0
        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@quicinc.com>
---
 info.c |  4 ++++
 phy.c  | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/info.c b/info.c
index 986eaa6..cde3d80 100644
--- a/info.c
+++ b/info.c
@@ -905,6 +905,10 @@ next:
 				case NL80211_WIPHY_RADIO_ATTR_INDEX:
 					printf("\t\t* Idx %u:\n", nla_get_u32(radio_prop));
 					break;
+				case NL80211_WIPHY_RADIO_ATTR_RTS_THRESHOLD:
+					printf("\t\t\tRTS Threshold: %d\n",
+					       nla_get_u32(radio_prop));
+					break;
 				case NL80211_WIPHY_RADIO_ATTR_FREQ_RANGE:
 					printf("\t\t\tFrequency Range: ");
 
diff --git a/phy.c b/phy.c
index 584b103..890966d 100644
--- a/phy.c
+++ b/phy.c
@@ -475,6 +475,47 @@ COMMAND(set, rts, "<rts threshold|off>",
 	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_rts,
 	"Set rts threshold.");
 
+static int handle_wiphy_params(struct nl80211_state *state,
+			       struct nl_msg *msg,
+			       int argc, char **argv,
+			       enum id_input id)
+{
+	unsigned int rts = -1, radio_idx = NL80211_WIPHY_RADIO_ID_MAX;
+	int argidx = 0;
+	char *end;
+
+	if (argc < 2)
+		return 1;
+
+	if (!strcmp("radio", argv[argidx])) {
+		radio_idx = strtoul(argv[argidx + 1], &end, 10);
+		if (*end != '\0')
+			return 1;
+
+		argidx = argidx + 2;
+	}
+
+	NLA_PUT_U8(msg, NL80211_ATTR_WIPHY_RADIO_INDEX, radio_idx);
+
+	if (!strcmp("rts", argv[argidx]) && (strcmp("off", argv[argidx + 1])))
+		rts = strtoul(argv[argidx + 1], &end, 10);
+	else
+		rts = -1;
+
+	if (*end != '\0')
+		return 1;
+
+	NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, rts);
+
+	return 0;
+nla_put_failure:
+	return 1;
+}
+
+COMMAND(set, wiphy, "[radio <idx>] rts <rts_threshold value>",
+	NL80211_CMD_SET_WIPHY, 0, CIB_PHY, handle_wiphy_params,
+	"Set per-radio wiphy parameters");
+
 static int handle_retry(struct nl80211_state *state,
 			struct nl_msg *msg,
 			int argc, char **argv, enum id_input id)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] iw: Add support to set per-radio Tx power config in multi-radio wiphy
  2025-02-04  8:49 [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Roopni Devanathan
  2025-02-04  8:49 ` [PATCH 1/2] iw: Add support to set per-radio RTS threshold in multi-radio wiphy Roopni Devanathan
@ 2025-02-04  8:50 ` Roopni Devanathan
  2025-07-08 12:42 ` [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Johannes Berg
  2 siblings, 0 replies; 5+ messages in thread
From: Roopni Devanathan @ 2025-02-04  8:50 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Rameshkumar Sundaram, Roopni Devanathan

From: Rameshkumar Sundaram <quic_ramess@quicinc.com>

Currently, setting transmit power changes the transmit power for all radios
in a wiphy. But different radios in a wiphy can have different transmit
power requirements. Modify the iw command to handle this. This will
ensure that the legacy userspace will interact with traditional drivers
as well as multi-radio wiphy drivers.

In order to be able to set transmit power for a particular radio from
user space, without disturbing the other radios in a wiphy, pass the
radio id for which the transmit power needs to be changed and its
transmit power value. The valid radio id values can be checked in
iw phy#XXX info, under "Supported wiphy radios".

Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
---
 phy.c | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/phy.c b/phy.c
index 890966d..bd7194d 100644
--- a/phy.c
+++ b/phy.c
@@ -727,20 +727,37 @@ static int handle_txpower(struct nl80211_state *state,
 			  enum id_input id)
 {
 	enum nl80211_tx_power_setting type;
-	int mbm;
+	int mbm, i = 0;
 
 	/* get the required args */
-	if (argc != 1 && argc != 2)
+	if (argc > 4)
 		return 1;
 
-	if (!strcmp(argv[0], "auto"))
+	/* check if radio idx is provided */
+	if (argc >= 2 && !strcmp(argv[0], "radio")) {
+		unsigned int radio_id;
+		char *endptr;
+
+		radio_id = strtoul(argv[1], &endptr, 10);
+		if (*endptr)
+			return 1;
+
+		NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_RADIO_INDEX, radio_id);
+		i = 2;
+	}
+
+	/* check the required args without radio id */
+	if ((argc - i) != 1 && (argc - i) != 2)
+		return 1;
+
+	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]);
+	} else {
+		printf("Invalid parameter: %s\n", argv[i]);
 		return 2;
 	}
 
@@ -748,16 +765,16 @@ static int handle_txpower(struct nl80211_state *state,
 
 	if (type != NL80211_TX_POWER_AUTOMATIC) {
 		char *endptr;
-		if (argc != 2) {
+		if ((argc - i) != 2) {
 			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 - i) != 1)
 		return 1;
 
 	return 0;
@@ -765,7 +782,7 @@ static int handle_txpower(struct nl80211_state *state,
  nla_put_failure:
 	return -ENOBUFS;
 }
-COMMAND(set, txpower, "<auto|fixed|limit> [<tx power in mBm>]",
+COMMAND(set, txpower, "[radio <radio idx>] <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>]",
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio
  2025-02-04  8:49 [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Roopni Devanathan
  2025-02-04  8:49 ` [PATCH 1/2] iw: Add support to set per-radio RTS threshold in multi-radio wiphy Roopni Devanathan
  2025-02-04  8:50 ` [PATCH 2/2] iw: Add support to set per-radio Tx power config " Roopni Devanathan
@ 2025-07-08 12:42 ` Johannes Berg
  2025-07-09 17:31   ` Roopni Devanathan
  2 siblings, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2025-07-08 12:42 UTC (permalink / raw)
  To: Roopni Devanathan; +Cc: linux-wireless

On Tue, 2025-02-04 at 14:19 +0530, Roopni Devanathan wrote:
> Currently, setting per-radio attribute like RTS threshold and Tx power,
> changes the threshold and power for all radios in a wiphy. But, in a
> multi-radio wiphy, different radios can have different attribute value
> requirements. Modify the iw command to handle per-radio attributes for
> RTS threshold and Tx power.
> 
> Rameshkumar Sundaram (1):
>   iw: Add support to set per-radio Tx power config in multi-radio wiphy
> 
> Roopni Devanathan (1):
>   iw: Add support to set per-radio RTS threshold in multi-radio wiphy

I'd kept these around for when the kernel changes land, but I don't
think they can build now, and I think anyway they cannot because of
NL80211_WIPHY_RADIO_ID_MAX.

Please resend an appropriate version when needed.

johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio
  2025-07-08 12:42 ` [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Johannes Berg
@ 2025-07-09 17:31   ` Roopni Devanathan
  0 siblings, 0 replies; 5+ messages in thread
From: Roopni Devanathan @ 2025-07-09 17:31 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless



On 7/8/2025 6:12 PM, Johannes Berg wrote:
> On Tue, 2025-02-04 at 14:19 +0530, Roopni Devanathan wrote:
>> Currently, setting per-radio attribute like RTS threshold and Tx power,
>> changes the threshold and power for all radios in a wiphy. But, in a
>> multi-radio wiphy, different radios can have different attribute value
>> requirements. Modify the iw command to handle per-radio attributes for
>> RTS threshold and Tx power.
>>
>> Rameshkumar Sundaram (1):
>>   iw: Add support to set per-radio Tx power config in multi-radio wiphy
>>
>> Roopni Devanathan (1):
>>   iw: Add support to set per-radio RTS threshold in multi-radio wiphy
> 
> I'd kept these around for when the kernel changes land, but I don't
> think they can build now, and I think anyway they cannot because of
> NL80211_WIPHY_RADIO_ID_MAX.
> 
> Please resend an appropriate version when needed.
> 
I am working on this now. Will send a v2 shortly. Thanks!

> johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-09 17:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-04  8:49 [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Roopni Devanathan
2025-02-04  8:49 ` [PATCH 1/2] iw: Add support to set per-radio RTS threshold in multi-radio wiphy Roopni Devanathan
2025-02-04  8:50 ` [PATCH 2/2] iw: Add support to set per-radio Tx power config " Roopni Devanathan
2025-07-08 12:42 ` [PATCH 0/2] iw: Add Support to Set per-radio attributes for each Radio Johannes Berg
2025-07-09 17:31   ` Roopni Devanathan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).