diff options
author | Johannes Berg <johannes.berg@intel.com> | 2015-04-22 17:10:38 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-04-24 11:16:11 +0200 |
commit | 5a490510ba5fce8a10746525357a297f8f076bb1 (patch) | |
tree | 773e774dd117374a2014c72b6a372b44e5626e9b /net/mac80211/rx.c | |
parent | ce5b071a456beea13a893fcc73f47998bf7ceb35 (diff) |
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/rx.c')
-rw-r--r-- | net/mac80211/rx.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c index 11dbbc576491..b69a071d7679 100644 --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -32,6 +32,16 @@ #include "wme.h" #include "rate.h" +static inline void ieee80211_rx_stats(struct net_device *dev, u32 len) +{ + struct pcpu_sw_netstats *tstats = this_cpu_ptr(dev->tstats); + + u64_stats_update_begin(&tstats->syncp); + tstats->rx_packets++; + tstats->rx_bytes += len; + u64_stats_update_end(&tstats->syncp); +} + /* * monitor mode reception * @@ -529,8 +539,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb, } prev_dev = sdata->dev; - sdata->dev->stats.rx_packets++; - sdata->dev->stats.rx_bytes += skb->len; + ieee80211_rx_stats(sdata->dev, skb->len); } if (prev_dev) { @@ -2036,12 +2045,11 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx) struct ethhdr *ehdr = (struct ethhdr *) rx->skb->data; struct sta_info *dsta; - dev->stats.rx_packets++; - dev->stats.rx_bytes += rx->skb->len; - skb = rx->skb; xmit_skb = NULL; + ieee80211_rx_stats(dev, skb->len); + if ((sdata->vif.type == NL80211_IFTYPE_AP || sdata->vif.type == NL80211_IFTYPE_AP_VLAN) && !(sdata->flags & IEEE80211_SDATA_DONT_BRIDGE_PACKETS) && @@ -3045,8 +3053,7 @@ static void ieee80211_rx_cooked_monitor(struct ieee80211_rx_data *rx, } prev_dev = sdata->dev; - sdata->dev->stats.rx_packets++; - sdata->dev->stats.rx_bytes += skb->len; + ieee80211_rx_stats(sdata->dev, skb->len); } if (prev_dev) { |