diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-26 09:37:12 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-26 17:24:05 +0100 |
commit | 409c3b0c5f030e36e9d6ca747dc3059eadde0cad (patch) | |
tree | 5bee1b2776453310941f76349c2660189b79570a /net/mac802154/tx.c | |
parent | b7eec52bcb7ab93a8cce0f718f42fa17d6d91745 (diff) |
mac802154: tx: move stats tx increment
This patch moves the stats increment of successful transmitted packets
in the right place when the skb was really successful transmitted.
Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/mac802154/tx.c')
-rw-r--r-- | net/mac802154/tx.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c index 70fd22632cf..fe105d42ef8 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c @@ -49,12 +49,13 @@ static void mac802154_xmit_worker(struct work_struct *work) struct wpan_xmit_cb *cb = container_of(work, struct wpan_xmit_cb, work); struct ieee802154_local *local = cb->local; struct sk_buff *skb = cb->skb; + struct net_device *dev = skb->dev; int res; rtnl_lock(); /* check if ifdown occurred while schedule */ - if (!netif_running(skb->dev)) + if (!netif_running(dev)) goto err_tx; res = local->ops->xmit_sync(&local->hw, skb); @@ -63,6 +64,9 @@ static void mac802154_xmit_worker(struct work_struct *work) ieee802154_xmit_complete(&local->hw, skb); + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; + rtnl_unlock(); return; @@ -72,13 +76,14 @@ err_tx: ieee802154_wake_queue(&local->hw); rtnl_unlock(); kfree_skb(skb); - netdev_dbg(skb->dev, "transmission failed\n"); + netdev_dbg(dev, "transmission failed\n"); } static netdev_tx_t mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb) { struct wpan_xmit_cb *cb = wpan_xmit_cb(skb); + struct net_device *dev = skb->dev; int ret; mac802154_monitors_rx(local, skb); @@ -102,6 +107,9 @@ mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb) ieee802154_wake_queue(&local->hw); goto err_tx; } + + dev->stats.tx_packets++; + dev->stats.tx_bytes += skb->len; } else { INIT_WORK(&cb->work, mac802154_xmit_worker); cb->skb = skb; @@ -122,8 +130,6 @@ 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); skb->skb_iif = dev->ifindex; - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; return mac802154_tx(sdata->local, skb); } @@ -141,8 +147,6 @@ netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) } skb->skb_iif = dev->ifindex; - dev->stats.tx_packets++; - dev->stats.tx_bytes += skb->len; return mac802154_tx(sdata->local, skb); } |