diff options
author | Alban Browaeys <prahal@yahoo.com> | 2009-11-25 09:13:00 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-28 15:05:00 -0500 |
commit | e60d7443e00a72a2c056950cdaab79c7b077f3d4 (patch) | |
tree | 0d2376434a0f44ac2b30bba0af3cdcb8e5421c90 | |
parent | ece1e3c61e59ba184150e5aff57bbc6355613e3e (diff) |
wireless : use a dedicated workqueue for cfg80211.
This patch moves the works cleanup, scan and events to a cfg80211
dedicated workqueue.
Platform driver like eeepc-laptop ought to use works to rfkill (as
new rfkill does lock in rfkill_unregister and the platform driver is
called from rfkill_switch_all which also lock the same mutex).
This raise a new issue in itself that the work scheduled by the platform
driver to the global worqueue calls wiphy_unregister which flush_work
scan and event works (which thus flush works on the global workqueue inside
a work on the global workqueue) and also put on hold the wdev_cleanup_work
(which prevents the dev_put on netdev thus indefinite Usage count error on
wifi device).
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Alban Browaeys <prahal@yahoo.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/wireless/core.c | 12 | ||||
-rw-r--r-- | net/wireless/core.h | 2 | ||||
-rw-r--r-- | net/wireless/ibss.c | 2 | ||||
-rw-r--r-- | net/wireless/scan.c | 2 | ||||
-rw-r--r-- | net/wireless/sme.c | 6 |
5 files changed, 18 insertions, 6 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index fe6f402a22af..c2a2c563d21a 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -45,6 +45,9 @@ DEFINE_MUTEX(cfg80211_mutex); | |||
45 | /* for debugfs */ | 45 | /* for debugfs */ |
46 | static struct dentry *ieee80211_debugfs_dir; | 46 | static struct dentry *ieee80211_debugfs_dir; |
47 | 47 | ||
48 | /* for the cleanup, scan and event works */ | ||
49 | struct workqueue_struct *cfg80211_wq; | ||
50 | |||
48 | /* requires cfg80211_mutex to be held! */ | 51 | /* requires cfg80211_mutex to be held! */ |
49 | struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx) | 52 | struct cfg80211_registered_device *cfg80211_rdev_by_wiphy_idx(int wiphy_idx) |
50 | { | 53 | { |
@@ -727,7 +730,7 @@ static int cfg80211_netdev_notifier_call(struct notifier_block * nb, | |||
727 | break; | 730 | break; |
728 | case NETDEV_DOWN: | 731 | case NETDEV_DOWN: |
729 | dev_hold(dev); | 732 | dev_hold(dev); |
730 | schedule_work(&wdev->cleanup_work); | 733 | queue_work(cfg80211_wq, &wdev->cleanup_work); |
731 | break; | 734 | break; |
732 | case NETDEV_UP: | 735 | case NETDEV_UP: |
733 | /* | 736 | /* |
@@ -845,8 +848,14 @@ static int __init cfg80211_init(void) | |||
845 | if (err) | 848 | if (err) |
846 | goto out_fail_reg; | 849 | goto out_fail_reg; |
847 | 850 | ||
851 | cfg80211_wq = create_singlethread_workqueue("cfg80211"); | ||
852 | if (!cfg80211_wq) | ||
853 | goto out_fail_wq; | ||
854 | |||
848 | return 0; | 855 | return 0; |
849 | 856 | ||
857 | out_fail_wq: | ||
858 | regulatory_exit(); | ||
850 | out_fail_reg: | 859 | out_fail_reg: |
851 | debugfs_remove(ieee80211_debugfs_dir); | 860 | debugfs_remove(ieee80211_debugfs_dir); |
852 | out_fail_nl80211: | 861 | out_fail_nl80211: |
@@ -868,5 +877,6 @@ static void cfg80211_exit(void) | |||
868 | wiphy_sysfs_exit(); | 877 | wiphy_sysfs_exit(); |
869 | regulatory_exit(); | 878 | regulatory_exit(); |
870 | unregister_pernet_device(&cfg80211_pernet_ops); | 879 | unregister_pernet_device(&cfg80211_pernet_ops); |
880 | destroy_workqueue(cfg80211_wq); | ||
871 | } | 881 | } |
872 | module_exit(cfg80211_exit); | 882 | module_exit(cfg80211_exit); |
diff --git a/net/wireless/core.h b/net/wireless/core.h index a9db9e6255bb..4ef3efc94106 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -91,6 +91,8 @@ bool wiphy_idx_valid(int wiphy_idx) | |||
91 | return (wiphy_idx >= 0); | 91 | return (wiphy_idx >= 0); |
92 | } | 92 | } |
93 | 93 | ||
94 | |||
95 | extern struct workqueue_struct *cfg80211_wq; | ||
94 | extern struct mutex cfg80211_mutex; | 96 | extern struct mutex cfg80211_mutex; |
95 | extern struct list_head cfg80211_rdev_list; | 97 | extern struct list_head cfg80211_rdev_list; |
96 | extern int cfg80211_rdev_list_generation; | 98 | extern int cfg80211_rdev_list_generation; |
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c index 34dfc93fa713..6ef5a491fb4b 100644 --- a/net/wireless/ibss.c +++ b/net/wireless/ibss.c | |||
@@ -70,7 +70,7 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp) | |||
70 | spin_lock_irqsave(&wdev->event_lock, flags); | 70 | spin_lock_irqsave(&wdev->event_lock, flags); |
71 | list_add_tail(&ev->list, &wdev->event_list); | 71 | list_add_tail(&ev->list, &wdev->event_list); |
72 | spin_unlock_irqrestore(&wdev->event_lock, flags); | 72 | spin_unlock_irqrestore(&wdev->event_lock, flags); |
73 | schedule_work(&rdev->event_work); | 73 | queue_work(cfg80211_wq, &rdev->event_work); |
74 | } | 74 | } |
75 | EXPORT_SYMBOL(cfg80211_ibss_joined); | 75 | EXPORT_SYMBOL(cfg80211_ibss_joined); |
76 | 76 | ||
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index 227d57b8dc41..df26228db1b3 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -88,7 +88,7 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) | |||
88 | WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); | 88 | WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); |
89 | 89 | ||
90 | request->aborted = aborted; | 90 | request->aborted = aborted; |
91 | schedule_work(&wiphy_to_dev(request->wiphy)->scan_done_wk); | 91 | queue_work(cfg80211_wq, &wiphy_to_dev(request->wiphy)->scan_done_wk); |
92 | } | 92 | } |
93 | EXPORT_SYMBOL(cfg80211_scan_done); | 93 | EXPORT_SYMBOL(cfg80211_scan_done); |
94 | 94 | ||
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 0115d07d2c1a..2333d78187e4 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -488,7 +488,7 @@ void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, | |||
488 | spin_lock_irqsave(&wdev->event_lock, flags); | 488 | spin_lock_irqsave(&wdev->event_lock, flags); |
489 | list_add_tail(&ev->list, &wdev->event_list); | 489 | list_add_tail(&ev->list, &wdev->event_list); |
490 | spin_unlock_irqrestore(&wdev->event_lock, flags); | 490 | spin_unlock_irqrestore(&wdev->event_lock, flags); |
491 | schedule_work(&rdev->event_work); | 491 | queue_work(cfg80211_wq, &rdev->event_work); |
492 | } | 492 | } |
493 | EXPORT_SYMBOL(cfg80211_connect_result); | 493 | EXPORT_SYMBOL(cfg80211_connect_result); |
494 | 494 | ||
@@ -583,7 +583,7 @@ void cfg80211_roamed(struct net_device *dev, const u8 *bssid, | |||
583 | spin_lock_irqsave(&wdev->event_lock, flags); | 583 | spin_lock_irqsave(&wdev->event_lock, flags); |
584 | list_add_tail(&ev->list, &wdev->event_list); | 584 | list_add_tail(&ev->list, &wdev->event_list); |
585 | spin_unlock_irqrestore(&wdev->event_lock, flags); | 585 | spin_unlock_irqrestore(&wdev->event_lock, flags); |
586 | schedule_work(&rdev->event_work); | 586 | queue_work(cfg80211_wq, &rdev->event_work); |
587 | } | 587 | } |
588 | EXPORT_SYMBOL(cfg80211_roamed); | 588 | EXPORT_SYMBOL(cfg80211_roamed); |
589 | 589 | ||
@@ -681,7 +681,7 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason, | |||
681 | spin_lock_irqsave(&wdev->event_lock, flags); | 681 | spin_lock_irqsave(&wdev->event_lock, flags); |
682 | list_add_tail(&ev->list, &wdev->event_list); | 682 | list_add_tail(&ev->list, &wdev->event_list); |
683 | spin_unlock_irqrestore(&wdev->event_lock, flags); | 683 | spin_unlock_irqrestore(&wdev->event_lock, flags); |
684 | schedule_work(&rdev->event_work); | 684 | queue_work(cfg80211_wq, &rdev->event_work); |
685 | } | 685 | } |
686 | EXPORT_SYMBOL(cfg80211_disconnected); | 686 | EXPORT_SYMBOL(cfg80211_disconnected); |
687 | 687 | ||