mac802154: tx: move xmit callback to tx file
authorAlexander Aring <alex.aring@gmail.com>
Sun, 26 Oct 2014 08:37:01 +0000 (09:37 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 26 Oct 2014 16:23:50 +0000 (17:23 +0100)
This patch moves the netdev xmit callback functions into the tx.c file.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/mac802154/ieee802154_i.h
net/mac802154/iface.c
net/mac802154/monitor.c
net/mac802154/tx.c

index 7aae6920fa3091431059fb8e8f389cfb37a2b4df..a9a9d8e1527821cc90f6bceec45e481321a2228f 100644 (file)
@@ -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);
index cdd661f0ef3f8b4bbda8a6280129988d0fda553c..f14e4365c4c76ecb0c57fbc423b98bb6c176ac86 100644 (file)
@@ -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,
index f8ea6dc8dda5324d063a58d8df33e45e1a17ee7f..cb9600bcca5101faf2cff25f64c5523264602831 100644 (file)
 
 #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;
index 2c40d9bb8387e5df03a536ac89fe3fc43b37a5e0..2eb06c2cf96ded6e508e5cb1045fabad6c4f3701 100644 (file)
@@ -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);
+}