diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-26 04:37:12 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-10-26 12:24:05 -0400 |
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 70fd22632cf6..fe105d42ef83 100644 --- a/net/mac802154/tx.c +++ b/net/mac802154/tx.c | |||
@@ -49,12 +49,13 @@ static void mac802154_xmit_worker(struct work_struct *work) | |||
49 | struct wpan_xmit_cb *cb = container_of(work, struct wpan_xmit_cb, work); | 49 | struct wpan_xmit_cb *cb = container_of(work, struct wpan_xmit_cb, work); |
50 | struct ieee802154_local *local = cb->local; | 50 | struct ieee802154_local *local = cb->local; |
51 | struct sk_buff *skb = cb->skb; | 51 | struct sk_buff *skb = cb->skb; |
52 | struct net_device *dev = skb->dev; | ||
52 | int res; | 53 | int res; |
53 | 54 | ||
54 | rtnl_lock(); | 55 | rtnl_lock(); |
55 | 56 | ||
56 | /* check if ifdown occurred while schedule */ | 57 | /* check if ifdown occurred while schedule */ |
57 | if (!netif_running(skb->dev)) | 58 | if (!netif_running(dev)) |
58 | goto err_tx; | 59 | goto err_tx; |
59 | 60 | ||
60 | res = local->ops->xmit_sync(&local->hw, skb); | 61 | res = local->ops->xmit_sync(&local->hw, skb); |
@@ -63,6 +64,9 @@ static void mac802154_xmit_worker(struct work_struct *work) | |||
63 | 64 | ||
64 | ieee802154_xmit_complete(&local->hw, skb); | 65 | ieee802154_xmit_complete(&local->hw, skb); |
65 | 66 | ||
67 | dev->stats.tx_packets++; | ||
68 | dev->stats.tx_bytes += skb->len; | ||
69 | |||
66 | rtnl_unlock(); | 70 | rtnl_unlock(); |
67 | 71 | ||
68 | return; | 72 | return; |
@@ -72,13 +76,14 @@ err_tx: | |||
72 | ieee802154_wake_queue(&local->hw); | 76 | ieee802154_wake_queue(&local->hw); |
73 | rtnl_unlock(); | 77 | rtnl_unlock(); |
74 | kfree_skb(skb); | 78 | kfree_skb(skb); |
75 | netdev_dbg(skb->dev, "transmission failed\n"); | 79 | netdev_dbg(dev, "transmission failed\n"); |
76 | } | 80 | } |
77 | 81 | ||
78 | static netdev_tx_t | 82 | static netdev_tx_t |
79 | mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb) | 83 | mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb) |
80 | { | 84 | { |
81 | struct wpan_xmit_cb *cb = wpan_xmit_cb(skb); | 85 | struct wpan_xmit_cb *cb = wpan_xmit_cb(skb); |
86 | struct net_device *dev = skb->dev; | ||
82 | int ret; | 87 | int ret; |
83 | 88 | ||
84 | mac802154_monitors_rx(local, skb); | 89 | mac802154_monitors_rx(local, skb); |
@@ -102,6 +107,9 @@ mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb) | |||
102 | ieee802154_wake_queue(&local->hw); | 107 | ieee802154_wake_queue(&local->hw); |
103 | goto err_tx; | 108 | goto err_tx; |
104 | } | 109 | } |
110 | |||
111 | dev->stats.tx_packets++; | ||
112 | dev->stats.tx_bytes += skb->len; | ||
105 | } else { | 113 | } else { |
106 | INIT_WORK(&cb->work, mac802154_xmit_worker); | 114 | INIT_WORK(&cb->work, mac802154_xmit_worker); |
107 | cb->skb = skb; | 115 | cb->skb = skb; |
@@ -122,8 +130,6 @@ netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, struct net_device *dev) | |||
122 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); | 130 | struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); |
123 | 131 | ||
124 | skb->skb_iif = dev->ifindex; | 132 | skb->skb_iif = dev->ifindex; |
125 | dev->stats.tx_packets++; | ||
126 | dev->stats.tx_bytes += skb->len; | ||
127 | 133 | ||
128 | return mac802154_tx(sdata->local, skb); | 134 | return mac802154_tx(sdata->local, skb); |
129 | } | 135 | } |
@@ -141,8 +147,6 @@ netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev) | |||
141 | } | 147 | } |
142 | 148 | ||
143 | skb->skb_iif = dev->ifindex; | 149 | skb->skb_iif = dev->ifindex; |
144 | dev->stats.tx_packets++; | ||
145 | dev->stats.tx_bytes += skb->len; | ||
146 | 150 | ||
147 | return mac802154_tx(sdata->local, skb); | 151 | return mac802154_tx(sdata->local, skb); |
148 | } | 152 | } |