Message ID | 20250123010950.1958211-2-quic_nithp@quicinc.com |
---|---|
State | New |
Headers | show |
Series | wifi: cfg80211/mac80211/ath12k: Enable monitor creation in NO_VIRTUAL_MONITOR mode when AP is active | expand |
On Fri, 2025-02-28 at 20:15 +0530, Nithyanantham Paramasivam wrote: > On 2/28/2025 6:20 PM, Johannes Berg wrote: > > On Thu, 2025-01-23 at 06:39 +0530, Nithyanantham Paramasivam wrote: > > > 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. > > > > I think it would make sense to call this differently in cfg80211, per > > what it actually _achieves_, rather than per the *mac80211* logic about > > it... > > > > Sure. Perhaps I'll rename it to "WIPHY_FLAG_AP_MONITOR_SUPPORT" I don't think it's about "AP" either, really, it's about "concurrent" or so? > > > > There is no need for special handling after this, as > > > cfg80211_set_monitor_channel() will manage all interface combinations > > > and allowed radio conditions. > > > > This sentence just can't be right - you're changing > > cfg80211_set_monitor_channel() and there's no more code after it? > > > > Sure. It's better if i remove this sentence. Well seems you should still explain what happens then - i.e. that the driver, or in this case mac80211, needs to check that it's possible? johannes
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);
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@quicinc.com> --- include/net/cfg80211.h | 3 +++ net/wireless/chan.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-)