Thursday, December 31, 2020

Re: Getting wifi bitrate

On Thu, Dec 31, 2020 at 04:13:56PM +0000, Björn Gohla wrote:
>
> Stefan Sperling writes:
>
> > On Thu, Dec 31, 2020 at 02:28:35PM +0000, Björn Gohla wrote:
> >> Hi all,
> [...]
> >> So how do I get the it? Am I looking in the wrong place, or does the
> >> driver just not expose this information?
> >
> > Rate/MCS + channel width + some other parameters map to a Tx bitrate:
> > https://en.wikipedia.org/wiki/IEEE_802.11n-2009#Data_rates
> >
> > This Tx bitrate will vary on a per-frame basis, though. And actual user data
> > throughput is always below this, due to protocol overhead, re-transmissions,
> > interference, other traffic on the same channel, and so on.
>
> Right, so by using the values in that table one could extract a nominal
> Tx rate, but not the actual one (much less the Rx); correct?

Rx rates can only be observed with tcpdump -v -y IEEE802_11_RADIO -i urtwn0

> > In 11g mode the per-frame Tx rate is displayed by ifconfig in Mbit/s.
> > However, some realtek devices (like the 8192CU) perform Tx rate-adjustment
> > in firmware and do not even expose the chosen Tx data rate to the driver.
> > In that case ifconfig always displays 54M which is usually incorrect.
>
> ifconfig says this:
> urtwn0: flags=808843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF4> mtu 1500
> lladdr 54:2a:a2:4c:0e:b5
> index 8 priority 4 llprio 3
> groups: wlan egress
> media: IEEE802.11 autoselect (OFDM54 mode 11g)
> status: active
> ieee80211: join "451UnavailableForLegalReasons " chan 11 bssid b0:bb:e5:13:7b:d4 -72dBm wpakey wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher tkip
> inet 192.168.1.182 netmask 0xffffff00 broadcast 192.168.1.255
>
> I suppose the "media" line is what you're referring to here, right?

Yes.

> dmesg says:
> urtwn0 at uhub0 port 2 configuration 1 interface 0 "Realtek Wireless N Nano USB Adapter" rev 2.10/2.00 addr 2
> urtwn0: MAC/BB RTL8192EU, RF 6052 2T2R, address 54:2a:a2:4c:0e:b5
>
> the device looks similar to the one you mentioned, so maybe that's
> what's going on here.

On 8192EU devices the driver will adjust the Tx rate. If you send a lot
of traffic the displayed Tx rate should change while you change the
physical distance to your AP, for example.

> > What problem are you trying to solve?
>
> I just want to show the network activity in my desktop status line.

Understood, fair enough.
The chosen Tx rate is not a very reliable indicator of actual throughput
but it can serve as a wifi link quality indicator to some extent.

No comments:

Post a Comment