* [PATCH 0/2] 64-bit counters in the struct station_info @ 2013-02-04 11:53 Vladimir Kondratiev 2013-02-04 11:53 ` [PATCH 1/2] wireless: expand per-station byte counters to 64bit Vladimir Kondratiev 2013-02-04 11:53 ` [PATCH 2/2] ath6kl: provide 64-bit per-station byte counters Vladimir Kondratiev 0 siblings, 2 replies; 7+ messages in thread From: Vladimir Kondratiev @ 2013-02-04 11:53 UTC (permalink / raw) To: John W . Linville, Johannes Berg Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez, Kalle Valo patch 1 expands counters and patch 2 uses this 64-bit counters for the ath6kl - only easy to find driver with 64-bit counters. Vladimir Kondratiev (2): wireless: expand per-station byte counters to 64bit ath6kl: provide 64-bit per-station byte counters drivers/net/wireless/ath/ath6kl/cfg80211.c | 6 ++++-- include/net/cfg80211.h | 12 ++++++++---- include/uapi/linux/nl80211.h | 4 ++++ net/wireless/nl80211.c | 10 +++++++++- 4 files changed, 25 insertions(+), 7 deletions(-) -- 1.7.10.4 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] wireless: expand per-station byte counters to 64bit 2013-02-04 11:53 [PATCH 0/2] 64-bit counters in the struct station_info Vladimir Kondratiev @ 2013-02-04 11:53 ` Vladimir Kondratiev 2013-02-04 15:36 ` Johannes Berg 2013-02-04 11:53 ` [PATCH 2/2] ath6kl: provide 64-bit per-station byte counters Vladimir Kondratiev 1 sibling, 1 reply; 7+ messages in thread From: Vladimir Kondratiev @ 2013-02-04 11:53 UTC (permalink / raw) To: John W . Linville, Johannes Berg Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez, Kalle Valo 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 user space. Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> --- include/net/cfg80211.h | 12 ++++++++---- include/uapi/linux/nl80211.h | 4 ++++ net/wireless/nl80211.c | 10 +++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 36e076e..bcb6b70 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -672,8 +672,10 @@ struct station_parameters { * @STATION_INFO_SIGNAL: @signal filled * @STATION_INFO_TX_BITRATE: @txrate fields are filled * (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs) - * @STATION_INFO_RX_PACKETS: @rx_packets filled - * @STATION_INFO_TX_PACKETS: @tx_packets filled + * @STATION_INFO_RX_PACKETS: @rx_packets filled with 32-bit value + * @STATION_INFO_TX_PACKETS: @tx_packets filled with 32-bit value + * @STATION_INFO_RX_PACKETS64: @rx_packets filled with 64-bit value + * @STATION_INFO_TX_PACKETS64: @tx_packets filled with 64-bit value * @STATION_INFO_TX_RETRIES: @tx_retries filled * @STATION_INFO_TX_FAILED: @tx_failed filled * @STATION_INFO_RX_DROP_MISC: @rx_dropped_misc filled @@ -714,6 +716,8 @@ enum station_info_flags { STATION_INFO_LOCAL_PM = 1<<21, STATION_INFO_PEER_PM = 1<<22, STATION_INFO_NONPEER_PM = 1<<23, + STATION_INFO_RX_BYTES64 = 1<<24, + STATION_INFO_TX_BYTES64 = 1<<25, }; /** @@ -835,8 +839,8 @@ struct station_info { u32 filled; u32 connected_time; u32 inactive_time; - u32 rx_bytes; - u32 tx_bytes; + u64 rx_bytes; + u64 tx_bytes; u16 llid; u16 plid; u8 plink_state; diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 5b7dbc1..5c7d54c 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -1851,6 +1851,8 @@ enum nl80211_sta_bss_param { * @NL80211_STA_INFO_INACTIVE_TIME: time since last activity (u32, msecs) * @NL80211_STA_INFO_RX_BYTES: total received bytes (u32, from this station) * @NL80211_STA_INFO_TX_BYTES: total transmitted bytes (u32, to this station) + * @NL80211_STA_INFO_RX_BYTES64: total received bytes (u64, from this station) + * @NL80211_STA_INFO_TX_BYTES64: total transmitted bytes (u64, to this station) * @NL80211_STA_INFO_SIGNAL: signal strength of last received PPDU (u8, dBm) * @NL80211_STA_INFO_TX_BITRATE: current unicast tx rate, nested attribute * containing info as possible, see &enum nl80211_rate_info @@ -1903,6 +1905,8 @@ enum nl80211_sta_info { NL80211_STA_INFO_LOCAL_PM, NL80211_STA_INFO_PEER_PM, NL80211_STA_INFO_NONPEER_PM, + NL80211_STA_INFO_RX_BYTES64, + NL80211_STA_INFO_TX_BYTES64, /* keep last */ __NL80211_STA_INFO_AFTER_LAST, diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index b5978ab..b3a9c8e 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3059,10 +3059,18 @@ static int nl80211_send_station(struct sk_buff *msg, u32 portid, u32 seq, goto nla_put_failure; if ((sinfo->filled & STATION_INFO_RX_BYTES) && nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES, - sinfo->rx_bytes)) + (u32)sinfo->rx_bytes)) goto nla_put_failure; if ((sinfo->filled & STATION_INFO_TX_BYTES) && 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_BYTES64) && + nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES64, sinfo->tx_bytes)) goto nla_put_failure; if ((sinfo->filled & STATION_INFO_LLID) && -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] wireless: expand per-station byte counters to 64bit 2013-02-04 11:53 ` [PATCH 1/2] wireless: expand per-station byte counters to 64bit Vladimir Kondratiev @ 2013-02-04 15:36 ` Johannes Berg 2013-02-04 17:48 ` Johannes Berg 0 siblings, 1 reply; 7+ messages in thread From: Johannes Berg @ 2013-02-04 15:36 UTC (permalink / raw) To: Vladimir Kondratiev Cc: John W . Linville, linux-wireless, Luis R . Rodriguez, Kalle Valo On Mon, 2013-02-04 at 13:53 +0200, Vladimir Kondratiev wrote: > 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 Applied, but ... > Netlink sends both 32-bit and 64-bit counters, if present, to not break > user space. You didn't quite implement that, so I changed it: > + 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_RX_BYTES64) { + if (nla_put_u64(msg, NL80211_STA_INFO_RX_BYTES64, + sinfo->rx_bytes)) + goto nla_put_failure; + if (sinfo->rx_bytes <= UINT_MAX && + nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES, + (u32)sinfo->rx_bytes)) + goto nla_put_failure; + } + if (sinfo->filled & STATION_INFO_TX_BYTES64) { + if (nla_put_u64(msg, NL80211_STA_INFO_TX_BYTES64, + sinfo->tx_bytes)) + goto nla_put_failure; + if (sinfo->tx_bytes <= UINT_MAX && + nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES, + (u32)sinfo->tx_bytes)) + goto nla_put_failure; + } johannes ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] wireless: expand per-station byte counters to 64bit 2013-02-04 15:36 ` Johannes Berg @ 2013-02-04 17:48 ` Johannes Berg 0 siblings, 0 replies; 7+ messages in thread From: Johannes Berg @ 2013-02-04 17:48 UTC (permalink / raw) To: Vladimir Kondratiev Cc: John W . Linville, linux-wireless, Luis R . Rodriguez, Kalle Valo On Mon, 2013-02-04 at 16:36 +0100, Johannes Berg wrote: > > + 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_RX_BYTES64) { > + if (nla_put_u64(msg, NL80211_STA_INFO_RX_BYTES64, > + sinfo->rx_bytes)) > + goto nla_put_failure; > + if (sinfo->rx_bytes <= UINT_MAX && > + nla_put_u32(msg, NL80211_STA_INFO_RX_BYTES, > + (u32)sinfo->rx_bytes)) > + goto nla_put_failure; > + } > + if (sinfo->filled & STATION_INFO_TX_BYTES64) { > + if (nla_put_u64(msg, NL80211_STA_INFO_TX_BYTES64, > + sinfo->tx_bytes)) > + goto nla_put_failure; > + if (sinfo->tx_bytes <= UINT_MAX && > + nla_put_u32(msg, NL80211_STA_INFO_TX_BYTES, > + (u32)sinfo->tx_bytes)) > + goto nla_put_failure; > + } Ok Vladimir convinced me this was stupid because it breaks the current userspace API in a subtle way: right now, if it rolls over, we will get wrapped values in userspace, afterwards with a 64-bit compatible driver we won't get any 32-bit value ... I'll change it to this though, so drivers don't get this choice: - 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, - sinfo->rx_bytes)) + (u32)sinfo->rx_bytes)) goto nla_put_failure; - if ((sinfo->filled & STATION_INFO_TX_BYTES) && + 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_BYTES64) && + nla_put_u64(msg, NL80211_STA_INFO_TX_BYTES64, sinfo->tx_bytes)) goto nla_put_failure; IOW, always put the 32-bit value even if the driver said it had 64-bit, but then also give the 64-bit value to userspace. johannes ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] ath6kl: provide 64-bit per-station byte counters 2013-02-04 11:53 [PATCH 0/2] 64-bit counters in the struct station_info Vladimir Kondratiev 2013-02-04 11:53 ` [PATCH 1/2] wireless: expand per-station byte counters to 64bit Vladimir Kondratiev @ 2013-02-04 11:53 ` Vladimir Kondratiev 2013-02-05 9:48 ` [PATCH v2] " Vladimir Kondratiev 2013-03-05 7:20 ` [PATCH 2/2] " Kalle Valo 1 sibling, 2 replies; 7+ messages in thread From: Vladimir Kondratiev @ 2013-02-04 11:53 UTC (permalink / raw) To: John W . Linville, Johannes Berg Cc: Vladimir Kondratiev, linux-wireless, Luis R . Rodriguez, Kalle Valo Internally, 64-bit byte counters maintained for per-station statistics. Tell to the netlink that full 64-bit value provided Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 4225cca..90b1a93 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -1778,14 +1778,16 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, if (vif->target_stats.rx_byte) { sinfo->rx_bytes = vif->target_stats.rx_byte; - sinfo->filled |= STATION_INFO_RX_BYTES; + sinfo->filled |= STATION_INFO_RX_BYTES | + STATION_INFO_RX_BYTES64; sinfo->rx_packets = vif->target_stats.rx_pkt; sinfo->filled |= STATION_INFO_RX_PACKETS; } if (vif->target_stats.tx_byte) { sinfo->tx_bytes = vif->target_stats.tx_byte; - sinfo->filled |= STATION_INFO_TX_BYTES; + sinfo->filled |= STATION_INFO_TX_BYTES | + STATION_INFO_TX_BYTES64; sinfo->tx_packets = vif->target_stats.tx_pkt; sinfo->filled |= STATION_INFO_TX_PACKETS; } -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] ath6kl: provide 64-bit per-station byte counters 2013-02-04 11:53 ` [PATCH 2/2] ath6kl: provide 64-bit per-station byte counters Vladimir Kondratiev @ 2013-02-05 9:48 ` Vladimir Kondratiev 2013-03-05 7:20 ` [PATCH 2/2] " Kalle Valo 1 sibling, 0 replies; 7+ messages in thread From: Vladimir Kondratiev @ 2013-02-05 9:48 UTC (permalink / raw) To: John W . Linville Cc: Johannes Berg, linux-wireless, Luis R . Rodriguez, Kalle Valo On Monday, February 04, 2013 01:53:12 PM Vladimir Kondratiev wrote: > Internally, 64-bit byte counters maintained for per-station > statistics. Tell to the netlink that full 64-bit value provided > > Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> > --- With changes by Johannes, this patch need to be updated. It becomes a bit smaller :) Patch follows. Please use this one. >From 9cdc3aa790fb469ae60671796b2391465d5640c4 Mon Sep 17 00:00:00 2001 From: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> Date: Tue, 5 Feb 2013 11:44:48 +0200 Subject: [PATCH] ath6kl: provide 64-bit per-station byte counters Internally, 64-bit byte counters maintained for per-station statistics. Tell to the netlink that full 64-bit value provided Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> --- drivers/net/wireless/ath/ath6kl/cfg80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c index 4225cca..259c433 100644 --- a/drivers/net/wireless/ath/ath6kl/cfg80211.c +++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c @@ -1778,14 +1778,14 @@ static int ath6kl_get_station(struct wiphy *wiphy, struct net_device *dev, if (vif->target_stats.rx_byte) { sinfo->rx_bytes = vif->target_stats.rx_byte; - sinfo->filled |= STATION_INFO_RX_BYTES; + sinfo->filled |= STATION_INFO_RX_BYTES64; sinfo->rx_packets = vif->target_stats.rx_pkt; sinfo->filled |= STATION_INFO_RX_PACKETS; } if (vif->target_stats.tx_byte) { sinfo->tx_bytes = vif->target_stats.tx_byte; - sinfo->filled |= STATION_INFO_TX_BYTES; + sinfo->filled |= STATION_INFO_TX_BYTES64; sinfo->tx_packets = vif->target_stats.tx_pkt; sinfo->filled |= STATION_INFO_TX_PACKETS; } -- 1.7.10.4 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] ath6kl: provide 64-bit per-station byte counters 2013-02-04 11:53 ` [PATCH 2/2] ath6kl: provide 64-bit per-station byte counters Vladimir Kondratiev 2013-02-05 9:48 ` [PATCH v2] " Vladimir Kondratiev @ 2013-03-05 7:20 ` Kalle Valo 1 sibling, 0 replies; 7+ messages in thread From: Kalle Valo @ 2013-03-05 7:20 UTC (permalink / raw) To: Vladimir Kondratiev Cc: John W . Linville, Johannes Berg, linux-wireless, Luis R . Rodriguez, ath6kl-devel Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> writes: > Internally, 64-bit byte counters maintained for per-station > statistics. Tell to the netlink that full 64-bit value provided > > Signed-off-by: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com> John already applied this patch so I can skip it. -- Kalle Valo ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-03-05 7:20 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-02-04 11:53 [PATCH 0/2] 64-bit counters in the struct station_info Vladimir Kondratiev 2013-02-04 11:53 ` [PATCH 1/2] wireless: expand per-station byte counters to 64bit Vladimir Kondratiev 2013-02-04 15:36 ` Johannes Berg 2013-02-04 17:48 ` Johannes Berg 2013-02-04 11:53 ` [PATCH 2/2] ath6kl: provide 64-bit per-station byte counters Vladimir Kondratiev 2013-02-05 9:48 ` [PATCH v2] " Vladimir Kondratiev 2013-03-05 7:20 ` [PATCH 2/2] " Kalle Valo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox