cfg80211: expand per-station byte counters to 64bit

In per-station statistics, present 32bit counters are too small
for practical purposes - with gigabit speeds, it get overlapped
every few seconds.

Expand counters in the struct station_info to be 64-bit.
Driver can still fill only 32-bit and indicate in @filled
only bits like STATION_INFO_[TR]X_BYTES; in case driver provides
full 64-bit counter, it should also set in @filled
bit STATION_INFO_[TR]RX_BYTES64

Netlink sends both 32-bit and 64-bit counters, if present, to not
break userspace.

Signed-off-by: Vladimir Kondratiev <[email protected]>
[change to also have 32-bit counters if driver advertises 64-bit]
Signed-off-by: Johannes Berg <[email protected]>
This commit is contained in:
Vladimir Kondratiev 2013-02-04 13:53:11 +02:00 • committed by Johannes Berg
commit 42745e0393
3 changed files with 25 additions and 7 deletions

View file

@ -3057,12 +3057,22 @@ static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq,
nla_put_u32(msg, NL80211_STA_INFO_INACTIVE_TIME,
sinfo->inactive_time))
goto nla_put_failure;
if ((sinfo->filled & STATION_INFO_RX_BYTES) &&
if ((sinfo->filled & (STATION_INFO_RX_BYTES |
STATION_INFO_RX_BYTES64)) &&
nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES,
(u32)sinfo->rx_bytes))
goto nla_put_failure;
if ((sinfo->filled & (STATION_INFO_TX_BYTES |
NL80211_STA_INFO_TX_BYTES64)) &&
nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES,
(u32)sinfo->tx_bytes))
goto nla_put_failure;
if ((sinfo->filled & STATION_INFO_RX_BYTES64) &&
nla_put_u64(msg, NL80211_STA_INFO_RX_BYTES64,
sinfo->rx_bytes))
goto nla_put_failure;
if ((sinfo->filled & STATION_INFO_TX_BYTES) &&
nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES,
if ((sinfo->filled & STATION_INFO_TX_BYTES64) &&
nla_put_u64(msg, NL80211_STA_INFO_TX_BYTES64,
sinfo->tx_bytes))
goto nla_put_failure;
if ((sinfo->filled & STATION_INFO_LLID) &&