* [PATCH] mac80211: provide 64-bit traffic counters
@ 2013-02-05 9:56 Johannes Berg
2013-02-05 17:21 ` Ben Greear
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2013-02-05 9:56 UTC (permalink / raw)
To: linux-wireless; +Cc: qca_vkondrat, Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
"unsigned long" is already 64-bit on (most?) 64-bit
machines, use u64 and tell cfg80211 that we provide
64-bit counters now.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/cfg.c | 4 ++--
net/mac80211/ieee80211_i.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index f4f7e76..fb06d13 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -449,8 +449,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
sinfo->generation = sdata->local->sta_generation;
sinfo->filled = STATION_INFO_INACTIVE_TIME |
- STATION_INFO_RX_BYTES |
- STATION_INFO_TX_BYTES |
+ STATION_INFO_RX_BYTES64 |
+ STATION_INFO_TX_BYTES64 |
STATION_INFO_RX_PACKETS |
STATION_INFO_TX_PACKETS |
STATION_INFO_TX_RETRIES |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2b06ff1..4631de0 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -822,7 +822,7 @@ struct tpt_led_trigger {
unsigned int blink_table_len;
struct timer_list timer;
unsigned long prev_traffic;
- unsigned long tx_bytes, rx_bytes;
+ u64 tx_bytes, rx_bytes;
unsigned int active, want;
bool running;
};
--
1.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] mac80211: provide 64-bit traffic counters
2013-02-05 9:56 [PATCH] mac80211: provide 64-bit traffic counters Johannes Berg
@ 2013-02-05 17:21 ` Ben Greear
2013-02-05 17:24 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Ben Greear @ 2013-02-05 17:21 UTC (permalink / raw)
To: Johannes Berg; +Cc: linux-wireless, qca_vkondrat, Johannes Berg
On 02/05/2013 01:56 AM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> "unsigned long" is already 64-bit on (most?) 64-bit
> machines, use u64 and tell cfg80211 that we provide
> 64-bit counters now.
From what I can tell, these counters are modified using
+= operators. From what I recall, this is non-atomic on
32-bit systems when the variable is u64.
Is there any other locking that keeps this from blowing up?
Thanks,
Ben
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mac80211: provide 64-bit traffic counters
2013-02-05 17:21 ` Ben Greear
@ 2013-02-05 17:24 ` Johannes Berg
0 siblings, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2013-02-05 17:24 UTC (permalink / raw)
To: Ben Greear; +Cc: linux-wireless, qca_vkondrat
On Tue, 2013-02-05 at 09:21 -0800, Ben Greear wrote:
> On 02/05/2013 01:56 AM, Johannes Berg wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> >
> > "unsigned long" is already 64-bit on (most?) 64-bit
> > machines, use u64 and tell cfg80211 that we provide
> > 64-bit counters now.
>
> From what I can tell, these counters are modified using
> += operators. From what I recall, this is non-atomic on
> 32-bit systems when the variable is u64.
>
> Is there any other locking that keeps this from blowing up?
Funny you should ask this, we were discussing RX locking in another
thread :-)
In any case, it's *already* non-atomic since incrementing is always a
read-modify-write cycle, and I think that updates can indeed get lost
for the TX counter (and only it) if frames for multiple ACs are
processed at the same time. The proper way to solve that would probably
be having counters for all ACs and summing them only when needed.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-02-05 17:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 9:56 [PATCH] mac80211: provide 64-bit traffic counters Johannes Berg
2013-02-05 17:21 ` Ben Greear
2013-02-05 17:24 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox