[RFC v3 6/8] wifi: mac80211: extend ifcomb check functions for multi-radio

Felix Fietkau nbd at nbd.name
Fri Jun 7 03:22:25 PDT 2024


On 07.06.24 12:07, Karthikeyan Periyasamy wrote:
> 
> 
> On 6/6/2024 11:37 PM, Felix Fietkau wrote:
>> Add support for counting global and per-radio max/current number of
>> channels, as well as checking radio-specific interface combinations.
>> 
>> Signed-off-by: Felix Fietkau <nbd at nbd.name>
>> ---
>>   net/mac80211/cfg.c         |   7 +-
>>   net/mac80211/chan.c        |  17 +++--
>>   net/mac80211/ibss.c        |   2 +-
>>   net/mac80211/ieee80211_i.h |   6 +-
>>   net/mac80211/iface.c       |   2 +-
>>   net/mac80211/util.c        | 131 +++++++++++++++++++++++++++-----------
>>   6 files changed, 116 insertions(+), 49 deletions(-)
>> 
>> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
>> index 62119e957cd8..950b7b72f0b8 100644
>> --- a/net/mac80211/cfg.c
>> +++ b/net/mac80211/cfg.c
>> @@ -263,7 +263,7 @@ static int ieee80211_start_p2p_device(struct wiphy *wiphy,
>>   
>>   	lockdep_assert_wiphy(sdata->local->hw.wiphy);
>>   
>> -	ret = ieee80211_check_combinations(sdata, NULL, 0, 0);
>> +	ret = ieee80211_check_combinations(sdata, NULL, 0, 0, -1);
>>   	if (ret < 0)
>>   		return ret;
>>   
>> @@ -285,7 +285,7 @@ static int ieee80211_start_nan(struct wiphy *wiphy,
>>   
>>   	lockdep_assert_wiphy(sdata->local->hw.wiphy);
>>   
>> -	ret = ieee80211_check_combinations(sdata, NULL, 0, 0);
>> +	ret = ieee80211_check_combinations(sdata, NULL, 0, 0, -1);
>>   	if (ret < 0)
>>   		return ret;
>>   
>> @@ -4001,7 +4001,7 @@ __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
>>   		goto out;
>>   
>>   	/* if reservation is invalid then this will fail */
>> -	err = ieee80211_check_combinations(sdata, NULL, chanctx->mode, 0);
>> +	err = ieee80211_check_combinations(sdata, NULL, chanctx->mode, 0, -1);
> 
> Once we reach the global limit, all the -1 passing caller get fail
> becuase the iface check param (existing and new) is validated against
> the global limit. since global limt as a sort of union of all per-radio
> limits.
> 
> Ex:
> Global iface = 6 (Radio iface 2GHz:4, 5GHz:4, 6GHz:6)
> 
> 
> So far 6 iface created (Radio iface 2GHz:2, 5GHz:3, 6GHz:1)
> 
> In this case, new iface creation get fail because caller uses
> ieee80211_check_combinations() with -1 as radio idx, so it checked
> against global limit

Use the sum of the number of interfaces from each radio instead of the 
maximum.

- Felix




More information about the ath12k mailing list