On 16/09/2020 22:36, Adrian Chadd wrote:


On Wed, 16 Sep 2020 at 13:41, James Wright <[email protected] 
<mailto:[email protected]>> wrote:

    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
    
<https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.1/FreeBSD-12.1-RELEASE-amd64-dvd1.isoFreeBSD-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?


hi!

You can experiment with limiting the unicast rate - eg ifconfig wlan0 ucastrate 
3 for MCS3 when it's in 11n mode.

AMRR isn't the best at all at 802.11n rate selection. It may just be 
over-estimating how great the channel is behaving.

However, that's just the transmit rate control. The remote end (ie the sender) is making choices on what rate to use when transmitting to you. So let's see if we can first limit bad choices (and thus taking up too much airtime) transmitting data BACK, and then we can figure out what's up with download speeds.



-adrian


Hi Adrian, thanks for your time and the explanation, much appreciated!

I tried setting ucastrate 3 and it made no difference to the download rate;

% 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
        ucastrate 3 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>

% 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%[                             ]   
8.87M  806KB/s    eta 81m 35s


_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-wireless
To unsubscribe, send any mail to "[email protected]"

Reply via email to