linux-wpan.vger.kernel.org archive mirror
 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 01/15] mac802154: tx: move xmit callback to tx file
Date: Sun, 26 Oct 2014 09:15:38 +0100	[thread overview]
Message-ID: <1414311352-908-2-git-send-email-alex.aring@gmail.com> (raw)
In-Reply-To: <1414311352-908-1-git-send-email-alex.aring@gmail.com>

This patch moves the netdev xmit callback functions into the tx.c file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
---
 net/mac802154/ieee802154_i.h |  5 ++--
 net/mac802154/iface.c        | 35 --------------------------
 net/mac802154/monitor.c      | 27 --------------------
 net/mac802154/tx.c           | 59 ++++++++++++++++++++++++++++++++++++++++++--
 4 files changed, 59 insertions(+), 67 deletions(-)

diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 7aae692..a9a9d8e 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -121,12 +121,11 @@ int mac802154_slave_close(struct net_device *dev);
 
 void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb);
 void mac802154_monitor_setup(struct net_device *dev);
+netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, struct net_device *dev);
 
 void mac802154_wpans_rx(struct ieee802154_local *local, struct sk_buff *skb);
 void mac802154_wpan_setup(struct net_device *dev);
-
-netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
-			 u8 page, u8 chan);
+netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev);
 
 /* MIB callbacks */
 void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val);
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index cdd661f..f14e436 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -307,41 +307,6 @@ mac802154_header_parse(const struct sk_buff *skb, unsigned char *haddr)
 	return sizeof(*addr);
 }
 
-static netdev_tx_t
-mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata;
-	u8 chan, page;
-	int rc;
-
-	sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-
-	spin_lock_bh(&sdata->mib_lock);
-	chan = sdata->chan;
-	page = sdata->page;
-	spin_unlock_bh(&sdata->mib_lock);
-
-	if (chan == MAC802154_CHAN_NONE ||
-	    page >= WPAN_NUM_PAGES ||
-	    chan >= WPAN_NUM_CHANNELS) {
-		kfree_skb(skb);
-		return NETDEV_TX_OK;
-	}
-
-	rc = mac802154_llsec_encrypt(&sdata->sec, skb);
-	if (rc) {
-		pr_warn("encryption failed: %i\n", rc);
-		kfree_skb(skb);
-		return NETDEV_TX_OK;
-	}
-
-	skb->skb_iif = dev->ifindex;
-	dev->stats.tx_packets++;
-	dev->stats.tx_bytes += skb->len;
-
-	return mac802154_tx(sdata->local, skb, page, chan);
-}
-
 static struct header_ops mac802154_header_ops = {
 	.create		= mac802154_header_create,
 	.parse		= mac802154_header_parse,
diff --git a/net/mac802154/monitor.c b/net/mac802154/monitor.c
index f8ea6dc..cb9600bcc 100644
--- a/net/mac802154/monitor.c
+++ b/net/mac802154/monitor.c
@@ -30,33 +30,6 @@
 
 #include "ieee802154_i.h"
 
-static netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb,
-					  struct net_device *dev)
-{
-	struct ieee802154_sub_if_data *sdata;
-	u8 chan, page;
-
-	sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-
-	/* FIXME: locking */
-	chan = sdata->local->phy->current_channel;
-	page = sdata->local->phy->current_page;
-
-	if (chan == MAC802154_CHAN_NONE) /* not initialized */
-		return NETDEV_TX_OK;
-
-	if (WARN_ON(page >= WPAN_NUM_PAGES) ||
-	    WARN_ON(chan >= WPAN_NUM_CHANNELS))
-		return NETDEV_TX_OK;
-
-	skb->skb_iif = dev->ifindex;
-	dev->stats.tx_packets++;
-	dev->stats.tx_bytes += skb->len;
-
-	return mac802154_tx(sdata->local, skb, page, chan);
-}
-
-
 void mac802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
 {
 	struct sk_buff *skb2;
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
index 2c40d9b..2eb06c2 100644
--- a/net/mac802154/tx.c
+++ b/net/mac802154/tx.c
@@ -77,8 +77,8 @@ out:
 	kfree(xw);
 }
 
-netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb,
-			 u8 page, u8 chan)
+static netdev_tx_t mac802154_tx(struct ieee802154_local *local,
+				struct sk_buff *skb, u8 page, u8 chan)
 {
 	struct xmit_work *work;
 	struct ieee802154_sub_if_data *sdata;
@@ -127,3 +127,58 @@ err_tx:
 	kfree_skb(skb);
 	return NETDEV_TX_OK;
 }
+
+netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	u8 chan, page;
+
+	/* FIXME: locking */
+	chan = sdata->local->phy->current_channel;
+	page = sdata->local->phy->current_page;
+
+	if (chan == MAC802154_CHAN_NONE) /* not initialized */
+		return NETDEV_TX_OK;
+
+	if (WARN_ON(page >= WPAN_NUM_PAGES) ||
+	    WARN_ON(chan >= WPAN_NUM_CHANNELS))
+		return NETDEV_TX_OK;
+
+	skb->skb_iif = dev->ifindex;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += skb->len;
+
+	return mac802154_tx(sdata->local, skb, page, chan);
+}
+
+netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+	u8 chan, page;
+	int rc;
+
+	spin_lock_bh(&sdata->mib_lock);
+	chan = sdata->chan;
+	page = sdata->page;
+	spin_unlock_bh(&sdata->mib_lock);
+
+	if (chan == MAC802154_CHAN_NONE ||
+	    page >= WPAN_NUM_PAGES ||
+	    chan >= WPAN_NUM_CHANNELS) {
+		kfree_skb(skb);
+		return NETDEV_TX_OK;
+	}
+
+	rc = mac802154_llsec_encrypt(&sdata->sec, skb);
+	if (rc) {
+		pr_warn("encryption failed: %i\n", rc);
+		kfree_skb(skb);
+		return NETDEV_TX_OK;
+	}
+
+	skb->skb_iif = dev->ifindex;
+	dev->stats.tx_packets++;
+	dev->stats.tx_bytes += skb->len;
+
+	return mac802154_tx(sdata->local, skb, page, chan);
+}
-- 
2.1.2


  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 ` Alexander Aring [this message]
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 ` [PATCH bluetooth-next 05/15] mac802154: add netdev qeue helpers Alexander Aring
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-2-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).