All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Aring <alex.aring@gmail.com>
To: linux-wpan@vger.kernel.org
Cc: kernel@pengutronix.de, Alexander Aring <alex.aring@gmail.com>
Subject: [PATCH bluetooth-next 05/15] mac802154: add netdev qeue helpers
Date: Sun, 26 Oct 2014 09:15:42 +0100	[thread overview]
Message-ID: <1414311352-908-6-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1414311352-908-1-git-send-email-alex.aring@gmail.com>

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>
---
 include/net/mac802154.h |  4 ++++
 net/mac802154/Makefile  |  2 +-
 net/mac802154/util.c    | 55 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 60 insertions(+), 1 deletion(-)
 create mode 100644 net/mac802154/util.c

diff --git a/include/net/mac802154.h b/include/net/mac802154.h
index ba8ddff..29af5c3 100644
--- a/include/net/mac802154.h
+++ b/include/net/mac802154.h
@@ -190,4 +190,8 @@ void ieee802154_unregister_hw(struct ieee802154_hw *hw);
 void ieee802154_rx_irqsafe(struct ieee802154_hw *hw, struct sk_buff *skb,
 			   u8 lqi);
 
+void ieee802154_wake_queue(struct ieee802154_hw *hw);
+void ieee802154_stop_queue(struct ieee802154_hw *hw);
+void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb);
+
 #endif /* NET_MAC802154_H */
diff --git a/net/mac802154/Makefile b/net/mac802154/Makefile
index 203f42d..e68deba 100644
--- a/net/mac802154/Makefile
+++ b/net/mac802154/Makefile
@@ -1,5 +1,5 @@
 obj-$(CONFIG_MAC802154)	+= mac802154.o
 mac802154-objs		:= main.o rx.o tx.o mac_cmd.o mib.o \
-			   monitor.o iface.o llsec.o
+			   monitor.o iface.o llsec.o util.o
 
 ccflags-y += -D__CHECK_ENDIAN__
diff --git a/net/mac802154/util.c b/net/mac802154/util.c
new file mode 100644
index 0000000..117e4ef
--- /dev/null
+++ b/net/mac802154/util.c
@@ -0,0 +1,55 @@
+/* This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Authors:
+ * Alexander Aring <aar@pengutronix.de>
+ *
+ * Based on: net/mac80211/util.c
+ */
+
+#include "ieee802154_i.h"
+
+void ieee802154_wake_queue(struct ieee802154_hw *hw)
+{
+	struct ieee802154_local *local = hw_to_local(hw);
+	struct ieee802154_sub_if_data *sdata;
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+		if (!sdata->dev)
+			continue;
+
+		netif_wake_queue(sdata->dev);
+	}
+	rcu_read_unlock();
+}
+EXPORT_SYMBOL(ieee802154_wake_queue);
+
+void ieee802154_stop_queue(struct ieee802154_hw *hw)
+{
+	struct ieee802154_local *local = hw_to_local(hw);
+	struct ieee802154_sub_if_data *sdata;
+
+	rcu_read_lock();
+	list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+		if (!sdata->dev)
+			continue;
+
+		netif_stop_queue(sdata->dev);
+	}
+	rcu_read_unlock();
+}
+EXPORT_SYMBOL(ieee802154_stop_queue);
+
+void ieee802154_xmit_complete(struct ieee802154_hw *hw, struct sk_buff *skb)
+{
+	ieee802154_wake_queue(hw);
+	consume_skb(skb);
+}
+EXPORT_SYMBOL(ieee802154_xmit_complete);
-- 
2.1.2


  parent reply	other threads:[~2014-10-26  8:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-26  8:15 [PATCH bluetooth-next 00/15] ieee802154: rework transmit handling Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 01/15] mac802154: tx: move xmit callback to tx file Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 02/15] mac802154: tx: remove kmalloc in xmit hotpath Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 03/15] mac802154: tx: squash multiple dereferencing Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 04/15] mac802154: tx: remove xmit channel context switch Alexander Aring
2014-10-26  8:15 ` Alexander Aring [this message]
2014-10-26  8:15 ` [PATCH bluetooth-next 06/15] mac802154: tx: use queue helpers in xmit worker Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 07/15] mac802154: tx: fix error handling while xmit Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 08/15] mac802154: tx: add support for xmit_async callback Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 09/15] mac802154: tx: don't allow if down while sync tx Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 10/15] mac802154: tx: use netdev print helpers Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 11/15] mac802154: tx: cleanup crc calculation Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 12/15] mac802154: tx: move stats tx increment Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 13/15] mac802154: tx: change naming convention Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 14/15] mac802154: tx: add comment at sync xmit callback Alexander Aring
2014-10-26  8:25   ` Alexander Aring
2014-10-26  8:15 ` [PATCH bluetooth-next 15/15] at86rf230: asynchronous xmit handling Alexander Aring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1414311352-908-6-git-send-email-alex.aring@gmail.com \
    --to=alex.aring@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-wpan@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.