Skip to content

Commit 409c3b0

Browse files
alexaringholtmann
authored andcommitted
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 <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent b7eec52 commit 409c3b0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

net/mac802154/tx.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ static void mac802154_xmit_worker(struct work_struct *work)
4949
struct wpan_xmit_cb *cb = container_of(work, struct wpan_xmit_cb, work);
5050
struct ieee802154_local *local = cb->local;
5151
struct sk_buff *skb = cb->skb;
52+
struct net_device *dev = skb->dev;
5253
int res;
5354

5455
rtnl_lock();
5556

5657
/* check if ifdown occurred while schedule */
57-
if (!netif_running(skb->dev))
58+
if (!netif_running(dev))
5859
goto err_tx;
5960

6061
res = local->ops->xmit_sync(&local->hw, skb);
@@ -63,6 +64,9 @@ static void mac802154_xmit_worker(struct work_struct *work)
6364

6465
ieee802154_xmit_complete(&local->hw, skb);
6566

67+
dev->stats.tx_packets++;
68+
dev->stats.tx_bytes += skb->len;
69+
6670
rtnl_unlock();
6771

6872
return;
@@ -72,13 +76,14 @@ static void mac802154_xmit_worker(struct work_struct *work)
7276
ieee802154_wake_queue(&local->hw);
7377
rtnl_unlock();
7478
kfree_skb(skb);
75-
netdev_dbg(skb->dev, "transmission failed\n");
79+
netdev_dbg(dev, "transmission failed\n");
7680
}
7781

7882
static netdev_tx_t
7983
mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
8084
{
8185
struct wpan_xmit_cb *cb = wpan_xmit_cb(skb);
86+
struct net_device *dev = skb->dev;
8287
int ret;
8388

8489
mac802154_monitors_rx(local, skb);
@@ -102,6 +107,9 @@ mac802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
102107
ieee802154_wake_queue(&local->hw);
103108
goto err_tx;
104109
}
110+
111+
dev->stats.tx_packets++;
112+
dev->stats.tx_bytes += skb->len;
105113
} else {
106114
INIT_WORK(&cb->work, mac802154_xmit_worker);
107115
cb->skb = skb;
@@ -122,8 +130,6 @@ netdev_tx_t mac802154_monitor_xmit(struct sk_buff *skb, struct net_device *dev)
122130
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
123131

124132
skb->skb_iif = dev->ifindex;
125-
dev->stats.tx_packets++;
126-
dev->stats.tx_bytes += skb->len;
127133

128134
return mac802154_tx(sdata->local, skb);
129135
}
@@ -141,8 +147,6 @@ netdev_tx_t mac802154_wpan_xmit(struct sk_buff *skb, struct net_device *dev)
141147
}
142148

143149
skb->skb_iif = dev->ifindex;
144-
dev->stats.tx_packets++;
145-
dev->stats.tx_bytes += skb->len;
146150

147151
return mac802154_tx(sdata->local, skb);
148152
}

0 commit comments

Comments
 (0)