summaryrefslogtreecommitdiff
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2015-04-22 18:10:38 +0300
committerJohannes Berg <johannes.berg@intel.com>2015-04-24 12:16:11 +0300
commit5a490510ba5fce8a10746525357a297f8f076bb1 (patch)
tree773e774dd117374a2014c72b6a372b44e5626e9b /net/mac80211/tx.c
parentce5b071a456beea13a893fcc73f47998bf7ceb35 (diff)
downloadlinux-5a490510ba5fce8a10746525357a297f8f076bb1.tar.xz
mac80211: use per-CPU TX/RX statistics
This isn't all that relevant for RX right now, but TX can be concurrent due to multi-queue and the accounting is therefore broken. Use the standard per-CPU statistics to avoid this. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 83e3261dbf67..745fdf5c2722 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -37,6 +37,16 @@
/* misc utils */
+static inline void ieee80211_tx_stats(struct net_device *dev, u32 len)
+{
+ struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats);
+
+ u64_stats_update_begin(&tstats->syncp);
+ tstats->tx_packets++;
+ tstats->tx_bytes += len;
+ u64_stats_update_end(&tstats->syncp);
+}
+
static __le16 ieee80211_duration(struct ieee80211_tx_data *tx,
struct sk_buff *skb, int group_addr,
int next_frag_len)
@@ -2727,8 +2737,7 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
return true;
}
- dev->stats.tx_packets++;
- dev->stats.tx_bytes += skb->len + extra_head;
+ ieee80211_tx_stats(dev, skb->len + extra_head);
/* will not be crypto-handled beyond what we do here, so use false
* as the may-encrypt argument for the resize to not account for
@@ -2909,8 +2918,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb,
if (IS_ERR(skb))
goto out;
- dev->stats.tx_packets++;
- dev->stats.tx_bytes += skb->len;
+ ieee80211_tx_stats(dev, skb->len);
ieee80211_xmit(sdata, sta, skb);
}