cfg80211: processing regulatory requests on netdev notifier
PATCH v3 1/1 cfg80211: processing regulatory requests on netdev notifier
This adds a trigger to review any pending regulatory requests whenever an 802.11 device interface is brought down or up. We use this as an opportunistic trigger for checking the regulatory work queues as otherwise they they're only checked upon an initial regulatory request or when beacon hints are found.
This opportunistic mechanism can be used to trigger kicking the queues regulatory queues at any time from userspace without having to change the regulatory state.
A timer just waiting upon init is not that appropriate as when it should be triggered will depend on systems, a much better approach is to use and add opportunistic triggers. The interface coming up is typically a good indicator that filesystems have been mounted since firmware is required for some devices.
--- net/wireless/core.c | 2 ++ net/wireless/reg.c | 5 +++++ net/wireless/reg.h | 1 + 3 files changed, 8 insertions(+)
net/wireless/core.c +2 -0
@@ -812,6 +812,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,SET_NETDEV_DEVTYPE (dev, &wiphy_type);break ;case NETDEV_REGISTER : +reg_process_pending_work ();/* * NB: cannot take rdev->mtx here because this may be * called within code protected by it when interfaces
@@ -874,6 +875,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,wake_up (&rdev->dev_wait);break ;case NETDEV_UP : +reg_process_pending_work ();cfg80211_update_iface_num (rdev, wdev->iftype,1 );wdev_lock (wdev);switch (wdev->iftype) {
net/wireless/reg.c +5 -0
@@ -192,6 +192,11 @@ static DECLARE_WORK(reg_work, reg_todo);static void reg_timeout_work (struct work_struct *work); static DECLARE_DELAYED_WORK(reg_timeout, reg_timeout_work); +void reg_process_pending_work (void ) +{ +schedule_work (®_work); +} +/* We keep a static world regulatory domain in case of the absence of CRDA */ static const struct ieee80211_regdomain world_regdom = { .n_reg_rules =6 ,
net/wireless/reg.h +1 -0
@@ -37,6 +37,7 @@ unsigned int reg_get_max_bandwidth(const struct ieee80211_regdomain *rd, const struct ieee80211_reg_rule *rule);bool reg_last_request_cell_base (void ); +void reg_process_pending_work (void );/** * regulatory_hint_found_beacon - hints a beacon was found on a channel
Signature · 1 line
1.8.5.3
Johannes Berg
maintainerQuoted 11 lines · Luis R. Rodriguez
This adds a trigger to review any pending regulatory requests whenever an 802.11 device interface is brought down or up. We use this as an opportunistic trigger for checking the regulatory work queues as otherwise they they're only checked upon an initial regulatory request or when beacon hints are found.
This opportunistic mechanism can be used to trigger kicking the queues regulatory queues at any time from userspace without having to change the regulatory state.
Quoted 6 lines
A timer just waiting upon init is not that appropriate as when it should be triggered will depend on systems, a much better approach is to use and add opportunistic triggers. The interface coming up is typically a good indicator that filesystems have been mounted since firmware is required for some devices.
I still don't like it. You have a problem in the regulatory code and work around it by hooking into random parts of the other code - can't you fix it properly in the regulatory code?
johannes