|
|
@@ -3308,10 +3308,11 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
|
|
|
struct ieee80211_local *local = sdata->local;
|
|
|
struct ieee80211_sub_if_data *sdata_iter;
|
|
|
enum nl80211_iftype iftype = sdata->wdev.iftype;
|
|
|
- int num[NUM_NL80211_IFTYPES];
|
|
|
struct ieee80211_chanctx *ctx;
|
|
|
- int num_different_channels = 0;
|
|
|
int total = 1;
|
|
|
+ struct iface_combination_params params = {
|
|
|
+ .radar_detect = radar_detect,
|
|
|
+ };
|
|
|
|
|
|
lockdep_assert_held(&local->chanctx_mtx);
|
|
|
|
|
|
@@ -3322,9 +3323,6 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
|
|
|
!chandef->chan))
|
|
|
return -EINVAL;
|
|
|
|
|
|
- if (chandef)
|
|
|
- num_different_channels = 1;
|
|
|
-
|
|
|
if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))
|
|
|
return -EINVAL;
|
|
|
|
|
|
@@ -3335,24 +3333,26 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
- memset(num, 0, sizeof(num));
|
|
|
+ if (chandef)
|
|
|
+ params.num_different_channels = 1;
|
|
|
|
|
|
if (iftype != NL80211_IFTYPE_UNSPECIFIED)
|
|
|
- num[iftype] = 1;
|
|
|
+ params.iftype_num[iftype] = 1;
|
|
|
|
|
|
list_for_each_entry(ctx, &local->chanctx_list, list) {
|
|
|
if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
|
|
|
continue;
|
|
|
- radar_detect |= ieee80211_chanctx_radar_detect(local, ctx);
|
|
|
+ params.radar_detect |=
|
|
|
+ ieee80211_chanctx_radar_detect(local, ctx);
|
|
|
if (ctx->mode == IEEE80211_CHANCTX_EXCLUSIVE) {
|
|
|
- num_different_channels++;
|
|
|
+ params.num_different_channels++;
|
|
|
continue;
|
|
|
}
|
|
|
if (chandef && chanmode == IEEE80211_CHANCTX_SHARED &&
|
|
|
cfg80211_chandef_compatible(chandef,
|
|
|
&ctx->conf.def))
|
|
|
continue;
|
|
|
- num_different_channels++;
|
|
|
+ params.num_different_channels++;
|
|
|
}
|
|
|
|
|
|
list_for_each_entry_rcu(sdata_iter, &local->interfaces, list) {
|
|
|
@@ -3365,16 +3365,14 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
|
|
|
local->hw.wiphy->software_iftypes & BIT(wdev_iter->iftype))
|
|
|
continue;
|
|
|
|
|
|
- num[wdev_iter->iftype]++;
|
|
|
+ params.iftype_num[wdev_iter->iftype]++;
|
|
|
total++;
|
|
|
}
|
|
|
|
|
|
- if (total == 1 && !radar_detect)
|
|
|
+ if (total == 1 && !params.radar_detect)
|
|
|
return 0;
|
|
|
|
|
|
- return cfg80211_check_combinations(local->hw.wiphy,
|
|
|
- num_different_channels,
|
|
|
- radar_detect, num);
|
|
|
+ return cfg80211_check_combinations(local->hw.wiphy, ¶ms);
|
|
|
}
|
|
|
|
|
|
static void
|
|
|
@@ -3390,12 +3388,10 @@ ieee80211_iter_max_chans(const struct ieee80211_iface_combination *c,
|
|
|
int ieee80211_max_num_channels(struct ieee80211_local *local)
|
|
|
{
|
|
|
struct ieee80211_sub_if_data *sdata;
|
|
|
- int num[NUM_NL80211_IFTYPES] = {};
|
|
|
struct ieee80211_chanctx *ctx;
|
|
|
- int num_different_channels = 0;
|
|
|
- u8 radar_detect = 0;
|
|
|
u32 max_num_different_channels = 1;
|
|
|
int err;
|
|
|
+ struct iface_combination_params params = {0};
|
|
|
|
|
|
lockdep_assert_held(&local->chanctx_mtx);
|
|
|
|
|
|
@@ -3403,17 +3399,17 @@ int ieee80211_max_num_channels(struct ieee80211_local *local)
|
|
|
if (ctx->replace_state == IEEE80211_CHANCTX_WILL_BE_REPLACED)
|
|
|
continue;
|
|
|
|
|
|
- num_different_channels++;
|
|
|
+ params.num_different_channels++;
|
|
|
|
|
|
- radar_detect |= ieee80211_chanctx_radar_detect(local, ctx);
|
|
|
+ params.radar_detect |=
|
|
|
+ ieee80211_chanctx_radar_detect(local, ctx);
|
|
|
}
|
|
|
|
|
|
list_for_each_entry_rcu(sdata, &local->interfaces, list)
|
|
|
- num[sdata->wdev.iftype]++;
|
|
|
+ params.iftype_num[sdata->wdev.iftype]++;
|
|
|
|
|
|
- err = cfg80211_iter_combinations(local->hw.wiphy,
|
|
|
- num_different_channels, radar_detect,
|
|
|
- num, ieee80211_iter_max_chans,
|
|
|
+ err = cfg80211_iter_combinations(local->hw.wiphy, ¶ms,
|
|
|
+ ieee80211_iter_max_chans,
|
|
|
&max_num_different_channels);
|
|
|
if (err < 0)
|
|
|
return err;
|