diff mbox series

[wireless-next,v9,3/3] wifi: mac80211: Set RTS threshold on per-radio basis

Message ID 20250429040048.3356960-4-quic_rdevanat@quicinc.com
State Superseded
Headers show
Series wifi: cfg80211/mac80211: Set/get wiphy parameters on per-radio basis | expand

Commit Message

Roopni Devanathan April 29, 2025, 4 a.m. UTC
Add support to get the radio for which RTS threshold needs to be changed
from userspace. Pass on this radio index to underlying drivers as an
additional argument.

A value of NL80211_WIPHY_RADIO_ID_INVALID(-1) indicates radio index is not
mentioned and the configuration applies to all radio(s) of the wiphy.

Signed-off-by: Roopni Devanathan <quic_rdevanat@quicinc.com>
---
 drivers/net/wireless/ath/ar5523/ar5523.c      |  3 ++-
 drivers/net/wireless/ath/ath10k/mac.c         |  5 ++--
 drivers/net/wireless/ath/ath11k/mac.c         |  3 ++-
 drivers/net/wireless/ath/ath12k/mac.c         |  3 ++-
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |  3 ++-
 drivers/net/wireless/ath/wcn36xx/main.c       |  3 ++-
 .../net/wireless/intel/iwlwifi/mld/mac80211.c |  3 ++-
 .../net/wireless/intel/iwlwifi/mvm/mac80211.c |  3 ++-
 drivers/net/wireless/intel/iwlwifi/mvm/mvm.h  |  3 ++-
 drivers/net/wireless/marvell/mwl8k.c          |  3 ++-
 .../net/wireless/mediatek/mt76/mt7615/main.c  |  3 ++-
 drivers/net/wireless/mediatek/mt76/mt76x02.h  |  2 +-
 .../net/wireless/mediatek/mt76/mt76x02_util.c |  2 +-
 .../net/wireless/mediatek/mt76/mt7915/main.c  |  3 ++-
 .../net/wireless/mediatek/mt76/mt7921/main.c  |  3 ++-
 .../net/wireless/mediatek/mt76/mt7925/main.c  |  3 ++-
 .../net/wireless/mediatek/mt76/mt7996/main.c  |  3 ++-
 drivers/net/wireless/mediatek/mt7601u/main.c  |  3 ++-
 drivers/net/wireless/purelifi/plfxlc/mac.c    |  3 ++-
 .../net/wireless/ralink/rt2x00/rt2800lib.c    |  2 +-
 .../net/wireless/ralink/rt2x00/rt2800lib.h    |  2 +-
 drivers/net/wireless/realtek/rtl8xxxu/core.c  |  3 ++-
 drivers/net/wireless/realtek/rtw88/mac80211.c |  3 ++-
 drivers/net/wireless/realtek/rtw89/mac80211.c |  3 ++-
 drivers/net/wireless/rsi/rsi_91x_mac80211.c   |  2 ++
 drivers/net/wireless/silabs/wfx/sta.c         |  2 +-
 drivers/net/wireless/silabs/wfx/sta.h         |  2 +-
 drivers/net/wireless/st/cw1200/sta.c          |  2 +-
 drivers/net/wireless/st/cw1200/sta.h          |  2 +-
 drivers/net/wireless/ti/wl1251/main.c         |  3 ++-
 drivers/net/wireless/ti/wlcore/main.c         |  3 ++-
 drivers/net/wireless/virtual/mac80211_hwsim.c |  4 +++-
 include/net/mac80211.h                        |  3 ++-
 net/mac80211/cfg.c                            |  9 ++++++-
 net/mac80211/driver-ops.h                     |  7 +++---
 net/mac80211/trace.h                          | 24 ++++++++++++++++---
 net/mac80211/util.c                           |  8 ++++++-
 37 files changed, 100 insertions(+), 41 deletions(-)

Comments

Johannes Berg May 21, 2025, 7:19 a.m. UTC | #1
On Tue, 2025-04-29 at 09:30 +0530, Roopni Devanathan wrote:

> +++ b/include/net/mac80211.h
> @@ -4569,7 +4569,8 @@ struct ieee80211_ops {
>  			    struct ieee80211_key_conf *key,
>  			    struct ieee80211_key_seq *seq);
>  	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
> -	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
> +	int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id,
> +				 u32 value);

That should probably have documentation updates. And passing a negative
value to a u8 seems awkward? Maybe that should just be 'int'? For a
value that's likely passed in a register, u8 will probably require more
(machine) code anyway.

johannes
Roopni Devanathan May 21, 2025, 9 a.m. UTC | #2
On 5/21/2025 12:49 PM, Johannes Berg wrote:
> On Tue, 2025-04-29 at 09:30 +0530, Roopni Devanathan wrote:
> 
>> +++ b/include/net/mac80211.h
>> @@ -4569,7 +4569,8 @@ struct ieee80211_ops {
>>  			    struct ieee80211_key_conf *key,
>>  			    struct ieee80211_key_seq *seq);
>>  	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
>> -	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
>> +	int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id,
>> +				 u32 value);
> 
> That should probably have documentation updates. And passing a negative
> value to a u8 seems awkward? Maybe that should just be 'int'? For a
> value that's likely passed in a register, u8 will probably require more
> (machine) code anyway.
> 
The following snippet of code tests the value of radio_id in
nl80211_set_wiphy() in net/wireless/nl80211.c:
+		/* Radio idx is not expected for non-multi radio wiphy */
+		if (rdev->wiphy.n_radio <= 0)
+			return -EINVAL;

This snippet returns an error if the radio_id is negative, so radio_id
passed to set_rts_threshold() will always be positive. So can we retain
u8 data type for radio_id?

I'll add documentation update in next version of patch series.

> johannes
Johannes Berg May 21, 2025, 9:02 a.m. UTC | #3
On Wed, 2025-05-21 at 14:30 +0530, Roopni Devanathan wrote:
> 
> On 5/21/2025 12:49 PM, Johannes Berg wrote:
> > On Tue, 2025-04-29 at 09:30 +0530, Roopni Devanathan wrote:
> > 
> > > +++ b/include/net/mac80211.h
> > > @@ -4569,7 +4569,8 @@ struct ieee80211_ops {
> > >  			    struct ieee80211_key_conf *key,
> > >  			    struct ieee80211_key_seq *seq);
> > >  	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
> > > -	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
> > > +	int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id,
> > > +				 u32 value);
> > 
> > That should probably have documentation updates. And passing a negative
> > value to a u8 seems awkward? Maybe that should just be 'int'? For a
> > value that's likely passed in a register, u8 will probably require more
> > (machine) code anyway.
> > 
> The following snippet of code tests the value of radio_id in
> nl80211_set_wiphy() in net/wireless/nl80211.c:
> +		/* Radio idx is not expected for non-multi radio wiphy */
> +		if (rdev->wiphy.n_radio <= 0)
> +			return -EINVAL;
> 
> This snippet returns an error if the radio_id is negative, so radio_id
> passed to set_rts_threshold() will always be positive. So can we retain
> u8 data type for radio_id?

I quote from the commit message:

> A value of NL80211_WIPHY_RADIO_ID_INVALID(-1) indicates radio index is not
> mentioned and the configuration applies to all radio(s) of the wiphy.

So now something is at least _very_ confusing.

johannes
Roopni Devanathan May 21, 2025, 9:09 a.m. UTC | #4
On 5/21/2025 2:32 PM, Johannes Berg wrote:
> On Wed, 2025-05-21 at 14:30 +0530, Roopni Devanathan wrote:
>>
>> On 5/21/2025 12:49 PM, Johannes Berg wrote:
>>> On Tue, 2025-04-29 at 09:30 +0530, Roopni Devanathan wrote:
>>>
>>>> +++ b/include/net/mac80211.h
>>>> @@ -4569,7 +4569,8 @@ struct ieee80211_ops {
>>>>  			    struct ieee80211_key_conf *key,
>>>>  			    struct ieee80211_key_seq *seq);
>>>>  	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
>>>> -	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
>>>> +	int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id,
>>>> +				 u32 value);
>>>
>>> That should probably have documentation updates. And passing a negative
>>> value to a u8 seems awkward? Maybe that should just be 'int'? For a
>>> value that's likely passed in a register, u8 will probably require more
>>> (machine) code anyway.
>>>
>> The following snippet of code tests the value of radio_id in
>> nl80211_set_wiphy() in net/wireless/nl80211.c:
>> +		/* Radio idx is not expected for non-multi radio wiphy */
>> +		if (rdev->wiphy.n_radio <= 0)
>> +			return -EINVAL;
>>
>> This snippet returns an error if the radio_id is negative, so radio_id
>> passed to set_rts_threshold() will always be positive. So can we retain
>> u8 data type for radio_id?
> 
> I quote from the commit message:
> 
>> A value of NL80211_WIPHY_RADIO_ID_INVALID(-1) indicates radio index is not
>> mentioned and the configuration applies to all radio(s) of the wiphy.
> 
> So now something is at least _very_ confusing.
> 
I can rewrite the code to something like this:
 - Change the data type of radio_id to int.
 - NL80211_WIPHY_RADIO_ID_INVALID value assigned a -1.
 - Set RTS threshold for all radios when radio_id is -1.

Is this okay?

> johannes
Johannes Berg May 21, 2025, 9:10 a.m. UTC | #5
> > > > 
> > > The following snippet of code tests the value of radio_id in
> > > nl80211_set_wiphy() in net/wireless/nl80211.c:
> > > +		/* Radio idx is not expected for non-multi radio wiphy */
> > > +		if (rdev->wiphy.n_radio <= 0)
> > > +			return -EINVAL;
> > > 
> > > This snippet returns an error if the radio_id is negative, so radio_id
> > > passed to set_rts_threshold() will always be positive. So can we retain
> > > u8 data type for radio_id?
> > 
> > I quote from the commit message:
> > 
> > > A value of NL80211_WIPHY_RADIO_ID_INVALID(-1) indicates radio index is not
> > > mentioned and the configuration applies to all radio(s) of the wiphy.
> > 
> > So now something is at least _very_ confusing.
> > 
> I can rewrite the code to something like this:
>  - Change the data type of radio_id to int.
>  - NL80211_WIPHY_RADIO_ID_INVALID value assigned a -1.
>  - Set RTS threshold for all radios when radio_id is -1.
> 
> Is this okay?

I honestly thought the last two items were already the case?

johannes
Roopni Devanathan May 21, 2025, 9:17 a.m. UTC | #6
On 5/21/2025 2:40 PM, Johannes Berg wrote:
>>>>>
>>>> The following snippet of code tests the value of radio_id in
>>>> nl80211_set_wiphy() in net/wireless/nl80211.c:
>>>> +		/* Radio idx is not expected for non-multi radio wiphy */
>>>> +		if (rdev->wiphy.n_radio <= 0)
>>>> +			return -EINVAL;
>>>>
>>>> This snippet returns an error if the radio_id is negative, so radio_id
>>>> passed to set_rts_threshold() will always be positive. So can we retain
>>>> u8 data type for radio_id?
>>>
>>> I quote from the commit message:
>>>
>>>> A value of NL80211_WIPHY_RADIO_ID_INVALID(-1) indicates radio index is not
>>>> mentioned and the configuration applies to all radio(s) of the wiphy.
>>>
>>> So now something is at least _very_ confusing.
>>>
>> I can rewrite the code to something like this:
>>  - Change the data type of radio_id to int.
>>  - NL80211_WIPHY_RADIO_ID_INVALID value assigned a -1.
>>  - Set RTS threshold for all radios when radio_id is -1.
>>
>> Is this okay?
> 
> I honestly thought the last two items were already the case?
> 
Yes those were the case. The history goes back to v6 of the patch series.
Quoting your comment:
"And why should the attribute even be signed, when you explicitly reject
negative values anyway? Seems like it should simply be unsigned?"

So I came under the impression that it would be better to change the radio_id
datatype to u8, instead. Now with this, (u8)-1 would give 255 and when driver
changes come in, I was planning on checking if 
	radio_id >= wiphy->n_radios
If this condition returns true, I was planning on setting RTS threshold to all
radios in the wiphy.

> johannes
Johannes Berg May 21, 2025, 9:20 a.m. UTC | #7
On Wed, 2025-05-21 at 14:47 +0530, Roopni Devanathan wrote:
> > 
> Yes those were the case. The history goes back to v6 of the patch series.
> Quoting your comment:
> "And why should the attribute even be signed, when you explicitly reject
> negative values anyway? Seems like it should simply be unsigned?"

Well that was regarding the _attribute_, you had that as NLA_S8 at that
point.

> So I came under the impression that it would be better to change the radio_id
> datatype to u8, instead.

Oh, well, I didn't really mean to give that impression.

In the userspace API we have an attribute that can be in [0, n_radios-1]
or unspecified if no specific radio is intended, which is how it'll work
with existing userspace anyway.

In the internal APIs, using -1 with a properly signed value seems
better, since we don't have the option of "not specifying" an integer.

> Now with this, (u8)-1 would give 255 and when driver
> changes come in, I was planning on checking if 
> 	radio_id >= wiphy->n_radios
> If this condition returns true, I was planning on setting RTS threshold to all
> radios in the wiphy.

That seems pretty odd, -1 for an invalid value is much easier to handle?

johannes
Roopni Devanathan May 21, 2025, 9:25 a.m. UTC | #8
On 5/21/2025 2:50 PM, Johannes Berg wrote:
> On Wed, 2025-05-21 at 14:47 +0530, Roopni Devanathan wrote:
>>>
>> Yes those were the case. The history goes back to v6 of the patch series.
>> Quoting your comment:
>> "And why should the attribute even be signed, when you explicitly reject
>> negative values anyway? Seems like it should simply be unsigned?"
> 
> Well that was regarding the _attribute_, you had that as NLA_S8 at that
> point.
> 
>> So I came under the impression that it would be better to change the radio_id
>> datatype to u8, instead.
> 
> Oh, well, I didn't really mean to give that impression.
> 
> In the userspace API we have an attribute that can be in [0, n_radios-1]
> or unspecified if no specific radio is intended, which is how it'll work
> with existing userspace anyway.
> 
> In the internal APIs, using -1 with a properly signed value seems
> better, since we don't have the option of "not specifying" an integer.
> 
Now, I get your picture, thanks for explaining.

>> Now with this, (u8)-1 would give 255 and when driver
>> changes come in, I was planning on checking if 
>> 	radio_id >= wiphy->n_radios
>> If this condition returns true, I was planning on setting RTS threshold to all
>> radios in the wiphy.
> 
> That seems pretty odd, -1 for an invalid value is much easier to handle?
>
I think so, too. As mentioned already, I can change the datatype of radio_id to
int, retain the NL80211_WIPHY_RADIO_ID_INVALID value at -1. This would mean that
passing default value to individual drivers will set RTS threshold to all the radios
in a wiphy, or it will be the case of single wiphy architecture.

I hope this change will be sound and standing?
 
> johannes
Johannes Berg May 21, 2025, 9:26 a.m. UTC | #9
On Wed, 2025-05-21 at 14:55 +0530, Roopni Devanathan wrote:
> 
> I think so, too. As mentioned already, I can change the datatype of radio_id to
> int, retain the NL80211_WIPHY_RADIO_ID_INVALID value at -1. This would mean that
> passing default value to individual drivers will set RTS threshold to all the radios
> in a wiphy, or it will be the case of single wiphy architecture.
> 
> I hope this change will be sound and standing?

Right, that sounds good. Except it still shouldn't be
NL80211_WIPHY_RADIO_ID_INVALID since negative values are not part of the
nl80211 API :)

johannes
Roopni Devanathan May 21, 2025, 9:28 a.m. UTC | #10
On 5/21/2025 2:56 PM, Johannes Berg wrote:
> On Wed, 2025-05-21 at 14:55 +0530, Roopni Devanathan wrote:
>>
>> I think so, too. As mentioned already, I can change the datatype of radio_id to
>> int, retain the NL80211_WIPHY_RADIO_ID_INVALID value at -1. This would mean that
>> passing default value to individual drivers will set RTS threshold to all the radios
>> in a wiphy, or it will be the case of single wiphy architecture.
>>
>> I hope this change will be sound and standing?
> 
> Right, that sounds good. Except it still shouldn't be
> NL80211_WIPHY_RADIO_ID_INVALID since negative values are not part of the
> nl80211 API :)
> 
So, why not, we give a value of 255 to NL80211_WIPHY_RADIO_ID_DEFAULT? Then, we can
retain u8 datatype of radio_id.

> johannes
Johannes Berg May 21, 2025, 9:30 a.m. UTC | #11
On Wed, 2025-05-21 at 14:58 +0530, Roopni Devanathan wrote:
> 
> On 5/21/2025 2:56 PM, Johannes Berg wrote:
> > On Wed, 2025-05-21 at 14:55 +0530, Roopni Devanathan wrote:
> > > 
> > > I think so, too. As mentioned already, I can change the datatype of radio_id to
> > > int, retain the NL80211_WIPHY_RADIO_ID_INVALID value at -1. This would mean that
> > > passing default value to individual drivers will set RTS threshold to all the radios
> > > in a wiphy, or it will be the case of single wiphy architecture.
> > > 
> > > I hope this change will be sound and standing?
> > 
> > Right, that sounds good. Except it still shouldn't be
> > NL80211_WIPHY_RADIO_ID_INVALID since negative values are not part of the
> > nl80211 API :)
> > 
> So, why not, we give a value of 255 to NL80211_WIPHY_RADIO_ID_DEFAULT? Then, we can
> retain u8 datatype of radio_id.

The internal "all radios" (and otherwise invalid) value is _never_ part
of the API. Quoting myself:

> In the userspace API we have an attribute that can be in [0, n_radios-1]
> or unspecified if no specific radio is intended, which is how it'll work
> with existing userspace anyway.

So no, regardless of the value (and I still think -1 is better), this
define simply doesn't belong to the nl80211 API.

johannes
Roopni Devanathan May 21, 2025, 9:33 a.m. UTC | #12
On 5/21/2025 3:00 PM, Johannes Berg wrote:
> On Wed, 2025-05-21 at 14:58 +0530, Roopni Devanathan wrote:
>>
>> On 5/21/2025 2:56 PM, Johannes Berg wrote:
>>> On Wed, 2025-05-21 at 14:55 +0530, Roopni Devanathan wrote:
>>>>
>>>> I think so, too. As mentioned already, I can change the datatype of radio_id to
>>>> int, retain the NL80211_WIPHY_RADIO_ID_INVALID value at -1. This would mean that
>>>> passing default value to individual drivers will set RTS threshold to all the radios
>>>> in a wiphy, or it will be the case of single wiphy architecture.
>>>>
>>>> I hope this change will be sound and standing?
>>>
>>> Right, that sounds good. Except it still shouldn't be
>>> NL80211_WIPHY_RADIO_ID_INVALID since negative values are not part of the
>>> nl80211 API :)
>>>
>> So, why not, we give a value of 255 to NL80211_WIPHY_RADIO_ID_DEFAULT? Then, we can
>> retain u8 datatype of radio_id.
> 
> The internal "all radios" (and otherwise invalid) value is _never_ part
> of the API. Quoting myself:
> 
>> In the userspace API we have an attribute that can be in [0, n_radios-1]
>> or unspecified if no specific radio is intended, which is how it'll work
>> with existing userspace anyway.
> 
> So no, regardless of the value (and I still think -1 is better), this
> define simply doesn't belong to the nl80211 API.
> 
I am not sure where to define NL80211_WIPHY_RADIO_ID_DEFAULT other than in nl80211.
Can you point out to your expectation?

> johannes
Johannes Berg May 21, 2025, 9:52 a.m. UTC | #13
On Wed, 2025-05-21 at 15:03 +0530, Roopni Devanathan wrote:
> > 
> > The internal "all radios" (and otherwise invalid) value is _never_ part
> > of the API. Quoting myself:
> > 
> > > In the userspace API we have an attribute that can be in [0, n_radios-1]
> > > or unspecified if no specific radio is intended, which is how it'll work
> > > with existing userspace anyway.
> > 
> > So no, regardless of the value (and I still think -1 is better), this
> > define simply doesn't belong to the nl80211 API.
> > 
> I am not sure where to define NL80211_WIPHY_RADIO_ID_DEFAULT other than in nl80211.
> Can you point out to your expectation?

There are different APIs involved, right? Externally, nl80211, which
doesn't know about this. Internally, cfg80211 and mac80211, though it
stands to reason that since they're necessarily layered, mac80211 API
can (and does) use cfg80211 definitions a lot - but of course not the
other way around.

I'm not even sure we really _need_ such a define, we probably have a lot
of places that just hardcode -1 (e.g. invalid link), but if you want
one, given the above, it would live in cfg80211, right?

johannes
Roopni Devanathan May 21, 2025, 9:57 a.m. UTC | #14
On 5/21/2025 3:22 PM, Johannes Berg wrote:
> On Wed, 2025-05-21 at 15:03 +0530, Roopni Devanathan wrote:
>>>
>>> The internal "all radios" (and otherwise invalid) value is _never_ part
>>> of the API. Quoting myself:
>>>
>>>> In the userspace API we have an attribute that can be in [0, n_radios-1]
>>>> or unspecified if no specific radio is intended, which is how it'll work
>>>> with existing userspace anyway.
>>>
>>> So no, regardless of the value (and I still think -1 is better), this
>>> define simply doesn't belong to the nl80211 API.
>>>
>> I am not sure where to define NL80211_WIPHY_RADIO_ID_DEFAULT other than in nl80211.
>> Can you point out to your expectation?
> 
> There are different APIs involved, right? Externally, nl80211, which
> doesn't know about this. Internally, cfg80211 and mac80211, though it
> stands to reason that since they're necessarily layered, mac80211 API
> can (and does) use cfg80211 definitions a lot - but of course not the
> other way around.
> 
> I'm not even sure we really _need_ such a define, we probably have a lot
> of places that just hardcode -1 (e.g. invalid link), but if you want
> one, given the above, it would live in cfg80211, right?
> 
Okay, understood. If I can directly assign -1 as default value to radio_id,
then I can cut down this definition entirely. I can re-write radio_id
declaration in nl80211_set_wiphy() as:
	s8 radio_id = -1;
instead of 
	u8 radio_id = NL80211_WIPHY_RADIO_ID_DEFAULT;

This will solve the whole problem. Is that alright?

> johannes
Johannes Berg May 21, 2025, 9:58 a.m. UTC | #15
On Wed, 2025-05-21 at 15:27 +0530, Roopni Devanathan wrote:
> > 
> Okay, understood. If I can directly assign -1 as default value to radio_id,
> then I can cut down this definition entirely. I can re-write radio_id
> declaration in nl80211_set_wiphy() as:
> 	s8 radio_id = -1;
> instead of 
> 	u8 radio_id = NL80211_WIPHY_RADIO_ID_DEFAULT;
> 
> This will solve the whole problem. Is that alright?

Seems fine, there's probably only one place anyway that does this.

If there are multiple I guess you can have a function a la
nl80211_link_id_or_invalid().

johannes
Roopni Devanathan May 21, 2025, 10 a.m. UTC | #16
On 5/21/2025 3:28 PM, Johannes Berg wrote:
> On Wed, 2025-05-21 at 15:27 +0530, Roopni Devanathan wrote:
>>>
>> Okay, understood. If I can directly assign -1 as default value to radio_id,
>> then I can cut down this definition entirely. I can re-write radio_id
>> declaration in nl80211_set_wiphy() as:
>> 	s8 radio_id = -1;
>> instead of 
>> 	u8 radio_id = NL80211_WIPHY_RADIO_ID_DEFAULT;
>>
>> This will solve the whole problem. Is that alright?
> 
> Seems fine, there's probably only one place anyway that does this.
> 
> If there are multiple I guess you can have a function a la
> nl80211_link_id_or_invalid().
> 
Sure, but there's only one place this is needed. So I'll go with directly
assigning -1 as default value to radio_id.

Thank you for a detailed review!

> johannes
Roopni Devanathan May 21, 2025, 4:30 p.m. UTC | #17
On 5/21/2025 12:49 PM, Johannes Berg wrote:
> On Tue, 2025-04-29 at 09:30 +0530, Roopni Devanathan wrote:
> 
>> +++ b/include/net/mac80211.h
>> @@ -4569,7 +4569,8 @@ struct ieee80211_ops {
>>  			    struct ieee80211_key_conf *key,
>>  			    struct ieee80211_key_seq *seq);
>>  	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
>> -	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
>> +	int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id,
>> +				 u32 value);
> 
> That should probably have documentation updates. And passing a negative
> value to a u8 seems awkward? Maybe that should just be 'int'? For a
> value that's likely passed in a register, u8 will probably require more
> (machine) code anyway.
> 
Using 'int' leads to adding NLA_U32 policy. I think using 'int' is
costlier than using 's8'. Can we just revert back to using 's8' instead?
There will still be a default value of -1 and the radio indices will not
require u32 value anyway.

If this is okay, I'll send out the next version of patch series with
other comments addressed and s8 used instead of u8 (and int).

> johannes
Johannes Berg May 21, 2025, 4:41 p.m. UTC | #18
On Wed, 2025-05-21 at 22:00 +0530, Roopni Devanathan wrote:
> 
> Using 'int' leads to adding NLA_U32 policy. I think using 'int' is
> costlier than using 's8'. Can we just revert back to using 's8' instead?
> There will still be a default value of -1 and the radio indices will not
> require u32 value anyway.

I don't follow. You can always take a U8 value and put it into an int??

I think that NLA_U8 is a bit useless if you have to range-check anyway,
since an NLA_U8 attribute is actually the same size as an NLA_U32
attribute, it just has a more restricted range (but you restrict it to
the n_radios anyway!).

But I don't see how this is related at all.

I think 'int' is better internally, and NLA_U8 is fine externally.

johannes
Roopni Devanathan May 21, 2025, 4:52 p.m. UTC | #19
On 5/21/2025 10:11 PM, Johannes Berg wrote:
> On Wed, 2025-05-21 at 22:00 +0530, Roopni Devanathan wrote:
>>
>> Using 'int' leads to adding NLA_U32 policy. I think using 'int' is
>> costlier than using 's8'. Can we just revert back to using 's8' instead?
>> There will still be a default value of -1 and the radio indices will not
>> require u32 value anyway.
> 
> I don't follow. You can always take a U8 value and put it into an int??
> 
> I think that NLA_U8 is a bit useless if you have to range-check anyway,
> since an NLA_U8 attribute is actually the same size as an NLA_U32
> attribute, it just has a more restricted range (but you restrict it to
> the n_radios anyway!).
> 
> But I don't see how this is related at all.
> 
> I think 'int' is better internally, and NLA_U8 is fine externally.
> 
Okay, got it. The policy can retain NLA_U8, just the radio_id datatype
usage internally needs to be changed to int.

Thanks for clarifying.

> johannes
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ar5523/ar5523.c b/drivers/net/wireless/ath/ar5523/ar5523.c
index 96dc2778022a..f635c3d13542 100644
--- a/drivers/net/wireless/ath/ar5523/ar5523.c
+++ b/drivers/net/wireless/ath/ar5523/ar5523.c
@@ -1083,7 +1083,8 @@  static void ar5523_stop(struct ieee80211_hw *hw, bool suspend)
 	mutex_unlock(&ar->mutex);
 }
 
-static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 value)
 {
 	struct ar5523 *ar = hw->priv;
 	int ret;
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index c61b95a928da..ea512e7643ac 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -3,7 +3,7 @@ 
  * Copyright (c) 2005-2011 Atheros Communications Inc.
  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
  * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2025 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include "mac.h"
@@ -8018,7 +8018,8 @@  static int ath10k_cancel_remain_on_channel(struct ieee80211_hw *hw,
  * in ath10k, but device-specific in mac80211.
  */
 
-static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath10k_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 value)
 {
 	struct ath10k *ar = hw->priv;
 	struct ath10k_vif *arvif;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 8191ee14a1fd..72e8430052db 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -8182,7 +8182,8 @@  ath11k_set_vdev_param_to_all_vifs(struct ath11k *ar, int param, u32 value)
 /* mac80211 stores device specific RTS/Fragmentation threshold value,
  * this is set interface specific to firmware from ath11k driver
  */
-static int ath11k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath11k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+					   u32 value)
 {
 	struct ath11k *ar = hw->priv;
 	int param_id = WMI_VDEV_PARAM_RTS_THRESHOLD;
diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 84da77bf245b..34c8eeb5bf88 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -9644,7 +9644,8 @@  ath12k_set_vdev_param_to_all_vifs(struct ath12k *ar, int param, u32 value)
 /* mac80211 stores device specific RTS/Fragmentation threshold value,
  * this is set interface specific to firmware from ath12k driver
  */
-static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath12k_mac_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+					   u32 value)
 {
 	struct ath12k_hw *ah = ath12k_hw_to_ah(hw);
 	struct ath12k *ar;
diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_main.c b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
index 19600018e562..8c2d73626b23 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_main.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_main.c
@@ -1737,7 +1737,8 @@  static void ath9k_htc_sw_scan_complete(struct ieee80211_hw *hw,
 	mutex_unlock(&priv->mutex);
 }
 
-static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int ath9k_htc_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				       u32 value)
 {
 	return 0;
 }
diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c
index 94d08d6ae1a3..c7b35d70910a 100644
--- a/drivers/net/wireless/ath/wcn36xx/main.c
+++ b/drivers/net/wireless/ath/wcn36xx/main.c
@@ -965,7 +965,8 @@  static void wcn36xx_bss_info_changed(struct ieee80211_hw *hw,
 }
 
 /* this is required when using IEEE80211_HW_HAS_RATE_CONTROL */
-static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int wcn36xx_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				     u32 value)
 {
 	struct wcn36xx *wcn = hw->priv;
 	wcn36xx_dbg(WCN36XX_DBG_MAC, "mac set RTS threshold %d\n", value);
diff --git a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
index 03ef9b33c2d2..54d4e30ad61f 100644
--- a/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mld/mac80211.c
@@ -1077,7 +1077,8 @@  void iwl_mld_unassign_vif_chanctx(struct ieee80211_hw *hw,
 }
 
 static
-int iwl_mld_mac80211_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int iwl_mld_mac80211_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				       u32 value)
 {
 	return 0;
 }
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index 5d8f50a455d7..1bcd92ac2d66 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -4257,7 +4257,8 @@  int iwl_mvm_mac_sta_state_common(struct ieee80211_hw *hw,
 	return ret;
 }
 
-int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				  u32 value)
 {
 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
 
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index f6391c7a3e29..cf8a98280420 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -2907,7 +2907,8 @@  iwl_mvm_mac_release_buffered_frames(struct ieee80211_hw *hw,
 				    int num_frames,
 				    enum ieee80211_frame_release_type reason,
 				    bool more_data);
-int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int iwl_mvm_mac_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				  u32 value);
 void iwl_mvm_sta_rc_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 			   struct ieee80211_link_sta *link_sta, u32 changed);
 void iwl_mvm_mac_mgd_prepare_tx(struct ieee80211_hw *hw,
diff --git a/drivers/net/wireless/marvell/mwl8k.c b/drivers/net/wireless/marvell/mwl8k.c
index bab9ef37a1ab..4afd1e666642 100644
--- a/drivers/net/wireless/marvell/mwl8k.c
+++ b/drivers/net/wireless/marvell/mwl8k.c
@@ -5321,7 +5321,8 @@  static void mwl8k_configure_filter(struct ieee80211_hw *hw,
 	mwl8k_fw_unlock(hw);
 }
 
-static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int mwl8k_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				   u32 value)
 {
 	return mwl8k_cmd_set_rts_threshold(hw, value);
 }
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index c54005df08ca..5314d041258c 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -784,7 +784,8 @@  static void mt7615_tx(struct ieee80211_hw *hw,
 	mt76_connac_pm_queue_skb(hw, &dev->pm, wcid, skb);
 }
 
-static int mt7615_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7615_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 val)
 {
 	struct mt7615_dev *dev = mt7615_hw_dev(hw);
 	struct mt7615_phy *phy = mt7615_hw_phy(hw);
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02.h b/drivers/net/wireless/mediatek/mt76/mt76x02.h
index 4cd63bacd742..1b8af4b704f8 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02.h
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02.h
@@ -184,7 +184,7 @@  void mt76x02_tx_set_txpwr_auto(struct mt76x02_dev *dev, s8 txpwr);
 void mt76x02_set_tx_ackto(struct mt76x02_dev *dev);
 void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
 				s16 coverage_class);
-int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val);
+int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val);
 void mt76x02_remove_hdr_pad(struct sk_buff *skb, int len);
 bool mt76x02_tx_status_data(struct mt76_dev *mdev, u8 *update);
 void mt76x02_queue_rx_skb(struct mt76_dev *mdev, enum mt76_rxq_id q,
diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
index 4fb30589fa7a..314d13eb3785 100644
--- a/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
+++ b/drivers/net/wireless/mediatek/mt76/mt76x02_util.c
@@ -559,7 +559,7 @@  void mt76x02_set_coverage_class(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL_GPL(mt76x02_set_coverage_class);
 
-int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+int mt76x02_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 val)
 {
 	struct mt76x02_dev *dev = hw->priv;
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
index 3aa31c5cefa6..4d836909f50b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c
@@ -906,7 +906,8 @@  static void mt7915_tx(struct ieee80211_hw *hw,
 	mt76_tx(mphy, control->sta, wcid, skb);
 }
 
-static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7915_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 val)
 {
 	struct mt7915_dev *dev = mt7915_hw_dev(hw);
 	struct mt7915_phy *phy = mt7915_hw_phy(hw);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
index 826c48a2ee69..cfa5e4c4cc15 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
@@ -902,7 +902,8 @@  void mt7921_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt7921_mac_sta_remove);
 
-static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7921_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 val)
 {
 	struct mt792x_dev *dev = mt792x_hw_dev(hw);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7925/main.c b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
index 66f327781947..c3f80e1b1640 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7925/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7925/main.c
@@ -1262,7 +1262,8 @@  void mt7925_mac_sta_remove(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 }
 EXPORT_SYMBOL_GPL(mt7925_mac_sta_remove);
 
-static int mt7925_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7925_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 val)
 {
 	struct mt792x_dev *dev = mt792x_hw_dev(hw);
 
diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
index 91c64e3a0860..41ad5acf031b 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c
@@ -1241,7 +1241,8 @@  static void mt7996_tx(struct ieee80211_hw *hw,
 	rcu_read_unlock();
 }
 
-static int mt7996_set_rts_threshold(struct ieee80211_hw *hw, u32 val)
+static int mt7996_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 val)
 {
 	struct mt7996_dev *dev = mt7996_hw_dev(hw);
 	int i, ret;
diff --git a/drivers/net/wireless/mediatek/mt7601u/main.c b/drivers/net/wireless/mediatek/mt7601u/main.c
index 7570c6ceecea..c1a9d9233b1d 100644
--- a/drivers/net/wireless/mediatek/mt7601u/main.c
+++ b/drivers/net/wireless/mediatek/mt7601u/main.c
@@ -334,7 +334,8 @@  mt7601u_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	return mt76_mac_wcid_set_key(dev, msta->wcid.idx, key);
 }
 
-static int mt7601u_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int mt7601u_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				     u32 value)
 {
 	struct mt7601u_dev *dev = hw->priv;
 
diff --git a/drivers/net/wireless/purelifi/plfxlc/mac.c b/drivers/net/wireless/purelifi/plfxlc/mac.c
index eae93efa6150..253d748fe207 100644
--- a/drivers/net/wireless/purelifi/plfxlc/mac.c
+++ b/drivers/net/wireless/purelifi/plfxlc/mac.c
@@ -678,7 +678,8 @@  static void plfxlc_get_et_stats(struct ieee80211_hw *hw,
 	data[1] = mac->crc_errors;
 }
 
-static int plfxlc_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int plfxlc_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				    u32 value)
 {
 	return 0;
 }
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
index b7ea606bda08..15c35746a042 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.c
@@ -12100,7 +12100,7 @@  void rt2800_get_key_seq(struct ieee80211_hw *hw,
 }
 EXPORT_SYMBOL_GPL(rt2800_get_key_seq);
 
-int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct rt2x00_dev *rt2x00dev = hw->priv;
 	u32 reg;
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
index 194de676df8f..c3c4590aaaf2 100644
--- a/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
+++ b/drivers/net/wireless/ralink/rt2x00/rt2800lib.h
@@ -253,7 +253,7 @@  int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev);
 void rt2800_get_key_seq(struct ieee80211_hw *hw,
 			struct ieee80211_key_conf *key,
 			struct ieee80211_key_seq *seq);
-int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int rt2800_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 int rt2800_conf_tx(struct ieee80211_hw *hw,
 		   struct ieee80211_vif *vif,
 		   unsigned int link_id, u16 queue_idx,
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/core.c b/drivers/net/wireless/realtek/rtl8xxxu/core.c
index 569856ca677f..b6e45486d42e 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/core.c
@@ -6988,7 +6988,8 @@  static void rtl8xxxu_configure_filter(struct ieee80211_hw *hw,
 			 FIF_PROBE_REQ);
 }
 
-static int rtl8xxxu_set_rts_threshold(struct ieee80211_hw *hw, u32 rts)
+static int rtl8xxxu_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				      u32 rts)
 {
 	if (rts > 2347 && rts != (u32)-1)
 		return -EINVAL;
diff --git a/drivers/net/wireless/realtek/rtw88/mac80211.c b/drivers/net/wireless/realtek/rtw88/mac80211.c
index 026fbf4ad9cc..2638f21d9ca8 100644
--- a/drivers/net/wireless/realtek/rtw88/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw88/mac80211.c
@@ -706,7 +706,8 @@  static void rtw_ops_mgd_prepare_tx(struct ieee80211_hw *hw,
 	mutex_unlock(&rtwdev->mutex);
 }
 
-static int rtw_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int rtw_ops_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				     u32 value)
 {
 	struct rtw_dev *rtwdev = hw->priv;
 
diff --git a/drivers/net/wireless/realtek/rtw89/mac80211.c b/drivers/net/wireless/realtek/rtw89/mac80211.c
index 4fded07d0bee..5fe269ce1cfd 100644
--- a/drivers/net/wireless/realtek/rtw89/mac80211.c
+++ b/drivers/net/wireless/realtek/rtw89/mac80211.c
@@ -997,7 +997,8 @@  static int rtw89_ops_ampdu_action(struct ieee80211_hw *hw,
 	return 0;
 }
 
-static int rtw89_ops_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int rtw89_ops_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				       u32 value)
 {
 	struct rtw89_dev *rtwdev = hw->priv;
 
diff --git a/drivers/net/wireless/rsi/rsi_91x_mac80211.c b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
index 9db08200f4fa..c320b6464bda 100644
--- a/drivers/net/wireless/rsi/rsi_91x_mac80211.c
+++ b/drivers/net/wireless/rsi/rsi_91x_mac80211.c
@@ -1201,11 +1201,13 @@  static int rsi_mac80211_ampdu_action(struct ieee80211_hw *hw,
 /**
  * rsi_mac80211_set_rts_threshold() - This function sets rts threshold value.
  * @hw: Pointer to the ieee80211_hw structure.
+ * @radio_id: Index of the radio whose RTS threshold needs to be changed.
  * @value: Rts threshold value.
  *
  * Return: 0 on success.
  */
 static int rsi_mac80211_set_rts_threshold(struct ieee80211_hw *hw,
+					  u8 radio_id,
 					  u32 value)
 {
 	struct rsi_hw *adapter = hw->priv;
diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c
index e95b9ded17d9..b2ca43e63917 100644
--- a/drivers/net/wireless/silabs/wfx/sta.c
+++ b/drivers/net/wireless/silabs/wfx/sta.c
@@ -220,7 +220,7 @@  int wfx_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 	return 0;
 }
 
-int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int wfx_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	struct wfx_dev *wdev = hw->priv;
 	struct wfx_vif *wvif = NULL;
diff --git a/drivers/net/wireless/silabs/wfx/sta.h b/drivers/net/wireless/silabs/wfx/sta.h
index 8702eed5267f..f1288efee527 100644
--- a/drivers/net/wireless/silabs/wfx/sta.h
+++ b/drivers/net/wireless/silabs/wfx/sta.h
@@ -22,7 +22,7 @@  struct wfx_sta_priv {
 int wfx_start(struct ieee80211_hw *hw);
 void wfx_stop(struct ieee80211_hw *hw, bool suspend);
 int wfx_config(struct ieee80211_hw *hw, u32 changed);
-int wfx_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int wfx_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 void wfx_set_default_unicast_key(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int idx);
 void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
 			  unsigned int *total_flags, u64 unused);
diff --git a/drivers/net/wireless/st/cw1200/sta.c b/drivers/net/wireless/st/cw1200/sta.c
index 444272caf124..2d26154ade3e 100644
--- a/drivers/net/wireless/st/cw1200/sta.c
+++ b/drivers/net/wireless/st/cw1200/sta.c
@@ -857,7 +857,7 @@  void cw1200_wep_key_work(struct work_struct *work)
 	wsm_unlock_tx(priv);
 }
 
-int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value)
 {
 	int ret = 0;
 	__le32 val32;
diff --git a/drivers/net/wireless/st/cw1200/sta.h b/drivers/net/wireless/st/cw1200/sta.h
index b955b92cfd73..3f28bb9ec5ec 100644
--- a/drivers/net/wireless/st/cw1200/sta.h
+++ b/drivers/net/wireless/st/cw1200/sta.h
@@ -36,7 +36,7 @@  int cw1200_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
 		   struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 		   struct ieee80211_key_conf *key);
 
-int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value);
+int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id, u32 value);
 
 void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		  u32 queues, bool drop);
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index bb53d681c11b..490e505081b5 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -1051,7 +1051,8 @@  static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
 	return ret;
 }
 
-static int wl1251_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int wl1251_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				       u32 value)
 {
 	struct wl1251 *wl = hw->priv;
 	int ret;
diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c
index ea9bc4717a85..b3176d118a67 100644
--- a/drivers/net/wireless/ti/wlcore/main.c
+++ b/drivers/net/wireless/ti/wlcore/main.c
@@ -3923,7 +3923,8 @@  static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
 	return ret;
 }
 
-static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u8 radio_id,
+				       u32 value)
 {
 	struct wl1271 *wl = hw->priv;
 	struct wl12xx_vif *wlvif;
diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index 74d037cfccca..cf931d4f1181 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -3333,7 +3333,9 @@  static int mac80211_hwsim_tx_last_beacon(struct ieee80211_hw *hw)
 	return 1;
 }
 
-static int mac80211_hwsim_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
+static int mac80211_hwsim_set_rts_threshold(struct ieee80211_hw *hw,
+					    u8 radio_id,
+					    u32 value)
 {
 	return -EOPNOTSUPP;
 }
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index fdafc37d17cc..02e69db20108 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4569,7 +4569,8 @@  struct ieee80211_ops {
 			    struct ieee80211_key_conf *key,
 			    struct ieee80211_key_seq *seq);
 	int (*set_frag_threshold)(struct ieee80211_hw *hw, u32 value);
-	int (*set_rts_threshold)(struct ieee80211_hw *hw, u32 value);
+	int (*set_rts_threshold)(struct ieee80211_hw *hw, u8 radio_id,
+				 u32 value);
 	int (*sta_add)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 		       struct ieee80211_sta *sta);
 	int (*sta_remove)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index f227ff083835..a4c3e8363bd9 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3055,7 +3055,14 @@  static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u8 radio_id,
 	}
 
 	if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
-		err = drv_set_rts_threshold(local, wiphy->rts_threshold);
+		u32 rts_threshold;
+
+		if (radio_id >= wiphy->n_radio)
+			rts_threshold = wiphy->rts_threshold;
+		else
+			rts_threshold =
+				wiphy->radio_cfg[radio_id].rts_threshold;
+		err = drv_set_rts_threshold(local, radio_id, rts_threshold);
 
 		if (err)
 			return err;
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 307587c8a003..3f17480b2c59 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -402,16 +402,17 @@  static inline int drv_set_frag_threshold(struct ieee80211_local *local,
 }
 
 static inline int drv_set_rts_threshold(struct ieee80211_local *local,
-					u32 value)
+					u8 radio_id, u32 value)
 {
 	int ret = 0;
 
 	might_sleep();
 	lockdep_assert_wiphy(local->hw.wiphy);
 
-	trace_drv_set_rts_threshold(local, value);
+	trace_drv_set_rts_threshold(local, radio_id, value);
 	if (local->ops->set_rts_threshold)
-		ret = local->ops->set_rts_threshold(&local->hw, value);
+		ret = local->ops->set_rts_threshold(&local->hw, radio_id,
+						    value);
 	trace_drv_return_int(local, ret);
 	return ret;
 }
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 72fad8ea8bb9..b3797aca26bc 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -823,9 +823,27 @@  DEFINE_EVENT(local_u32_evt, drv_set_frag_threshold,
 	TP_ARGS(local, value)
 );
 
-DEFINE_EVENT(local_u32_evt, drv_set_rts_threshold,
-	TP_PROTO(struct ieee80211_local *local, u32 value),
-	TP_ARGS(local, value)
+TRACE_EVENT(drv_set_rts_threshold,
+	TP_PROTO(struct ieee80211_local *local, u8 radio_id, u32 value),
+
+	TP_ARGS(local, radio_id, value),
+
+	TP_STRUCT__entry(
+		LOCAL_ENTRY
+		__field(u8, radio_id)
+		__field(u32, value)
+	),
+
+	TP_fast_assign(
+		LOCAL_ASSIGN;
+		__entry->radio_id = radio_id;
+		__entry->value = value;
+	),
+
+	TP_printk(
+		LOCAL_PR_FMT " radio_id:%d, value:%d",
+		LOCAL_PR_ARG, __entry->radio_id, __entry->value
+	)
 );
 
 TRACE_EVENT(drv_set_coverage_class,
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 27d414efa3fd..da999b405809 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1829,7 +1829,13 @@  int ieee80211_reconfig(struct ieee80211_local *local)
 	drv_set_frag_threshold(local, hw->wiphy->frag_threshold);
 
 	/* setup RTS threshold */
-	drv_set_rts_threshold(local, hw->wiphy->rts_threshold);
+	if (hw->wiphy->n_radio > 0)
+		for (i = 0; i < hw->wiphy->n_radio; i++)
+			drv_set_rts_threshold(local, i,
+					      hw->wiphy->radio_cfg[i].rts_threshold);
+	else
+		drv_set_rts_threshold(local, NL80211_WIPHY_RADIO_ID_DEFAULT,
+				      hw->wiphy->rts_threshold);
 
 	/* reset coverage class */
 	drv_set_coverage_class(local, hw->wiphy->coverage_class);