From: Johannes Berg <johannes@sipsolutions.net>
To: Vladimir Kondratiev <qca_vkondrat@qca.qualcomm.com>
Cc: "John W . Linville" <linville@tuxdriver.com>,
linux-wireless@vger.kernel.org,
"Luis R . Rodriguez" <rodrigue@qca.qualcomm.com>,
Kalle Valo <kvalo@qca.qualcomm.com>
Subject: Re: [PATCH 1/2] wireless: expand per-station byte counters to 64bit
Date: Mon, 04 Feb 2013 18:48:34 +0100 [thread overview]
Message-ID: <1360000114.17993.23.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1359992219.10311.16.camel@jlt4.sipsolutions.net> (sfid-20130204_163641_118159_6D181F12)
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
next prev parent reply other threads:[~2013-02-04 17:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
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=1360000114.17993.23.camel@jlt4.sipsolutions.net \
--to=johannes@sipsolutions.net \
--cc=kvalo@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=qca_vkondrat@qca.qualcomm.com \
--cc=rodrigue@qca.qualcomm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.