Search Linux Wireless

[PATCH v1 wl-next 2/3] wifi: wext: Convert wireless_nlevent_work to per-netns work.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The next patch will namespacify wireless_nlevent_flush(), which is called
by wireless_nlevent_process() and two netdev notifiers.

As a preparation, let's convert wireless_nlevent_work to per-netns work.

Suggested-by: Johannes Berg <johannes.berg@xxxxxxxxx>
Link: https://lore.kernel.org/netdev/cd8045c03573a012f71a1afdcfb5d9c108b6fefa.camel@xxxxxxxxxxxxxxxx/
Signed-off-by: Kuniyuki Iwashima <kuniyu@xxxxxxxxxx>
---
 net/wireless/wext-core.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index bfc13e0d9883..4d7699135f46 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -346,6 +346,7 @@ static const int compat_event_type_size[] = {
 
 struct wext_net {
 	struct sk_buff_head nlevents;
+	struct work_struct nlevent_work;
 };
 
 static int wext_net_id;
@@ -391,11 +392,18 @@ static struct notifier_block wext_netdev_notifier = {
 	.notifier_call = wext_netdev_notifier_call,
 };
 
+/* Process events generated by the wireless layer or the driver. */
+static void wireless_nlevent_process(struct work_struct *work)
+{
+	wireless_nlevent_flush();
+}
+
 static int __net_init wext_pernet_init(struct net *net)
 {
 	struct wext_net *wnet = wext_net(net);
 
 	skb_queue_head_init(&wnet->nlevents);
+	INIT_WORK(&wnet->nlevent_work, wireless_nlevent_process);
 
 	return 0;
 }
@@ -405,6 +413,7 @@ static void __net_exit wext_pernet_exit(struct net *net)
 	struct wext_net *wnet = wext_net(net);
 
 	skb_queue_purge(&wnet->nlevents);
+	cancel_work_sync(&wnet->nlevent_work);
 }
 
 static struct pernet_operations wext_pernet_ops = {
@@ -429,14 +438,6 @@ static int __init wireless_nlevent_init(void)
 
 subsys_initcall(wireless_nlevent_init);
 
-/* Process events generated by the wireless layer or the driver. */
-static void wireless_nlevent_process(struct work_struct *work)
-{
-	wireless_nlevent_flush();
-}
-
-static DECLARE_WORK(wireless_nlevent_work, wireless_nlevent_process);
-
 static struct nlmsghdr *rtnetlink_ifinfo_prep(struct net_device *dev,
 					      struct sk_buff *skb)
 {
@@ -656,7 +657,7 @@ void wireless_send_event(struct net_device *	dev,
 #endif
 	wnet = wext_net(dev_net(dev));
 	skb_queue_tail(&wnet->nlevents, skb);
-	schedule_work(&wireless_nlevent_work);
+	schedule_work(&wnet->nlevent_work);
 }
 EXPORT_SYMBOL(wireless_send_event);
 
-- 
2.39.5 (Apple Git-154)





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux