f2fs: enable fast symlink by utilizing inline data
[linux/fpc-iii.git] / net / mac802154 / util.c
blob5fc979027919749a604a47bcd45148fbe5505f03
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.
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.
10 * Authors:
11 * Alexander Aring <aar@pengutronix.de>
13 * Based on: net/mac80211/util.c
16 #include "ieee802154_i.h"
18 /* privid for wpan_phys to determine whether they belong to us or not */
19 const void *const mac802154_wpan_phy_privid = &mac802154_wpan_phy_privid;
21 void ieee802154_wake_queue(struct ieee802154_hw *hw)
23 struct ieee802154_local *local = hw_to_local(hw);
24 struct ieee802154_sub_if_data *sdata;
26 rcu_read_lock();
27 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
28 if (!sdata->dev)
29 continue;
31 netif_wake_queue(sdata->dev);
33 rcu_read_unlock();
35 EXPORT_SYMBOL(ieee802154_wake_queue);
37 void ieee802154_stop_queue(struct ieee802154_hw *hw)
39 struct ieee802154_local *local = hw_to_local(hw);
40 struct ieee802154_sub_if_data *sdata;
42 rcu_read_lock();
43 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
44 if (!sdata->dev)
45 continue;
47 netif_stop_queue(sdata->dev);
49 rcu_read_unlock();
51 EXPORT_SYMBOL(ieee802154_stop_queue);
53 enum hrtimer_restart ieee802154_xmit_ifs_timer(struct hrtimer *timer)
55 struct ieee802154_local *local =
56 container_of(timer, struct ieee802154_local, ifs_timer);
58 ieee802154_wake_queue(&local->hw);
60 return HRTIMER_NORESTART;
63 void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb,
64 bool ifs_handling)
66 if (ifs_handling) {
67 struct ieee802154_local *local = hw_to_local(hw);
69 if (skb->len > 18)
70 hrtimer_start(&local->ifs_timer,
71 ktime_set(0, hw->phy->lifs_period * NSEC_PER_USEC),
72 HRTIMER_MODE_REL);
73 else
74 hrtimer_start(&local->ifs_timer,
75 ktime_set(0, hw->phy->sifs_period * NSEC_PER_USEC),
76 HRTIMER_MODE_REL);
78 consume_skb(skb);
79 } else {
80 ieee802154_wake_queue(hw);
81 consume_skb(skb);
84 EXPORT_SYMBOL(ieee802154_xmit_complete);