From owner-freebsd-wireless@freebsd.org Wed Sep 16 23:01:08 2020 Return-Path: Delivered-To: freebsd-wireless@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 264623F3FDC for ; Wed, 16 Sep 2020 23:01:08 +0000 (UTC) (envelope-from james.wright@digital-chaos.com) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BsFvQ6QB1z4QMC for ; Wed, 16 Sep 2020 23:01:06 +0000 (UTC) (envelope-from james.wright@digital-chaos.com) Received: from [192.168.0.12] ([82.29.153.121]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.179]) with ESMTPSA (Nemesis) id 1MZCOl-1jx2p70Z7p-00V6AQ; Thu, 17 Sep 2020 01:01:04 +0200 Subject: Re: Edimax EW-7811Un (rtwn): Slow speeds / rate control To: Adrian Chadd Cc: "freebsd-wireless@freebsd.org" References: <31c36c34-f1aa-3d4d-ccd3-3d76dc9bf69e@digital-chaos.com> From: James Wright Message-ID: <30d8d0ee-482e-bf82-4594-d4f704720ecd@digital-chaos.com> Date: Thu, 17 Sep 2020 00:01:05 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:aXaZsvU2oOZ2qxF9+Ujg/K9+0G1/kMpeY4iiF8p4MHa5QELcwev QM4VpPDzg/UKz8KHJEs8zmkylm6qy3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Uwz+1cS3bYNXvg== X-Rspamd-Queue-Id: 4BsFvQ6QB1z4QMC X-Spamd-Bar: + Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of james.wright@digital-chaos.com has no SPF policy when checking 217.72.192.75) smtp.mailfrom=james.wright@digital-chaos.com X-Spamd-Result: default: False [1.55 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FREEMAIL_TO(0.00)[gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[82.29.153.121:received]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8560, ipnet:217.72.192.0/20, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; NEURAL_SPAM_SHORT(0.36)[0.356]; NEURAL_HAM_LONG(-0.08)[-0.077]; TAGGED_RCPT(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[digital-chaos.com]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(0.37)[0.368]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[217.72.192.75:from]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[217.72.192.75:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-wireless] X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2020 23:01:08 -0000 This build is from stable/12 rather than HEAD, so it may not be broken there, if that's any help. On 16/09/2020 23:50, Adrian Chadd wrote: > Hi! > > Dang, ok. Well, rtwn was broken on freebsd-head due to changes elsewhere so we need to get those fixed before we can see > what's up with it. > > I'll post updates to freebsd-wireless if/when I figure it out. :P > > > > > -adrian > > > On Wed, 16 Sep 2020 at 15:43, James Wright > wrote: > > On 16/09/2020 22:36, Adrian Chadd wrote: > > > > > > On Wed, 16 Sep 2020 at 13:41, James Wright >> 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: 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 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 > > > >     % 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? > > > > > > 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 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 > > % 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 > >