From: Johannes Berg <johannes@sipsolutions.net>
To: Jouni Malinen <jouni.malinen@atheros.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org
Subject: Re: [PATCH] nl80211: Provide access to STA TX/RX packet counters
Date: Tue, 17 Feb 2009 12:33:32 +0100 [thread overview]
Message-ID: <1234870412.21343.4.camel@johannes.local> (raw)
In-Reply-To: <20090217112457.GA22926@jm.kir.nu>
[-- Attachment #1: Type: text/plain, Size: 4386 bytes --]
On Tue, 2009-02-17 at 13:24 +0200, Jouni Malinen wrote:
> The TX/RX packet counters are needed to fill in RADIUS Accounting
> attributes Acct-Output-Packets and Acct-Input-Packets. We already
> collect the needed information, but only the TX/RX bytes were
> previously exposed through nl80211. Allow applications to fetch the
> packet counters, too, to provide more complete support for accounting.
>
> Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> include/linux/nl80211.h | 5 +++++
> include/net/cfg80211.h | 8 ++++++++
> net/mac80211/cfg.c | 4 ++++
> net/wireless/nl80211.c | 6 ++++++
> 4 files changed, 23 insertions(+)
>
> --- uml.orig/include/linux/nl80211.h 2009-02-17 13:09:52.000000000 +0200
> +++ uml/include/linux/nl80211.h 2009-02-17 13:11:11.000000000 +0200
> @@ -526,6 +526,9 @@ enum nl80211_rate_info {
> * @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_sta_info_txrate.
> + * @NL80211_STA_INFO_RX_PACKETS: total received packet (u32, from this station)
> + * @NL80211_STA_INFO_TX_PACKETS: total transmitted packets (u32, to this
> + * station)
> */
> enum nl80211_sta_info {
> __NL80211_STA_INFO_INVALID,
> @@ -537,6 +540,8 @@ enum nl80211_sta_info {
> NL80211_STA_INFO_PLINK_STATE,
> NL80211_STA_INFO_SIGNAL,
> NL80211_STA_INFO_TX_BITRATE,
> + NL80211_STA_INFO_RX_PACKETS,
> + NL80211_STA_INFO_TX_PACKETS,
>
> /* keep last */
> __NL80211_STA_INFO_AFTER_LAST,
> --- uml.orig/include/net/cfg80211.h 2009-02-17 13:11:25.000000000 +0200
> +++ uml/include/net/cfg80211.h 2009-02-17 13:12:37.000000000 +0200
> @@ -178,6 +178,8 @@ struct station_parameters {
> * @STATION_INFO_SIGNAL: @signal filled
> * @STATION_INFO_TX_BITRATE: @tx_bitrate 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
> */
> enum station_info_flags {
> STATION_INFO_INACTIVE_TIME = 1<<0,
> @@ -188,6 +190,8 @@ enum station_info_flags {
> STATION_INFO_PLINK_STATE = 1<<5,
> STATION_INFO_SIGNAL = 1<<6,
> STATION_INFO_TX_BITRATE = 1<<7,
> + STATION_INFO_RX_PACKETS = 1<<8,
> + STATION_INFO_TX_PACKETS = 1<<9,
> };
>
> /**
> @@ -235,6 +239,8 @@ struct rate_info {
> * @plink_state: mesh peer link state
> * @signal: signal strength of last received packet in dBm
> * @txrate: current unicast bitrate to this station
> + * @rx_packets: packets received from this station
> + * @tx_packets: packets transmitted to this station
> */
> struct station_info {
> u32 filled;
> @@ -246,6 +252,8 @@ struct station_info {
> u8 plink_state;
> s8 signal;
> struct rate_info txrate;
> + u32 rx_packets;
> + u32 tx_packets;
> };
>
> /**
> --- uml.orig/net/mac80211/cfg.c 2009-02-17 13:13:59.000000000 +0200
> +++ uml/net/mac80211/cfg.c 2009-02-17 13:14:40.000000000 +0200
> @@ -341,11 +341,15 @@ static void sta_set_sinfo(struct sta_inf
> sinfo->filled = STATION_INFO_INACTIVE_TIME |
> STATION_INFO_RX_BYTES |
> STATION_INFO_TX_BYTES |
> + STATION_INFO_RX_PACKETS |
> + STATION_INFO_TX_PACKETS |
> STATION_INFO_TX_BITRATE;
>
> sinfo->inactive_time = jiffies_to_msecs(jiffies - sta->last_rx);
> sinfo->rx_bytes = sta->rx_bytes;
> sinfo->tx_bytes = sta->tx_bytes;
> + sinfo->rx_packets = sta->rx_packets;
> + sinfo->tx_packets = sta->tx_packets;
>
> if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
> sinfo->filled |= STATION_INFO_SIGNAL;
> --- uml.orig/net/wireless/nl80211.c 2009-02-17 13:12:55.000000000 +0200
> +++ uml/net/wireless/nl80211.c 2009-02-17 13:13:54.000000000 +0200
> @@ -1206,6 +1206,12 @@ static int nl80211_send_station(struct s
>
> nla_nest_end(msg, txrate);
> }
> + if (sinfo->filled & STATION_INFO_RX_PACKETS)
> + NLA_PUT_U32(msg, NL80211_STA_INFO_RX_PACKETS,
> + sinfo->rx_packets);
> + if (sinfo->filled & STATION_INFO_TX_PACKETS)
> + NLA_PUT_U32(msg, NL80211_STA_INFO_TX_PACKETS,
> + sinfo->tx_packets);
> nla_nest_end(msg, sinfoattr);
>
> return genlmsg_end(msg, hdr);
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2009-02-17 11:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-17 11:24 [PATCH] nl80211: Provide access to STA TX/RX packet counters Jouni Malinen
2009-02-17 11:33 ` Johannes Berg [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1234870412.21343.4.camel@johannes.local \
--to=johannes@sipsolutions.net \
--cc=jouni.malinen@atheros.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).