diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-26 04:37:05 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-26 12:24:03 -0400 |
commit | c20851035126cc1d97c337083f98b797eed155a3 (patch) | |
tree | 0580380e6c0925649e795b1821b483f65b87901c | |
parent | dc67c6b30f36d57b70b70547a30e7a8432540c6f (diff) |
mac802154: add netdev qeue helpers
This patch adds a new file net/mac802154/util.c which contains utility
functions for drivers, etc. This file contains functions to start and
stop queues for all virtual interfaces, this is useful for asynchronous
handling by driver level.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | include/net/mac802154.h | 4 | ||||
-rw-r--r-- | net/mac802154/Makefile | 2 | ||||
-rw-r--r-- | net/mac802154/util.c | 55 |
3 files changed, 60 insertions, 1 deletions
diff --git a/include/net/mac802154.h b/include/net/mac802154.h index ba8ddff70bb6..29af5c346ebf 100644 --- a/include/net/mac802154.h +++ b/include/net/mac802154.h | |||
@@ -190,4 +190,8 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw); | |||
190 | void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, | 190 | void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, |
191 | u8 lqi); | 191 | u8 lqi); |
192 | 192 | ||
193 | void ieee802154_wake_queue(struct ieee802154_hw *hw); | ||
194 | void ieee802154_stop_queue(struct ieee802154_hw *hw); | ||
195 | void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb); | ||
196 | |||
193 | #endif /* NET_MAC802154_H */ | 197 | #endif /* NET_MAC802154_H */ |
diff --git a/net/mac802154/Makefile b/net/mac802154/Makefile index 203f42d511af..e68debaf2a59 100644 --- a/net/mac802154/Makefile +++ b/net/mac802154/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-$(CONFIG_MAC802154) += mac802154.o | 1 | obj-$(CONFIG_MAC802154) += mac802154.o |
2 | mac802154-objs := main.o rx.o tx.o mac_cmd.o mib.o \ | 2 | mac802154-objs := main.o rx.o tx.o mac_cmd.o mib.o \ |
3 | monitor.o iface.o llsec.o | 3 | monitor.o iface.o llsec.o util.o |
4 | 4 | ||
5 | ccflags-y += -D__CHECK_ENDIAN__ | 5 | ccflags-y += -D__CHECK_ENDIAN__ |
diff --git a/net/mac802154/util.c b/net/mac802154/util.c new file mode 100644 index 000000000000..117e4eff4ca8 --- /dev/null +++ b/net/mac802154/util.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /* This program is free software; you can redistribute it and/or modify | ||
2 | * it under the terms of the GNU General Public License version 2 | ||
3 | * as published by the Free Software Foundation. | ||
4 | * | ||
5 | * This program is distributed in the hope that it will be useful, | ||
6 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
7 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
8 | * GNU General Public License for more details. | ||
9 | * | ||
10 | * Authors: | ||
11 | * Alexander Aring <aar@pengutronix.de> | ||
12 | * | ||
13 | * Based on: net/mac80211/util.c | ||
14 | */ | ||
15 | |||
16 | #include "ieee802154_i.h" | ||
17 | |||
18 | void ieee802154_wake_queue(struct ieee802154_hw *hw) | ||
19 | { | ||
20 | struct ieee802154_local *local = hw_to_local(hw); | ||
21 | struct ieee802154_sub_if_data *sdata; | ||
22 | |||
23 | rcu_read_lock(); | ||
24 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | ||
25 | if (!sdata->dev) | ||
26 | continue; | ||
27 | |||
28 | netif_wake_queue(sdata->dev); | ||
29 | } | ||
30 | rcu_read_unlock(); | ||
31 | } | ||
32 | EXPORT_SYMBOL(ieee802154_wake_queue); | ||
33 | |||
34 | void ieee802154_stop_queue(struct ieee802154_hw *hw) | ||
35 | { | ||
36 | struct ieee802154_local *local = hw_to_local(hw); | ||
37 | struct ieee802154_sub_if_data *sdata; | ||
38 | |||
39 | rcu_read_lock(); | ||
40 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { | ||
41 | if (!sdata->dev) | ||
42 | continue; | ||
43 | |||
44 | netif_stop_queue(sdata->dev); | ||
45 | } | ||
46 | rcu_read_unlock(); | ||
47 | } | ||
48 | EXPORT_SYMBOL(ieee802154_stop_queue); | ||
49 | |||
50 | void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb) | ||
51 | { | ||
52 | ieee802154_wake_queue(hw); | ||
53 | consume_skb(skb); | ||
54 | } | ||
55 | EXPORT_SYMBOL(ieee802154_xmit_complete); | ||