On Tue, 2024-10-08 at 09:23 +0200, Felix Fietkau wrote: > This allows users to prevent a vif from affecting radios other than the > configured ones. This can be useful in cases where e.g. an AP is running > on one radio, and triggering a scan on another radio should not disturb it. > > Changing the allowed radios list for a vif is supported, but only while > it is down. > > While it is possible to achieve the same by always explicitly specifying > a frequency list for scan requests and ensuring that the wrong channel/band > is never accidentally set on an unrelated interface, this change makes > multi-radio wiphy setups a lot easier to deal with for CLI users. > > By itself, this patch only enforces the radio mask for scanning requests > and remain-on-channel. Follow-up changes build on this to limit configured > frequencies. > > Signed-off-by: Felix Fietkau <nbd@xxxxxxxx> > --- > include/net/cfg80211.h | 12 +++++++- > include/uapi/linux/nl80211.h | 5 +++- > net/wireless/core.c | 2 +- > net/wireless/nl80211.c | 60 ++++++++++++++++++++++++++++++++----- > net/wireless/scan.c | 10 ++++-- > net/wireless/util.c | 29 ++++++++++++++++++- > 6 files changed, 107 insertions(+), 11 deletions(-) > > diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h > index 69ec1eb41a09..73df4a8e8cce 100644 > --- a/include/net/cfg80211.h > +++ b/include/net/cfg80211.h > @@ -6223,6 +6223,7 @@ enum ieee80211_ap_reg_power { > * entered. > * @links.cac_time_ms: CAC time in ms > * @valid_links: bitmap describing what elements of @links are valid > + * @radio_mask: Bitmask of radios that this interface is allowed to operate on. > */ > struct wireless_dev { > struct wiphy *wiphy; > @@ -6335,6 +6336,8 @@ struct wireless_dev { > unsigned int cac_time_ms; > } links[IEEE80211_MLD_MAX_NUM_LINKS]; > u16 valid_links; > + > + u32 radio_mask; > }; > > static inline const u8 *wdev_address(struct wireless_dev *wdev) > @@ -6521,6 +6524,15 @@ bool cfg80211_radio_chandef_valid(const struct wiphy_radio *radio, > const struct cfg80211_chan_def *chandef); > > /** > + * cfg80211_wdev_channel_allowed - Check if the wdev may use the channel > + * > + * @wdev: the wireless device > + * @chan: channel to check > + */ > need Return: documentation johannes