util.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. #include "ieee802154_i.h"
  16. void ieee802154_wake_queue(struct ieee802154_hw *hw)
  17. {
  18. struct ieee802154_local *local = hw_to_local(hw);
  19. struct ieee802154_sub_if_data *sdata;
  20. rcu_read_lock();
  21. list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  22. if (!sdata->dev)
  23. continue;
  24. netif_wake_queue(sdata->dev);
  25. }
  26. rcu_read_unlock();
  27. }
  28. EXPORT_SYMBOL(ieee802154_wake_queue);
  29. void ieee802154_stop_queue(struct ieee802154_hw *hw)
  30. {
  31. struct ieee802154_local *local = hw_to_local(hw);
  32. struct ieee802154_sub_if_data *sdata;
  33. rcu_read_lock();
  34. list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  35. if (!sdata->dev)
  36. continue;
  37. netif_stop_queue(sdata->dev);
  38. }
  39. rcu_read_unlock();
  40. }
  41. EXPORT_SYMBOL(ieee802154_stop_queue);
  42. void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb)
  43. {
  44. ieee802154_wake_queue(hw);
  45. consume_skb(skb);
  46. }
  47. EXPORT_SYMBOL(ieee802154_xmit_complete);