Commit c20851035126cc1d97c337083f98b797eed155a3
Committed by
Marcel Holtmann
1 parent
dc67c6b30f
Exists in
ti-lsk-linux-4.1.y
and in
10 other branches
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>
Showing 3 changed files with 60 additions and 1 deletions Side-by-side Diff
include/net/mac802154.h
... | ... | @@ -190,5 +190,9 @@ |
190 | 190 | void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb, |
191 | 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 | 197 | #endif /* NET_MAC802154_H */ |
net/mac802154/Makefile
net/mac802154/util.c
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); |