These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / net / mac802154 / tx.c
index c62e956..3827f35 100644 (file)
 #include "ieee802154_i.h"
 #include "driver-ops.h"
 
-/* IEEE 802.15.4 transceivers can sleep during the xmit session, so process
- * packets through the workqueue.
- */
-struct ieee802154_xmit_cb {
-       struct sk_buff *skb;
-       struct work_struct work;
-       struct ieee802154_local *local;
-};
-
-static struct ieee802154_xmit_cb ieee802154_xmit_cb;
-
-static void ieee802154_xmit_worker(struct work_struct *work)
+void ieee802154_xmit_worker(struct work_struct *work)
 {
-       struct ieee802154_xmit_cb *cb =
-               container_of(work, struct ieee802154_xmit_cb, work);
-       struct ieee802154_local *local = cb->local;
-       struct sk_buff *skb = cb->skb;
+       struct ieee802154_local *local =
+               container_of(work, struct ieee802154_local, tx_work);
+       struct sk_buff *skb = local->tx_skb;
        struct net_device *dev = skb->dev;
        int res;
 
@@ -89,9 +77,6 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
                put_unaligned_le16(crc, skb_put(skb, 2));
        }
 
-       if (skb_cow_head(skb, local->hw.extra_tx_headroom))
-               goto err_tx;
-
        /* Stop the netif queue on each sub_if_data object. */
        ieee802154_stop_queue(&local->hw);
 
@@ -106,11 +91,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
                dev->stats.tx_packets++;
                dev->stats.tx_bytes += skb->len;
        } else {
-               INIT_WORK(&ieee802154_xmit_cb.work, ieee802154_xmit_worker);
-               ieee802154_xmit_cb.skb = skb;
-               ieee802154_xmit_cb.local = local;
-
-               queue_work(local->workqueue, &ieee802154_xmit_cb.work);
+               local->tx_skb = skb;
+               queue_work(local->workqueue, &local->tx_work);
        }
 
        return NETDEV_TX_OK;
@@ -136,6 +118,10 @@ ieee802154_subif_start_xmit(struct sk_buff *skb, struct net_device *dev)
        struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
        int rc;
 
+       /* TODO we should move it to wpan_dev_hard_header and dev_hard_header
+        * functions. The reason is wireshark will show a mac header which is
+        * with security fields but the payload is not encrypted.
+        */
        rc = mac802154_llsec_encrypt(&sdata->sec, skb);
        if (rc) {
                netdev_warn(dev, "encryption failed: %i\n", rc);