mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-07 13:53:24 +00:00
wifi: cfg80211: extend interface combination check for multi-radio
Add a field in struct iface_combination_params to check per-radio interface combinations instead of per-wiphy ones. Signed-off-by: Felix Fietkau <nbd@nbd.name> Link: https://patch.msgid.link/32b28da89c2d759b0324deeefe2be4cee91de18e.1720514221.git-series.nbd@nbd.name Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
e6c06ca8f2
commit
abb4cfe366
@ -1598,6 +1598,7 @@ struct cfg80211_color_change_settings {
|
|||||||
*
|
*
|
||||||
* Used to pass interface combination parameters
|
* Used to pass interface combination parameters
|
||||||
*
|
*
|
||||||
|
* @radio_idx: wiphy radio index or -1 for global
|
||||||
* @num_different_channels: the number of different channels we want
|
* @num_different_channels: the number of different channels we want
|
||||||
* to use for verification
|
* to use for verification
|
||||||
* @radar_detect: a bitmap where each bit corresponds to a channel
|
* @radar_detect: a bitmap where each bit corresponds to a channel
|
||||||
@ -1611,6 +1612,7 @@ struct cfg80211_color_change_settings {
|
|||||||
* the verification
|
* the verification
|
||||||
*/
|
*/
|
||||||
struct iface_combination_params {
|
struct iface_combination_params {
|
||||||
|
int radio_idx;
|
||||||
int num_different_channels;
|
int num_different_channels;
|
||||||
u8 radar_detect;
|
u8 radar_detect;
|
||||||
int iftype_num[NUM_NL80211_IFTYPES];
|
int iftype_num[NUM_NL80211_IFTYPES];
|
||||||
@ -4580,6 +4582,8 @@ struct mgmt_frame_regs {
|
|||||||
*
|
*
|
||||||
* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
|
* @set_hw_timestamp: Enable/disable HW timestamping of TM/FTM frames.
|
||||||
* @set_ttlm: set the TID to link mapping.
|
* @set_ttlm: set the TID to link mapping.
|
||||||
|
* @get_radio_mask: get bitmask of radios in use.
|
||||||
|
* (invoked with the wiphy mutex held)
|
||||||
*/
|
*/
|
||||||
struct cfg80211_ops {
|
struct cfg80211_ops {
|
||||||
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
|
int (*suspend)(struct wiphy *wiphy, struct cfg80211_wowlan *wow);
|
||||||
@ -4941,6 +4945,7 @@ struct cfg80211_ops {
|
|||||||
struct cfg80211_set_hw_timestamp *hwts);
|
struct cfg80211_set_hw_timestamp *hwts);
|
||||||
int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,
|
int (*set_ttlm)(struct wiphy *wiphy, struct net_device *dev,
|
||||||
struct cfg80211_ttlm_params *params);
|
struct cfg80211_ttlm_params *params);
|
||||||
|
u32 (*get_radio_mask)(struct wiphy *wiphy, struct net_device *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3944,6 +3944,7 @@ int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
|
|||||||
int total = 1;
|
int total = 1;
|
||||||
struct iface_combination_params params = {
|
struct iface_combination_params params = {
|
||||||
.radar_detect = radar_detect,
|
.radar_detect = radar_detect,
|
||||||
|
.radio_idx = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
lockdep_assert_wiphy(local->hw.wiphy);
|
lockdep_assert_wiphy(local->hw.wiphy);
|
||||||
@ -4034,7 +4035,9 @@ int ieee80211_max_num_channels(struct ieee80211_local *local)
|
|||||||
struct ieee80211_chanctx *ctx;
|
struct ieee80211_chanctx *ctx;
|
||||||
u32 max_num_different_channels = 1;
|
u32 max_num_different_channels = 1;
|
||||||
int err;
|
int err;
|
||||||
struct iface_combination_params params = {0};
|
struct iface_combination_params params = {
|
||||||
|
.radio_idx = -1,
|
||||||
|
};
|
||||||
|
|
||||||
lockdep_assert_wiphy(local->hw.wiphy);
|
lockdep_assert_wiphy(local->hw.wiphy);
|
||||||
|
|
||||||
|
@ -1532,4 +1532,16 @@ rdev_set_ttlm(struct cfg80211_registered_device *rdev,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline u32
|
||||||
|
rdev_get_radio_mask(struct cfg80211_registered_device *rdev,
|
||||||
|
struct net_device *dev)
|
||||||
|
{
|
||||||
|
struct wiphy *wiphy = &rdev->wiphy;
|
||||||
|
|
||||||
|
if (!rdev->ops->get_radio_mask)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return rdev->ops->get_radio_mask(wiphy, dev);
|
||||||
|
}
|
||||||
#endif /* __CFG80211_RDEV_OPS */
|
#endif /* __CFG80211_RDEV_OPS */
|
||||||
|
@ -2307,13 +2307,16 @@ static int cfg80211_wdev_bi(struct wireless_dev *wdev)
|
|||||||
|
|
||||||
static void cfg80211_calculate_bi_data(struct wiphy *wiphy, u32 new_beacon_int,
|
static void cfg80211_calculate_bi_data(struct wiphy *wiphy, u32 new_beacon_int,
|
||||||
u32 *beacon_int_gcd,
|
u32 *beacon_int_gcd,
|
||||||
bool *beacon_int_different)
|
bool *beacon_int_different,
|
||||||
|
int radio_idx)
|
||||||
{
|
{
|
||||||
|
struct cfg80211_registered_device *rdev;
|
||||||
struct wireless_dev *wdev;
|
struct wireless_dev *wdev;
|
||||||
|
|
||||||
*beacon_int_gcd = 0;
|
*beacon_int_gcd = 0;
|
||||||
*beacon_int_different = false;
|
*beacon_int_different = false;
|
||||||
|
|
||||||
|
rdev = wiphy_to_rdev(wiphy);
|
||||||
list_for_each_entry(wdev, &wiphy->wdev_list, list) {
|
list_for_each_entry(wdev, &wiphy->wdev_list, list) {
|
||||||
int wdev_bi;
|
int wdev_bi;
|
||||||
|
|
||||||
@ -2321,6 +2324,11 @@ static void cfg80211_calculate_bi_data(struct wiphy *wiphy, u32 new_beacon_int,
|
|||||||
if (wdev->valid_links)
|
if (wdev->valid_links)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* skip wdevs not active on the given wiphy radio */
|
||||||
|
if (radio_idx >= 0 &&
|
||||||
|
!(rdev_get_radio_mask(rdev, wdev->netdev) & BIT(radio_idx)))
|
||||||
|
continue;
|
||||||
|
|
||||||
wdev_bi = cfg80211_wdev_bi(wdev);
|
wdev_bi = cfg80211_wdev_bi(wdev);
|
||||||
|
|
||||||
if (!wdev_bi)
|
if (!wdev_bi)
|
||||||
@ -2368,14 +2376,19 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
|
|||||||
void *data),
|
void *data),
|
||||||
void *data)
|
void *data)
|
||||||
{
|
{
|
||||||
|
const struct wiphy_radio *radio = NULL;
|
||||||
|
const struct ieee80211_iface_combination *c, *cs;
|
||||||
const struct ieee80211_regdomain *regdom;
|
const struct ieee80211_regdomain *regdom;
|
||||||
enum nl80211_dfs_regions region = 0;
|
enum nl80211_dfs_regions region = 0;
|
||||||
int i, j, iftype;
|
int i, j, n, iftype;
|
||||||
int num_interfaces = 0;
|
int num_interfaces = 0;
|
||||||
u32 used_iftypes = 0;
|
u32 used_iftypes = 0;
|
||||||
u32 beacon_int_gcd;
|
u32 beacon_int_gcd;
|
||||||
bool beacon_int_different;
|
bool beacon_int_different;
|
||||||
|
|
||||||
|
if (params->radio_idx >= 0)
|
||||||
|
radio = &wiphy->radio[params->radio_idx];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a bit strange, since the iteration used to rely only on
|
* This is a bit strange, since the iteration used to rely only on
|
||||||
* the data given by the driver, but here it now relies on context,
|
* the data given by the driver, but here it now relies on context,
|
||||||
@ -2387,7 +2400,8 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
|
|||||||
* interfaces (while being brought up) and channel/radar data.
|
* interfaces (while being brought up) and channel/radar data.
|
||||||
*/
|
*/
|
||||||
cfg80211_calculate_bi_data(wiphy, params->new_beacon_int,
|
cfg80211_calculate_bi_data(wiphy, params->new_beacon_int,
|
||||||
&beacon_int_gcd, &beacon_int_different);
|
&beacon_int_gcd, &beacon_int_different,
|
||||||
|
params->radio_idx);
|
||||||
|
|
||||||
if (params->radar_detect) {
|
if (params->radar_detect) {
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
@ -2404,13 +2418,18 @@ int cfg80211_iter_combinations(struct wiphy *wiphy,
|
|||||||
used_iftypes |= BIT(iftype);
|
used_iftypes |= BIT(iftype);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < wiphy->n_iface_combinations; i++) {
|
if (radio) {
|
||||||
const struct ieee80211_iface_combination *c;
|
cs = radio->iface_combinations;
|
||||||
|
n = radio->n_iface_combinations;
|
||||||
|
} else {
|
||||||
|
cs = wiphy->iface_combinations;
|
||||||
|
n = wiphy->n_iface_combinations;
|
||||||
|
}
|
||||||
|
for (i = 0; i < n; i++) {
|
||||||
struct ieee80211_iface_limit *limits;
|
struct ieee80211_iface_limit *limits;
|
||||||
u32 all_iftypes = 0;
|
u32 all_iftypes = 0;
|
||||||
|
|
||||||
c = &wiphy->iface_combinations[i];
|
c = &cs[i];
|
||||||
|
|
||||||
if (num_interfaces > c->max_interfaces)
|
if (num_interfaces > c->max_interfaces)
|
||||||
continue;
|
continue;
|
||||||
if (params->num_different_channels > c->num_different_channels)
|
if (params->num_different_channels > c->num_different_channels)
|
||||||
|
Loading…
Reference in New Issue
Block a user