Currently, in NO_VIRTUAL_MONITOR mode, when creating an AP/STA + monitor, there is a restriction: if the AP/STA is running, setting the channel for the monitor is not allowed. For example, in a scenario with three supported radios where the AP uses only the 2 GHz and 5 GHz bands, the 6 GHz band remains available. However, due to the restriction that rdev->num_running_ifaces must equal rdev->num_running_monitor_ifaces in cfg80211_has_monitors_only(), we are unable to create the monitor interface. cfg80211_set_monitor_channel -> cfg80211_has_monitors_only() static inline bool cfg80211_has_monitors_only() { ... return rdev->num_running_ifaces == rdev->num_running_monitor_ifaces && rdev->num_running_ifaces > 0; } To address this, add the new wiphy flag WIPHY_FLAG_SUPPORTS_NO_VIRTUAL_MONITOR to advertise no virtual monitor support to cfg80211. This flag will allow the creation of a monitor interface by bypassing the cfg80211_has_monitors_only() function. There is no need for special handling after this, as cfg80211_set_monitor_channel() will manage all interface combinations and allowed radio conditions. Signed-off-by: Nithyanantham Paramasivam <quic_nithp@xxxxxxxxxxx> --- include/net/cfg80211.h | 3 +++ net/wireless/chan.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 363d7dd2255a..c5d4d1d9df58 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -5035,6 +5035,8 @@ struct cfg80211_ops { * @WIPHY_FLAG_SUPPORTS_NSTR_NONPRIMARY: support connection to non-primary link * of an NSTR mobile AP MLD. * @WIPHY_FLAG_DISABLE_WEXT: disable wireless extensions for this device + * @WIPHY_FLAG_SUPPORTS_NO_VIRTUAL_MONITOR: Flag to advertise no virtual monitor + * support to cfg80211 */ enum wiphy_flags { WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK = BIT(0), @@ -5063,6 +5065,7 @@ enum wiphy_flags { WIPHY_FLAG_HAS_CHANNEL_SWITCH = BIT(23), WIPHY_FLAG_NOTIFY_REGDOM_BY_DRIVER = BIT(24), WIPHY_FLAG_CHANNEL_CHANGE_ON_BEACON = BIT(25), + WIPHY_FLAG_SUPPORTS_NO_VIRTUAL_MONITOR = BIT(26), }; /** diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 9f918b77b40e..3f80657bc273 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -1509,7 +1509,8 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev, { if (!rdev->ops->set_monitor_channel) return -EOPNOTSUPP; - if (!cfg80211_has_monitors_only(rdev)) + if (!(rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_NO_VIRTUAL_MONITOR) && + !cfg80211_has_monitors_only(rdev)) return -EBUSY; return rdev_set_monitor_channel(rdev, dev, chandef); -- 2.17.1