Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Sep 2020 21:41:53 +0100
From:      James Wright <james.wright@digital-chaos.com>
To:        freebsd-wireless@freebsd.org
Subject:   Edimax EW-7811Un (rtwn): Slow speeds / rate control
Message-ID:  <b76ded4d-135a-9e0f-d25e-44bcf664ddc2@digital-chaos.com>

next in thread | raw e-mail | index | archive | help
Hi wireless gurus,

    I'm trying to understand why this USB wifi dongle is so slow under FreeBSD.
The max real-world download rate seems to be capped at ~900KB/sec (see wget below),
but with exactly the same hardware and conditions under Win10 I reach ~3MB/sec.


OS:       FreeBSD 12.2-PRERELEASE (r365055)
Router:   Virgin Media SuperHub 3 (802.11a/b/g/n/ac)
Hardware: Edimax EW-7811Un (RTL8188CUS)
Driver:   rtwn

% grep wlan /etc/rc.conf
wlans_rtwn0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
create_args_wlan0="country GB

% dmesg | grep rtwn
rtwn0 on uhub0
rtwn0: <Realtek 802.11n WLAN Adapter, class 0/0, rev 2.00/2.00, addr 1> on usbus0
rtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R

% sysctl dev.rtwn
dev.rtwn.0.rx_buf_size: 24
dev.rtwn.0.ratectl_selected: 1
dev.rtwn.0.ratectl: 1
dev.rtwn.0.hwcrypto: 1
dev.rtwn.0.debug: 0
dev.rtwn.0.ht40: 0
dev.rtwn.0.%parent: uhub0
dev.rtwn.0.%pnpinfo: vendor=0x7392 product=0x7811 devclass=0x00 devsubclass=0x00 devproto=0x00 sernum="00e04c000001" 
release=0x0200 mode=host intclass=0xff intsubclass=0xff intprotocol=0xff
dev.rtwn.0.%location: bus=0 hubaddr=1 port=1 devaddr=2 interface=0 ugen=ugen0.2
dev.rtwn.0.%driver: rtwn
dev.rtwn.0.%desc: Realtek 802.11n WLAN Adapter, class 0/0, rev 2.00/2.00, addr 1
dev.rtwn.%parent:

% ifconfig wlan0
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
         ether 74:da:38:8b:e1:10
         inet 192.168.0.12 netmask 0xffffff00 broadcast 192.168.0.255
         groups: wlan
         ssid VM5909357 channel 6 (2437 MHz 11g ht/20) bssid c0:05:c2:57:8d:69
         regdomain ETSI country GB authmode WPA2/802.11i privacy ON
         deftxkey UNDEF AES-CCM 2:128-bit AES-CCM 3:128-bit txpower 30 bmiss 7
         scanvalid 60 protmode CTS ht20 ampdulimit 64k ampdudensity 8 shortgi
         -stbc -ldpc wme roaming MANUAL
         media: IEEE 802.11 Wireless Ethernet MCS mode 11ng
         status: associated
         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>

% ifconfig wlan0 scan
SSID/MESH ID                      BSSID              CHAN RATE    S:N     INT CAPS
VM5909357                         c0:05:c2:57:8d:69    6   54M  -78:-95   100 EPS  HTCAP WME ATH RSN

% ifconfig wlan0 list sta
ADDR               AID CHAN RATE RSSI IDLE  TXSEQ  RXSEQ CAPS FLAG
c0:05:c2:57:8d:69    1    6  65M 21.5    0  28562   4816 EPS  AQEHTRs HTCAP WME ATH RSN (rssi 0.0:0.0:0.0:0.0 nf 0:0:0:0)

% wget https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.1/FreeBSD-12.1-RELEASE-amd64-dvd1.iso
FreeBSD-12.1-RELEASE-amd64-dvd1.iso 0%[                                       ]  19.05M   947KB/s    eta 79m 18s


% wlandebug +rate
$ dmesg
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 6, txcnt=11, retrycnt=6
wlan0: [c0:05:c2:57:8d:69] AMRR decreasing rate 5 (txcnt=11 retrycnt=6)
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 5, txcnt=36, retrycnt=1
wlan0: [c0:05:c2:57:8d:69] AMRR increasing rate 6 (txcnt=36 retrycnt=1)
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 6, txcnt=37, retrycnt=7
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 6, txcnt=36, retrycnt=9
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 6, txcnt=36, retrycnt=2
wlan0: [c0:05:c2:57:8d:69] AMRR increasing rate 7 (txcnt=36 retrycnt=2)
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 7, txcnt=36, retrycnt=5
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 7, txcnt=36, retrycnt=5
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 7, txcnt=37, retrycnt=12
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 7, txcnt=36, retrycnt=7
wlan0: [c0:05:c2:57:8d:69] AMRR: current rate 7, txcnt=36, retrycnt=10

As you can see the MCS rate is being set by wlan_amrr to MCS 6 and 7, but the actual real-world download rate
remains firmly stuck at around ~900KB/sec (!)

Please could someone with knowledge of the FreebSD wifi stack help diagnose this problem with me?


Interestingly, if i disable ratectl in loader.conf, then i get a slightly higher capped rate of ~1.2MB/sec
but still much lower than what should be acheiveable from this network;

/boot/loader.conf;
if_rtwn_load="YES"
if_rtwn_usb_load="YES"
legal.realtek.license_ack=1
dev.rtwn.0.ratectl=0

% wget https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.1/FreeBSD-12.1-RELEASE-amd64-dvd1.iso
FreeBSD-12.1-RELEASE-amd64-dvd1.iso 0%[                                        ]  28.55M  1.18MB/s    eta 64m 6s


Many Tahnks,
James




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?b76ded4d-135a-9e0f-d25e-44bcf664ddc2>