From owner-freebsd-wireless@freebsd.org Wed Sep 16 22:50:35 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 806433F4126 for ; Wed, 16 Sep 2020 22:50:35 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BsFgG4w6nz4P71 for ; Wed, 16 Sep 2020 22:50:34 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-qk1-x744.google.com with SMTP id 16so278503qkf.4 for ; Wed, 16 Sep 2020 15:50:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0tn8t16nCAJEsWENIeCUeOvwC6WY5oZohxw2Ig5EXus=; b=kwHfVpUYhm28GgjqmiayFDXnjxq1buAeK1eTR8AzvyYRyC5HuQxSW5JPtVnmwjjTz6 PyXeNY9aUdtXrVuzTd1U3eJaoni2GgXt4d5L8tVDu1HMbDi1BqO/0xwuj2AL3LTvtZre pXDIZ0pbdka/HjB21Vzp3f/IdKlJCNbxalxiTGtSpUeZoIAacTTptyaS/YPxloTbnEp+ XBK85gENPBUFXYQQFI+h8tIre/3nM85yCIHTRI8MK/XaNtuTg2GhH7n99OqevnGDbpfe sgZ+aNlg3lRsA8tiyuzDxF2LC0yrEidLcaBE70B4dNUkpybJgQLgRAcd7EL/VtXpidnk r+Uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0tn8t16nCAJEsWENIeCUeOvwC6WY5oZohxw2Ig5EXus=; b=ZLui6NodK4pIRIjFMufX/NLHzsqUOwZ6DsIa3jK6/ShKFFegkCxwJkX7kd4CFnpFR9 5u1uHU1SAHYct6gA4iru4Q+wZiS9r1Cm+3HRI2CB0bcJr2nIr3dW1Cnqj9ntR9whB2pf lazA3jPb0n+EBQ7vTjeC55Zld/mWy9d4tldAARe1+wux92lWxYNQVvA3fYhuY2c1aXgT 3VcrdNBoNEFKJO1E2OnD55sbkMO5xA8mxMdoL5h2I28o1CgMwkT4FXyOoE77gJASObHS 0+p8yLtUqhFAajlWQGI7/bU0TkfTfBdWaHeANA/jula+Ky9fJUFu96M4Mm50xkTBNKkZ 9EKQ== X-Gm-Message-State: AOAM530uTZHZX213mWUw2xF1d65dOF4Rv15kZPU2YeJr/4egrg5iFGg6 6D+ULLaTpyQB2fwiR0yUTRTmQB+5BnxAkiHF2Y9HGYh0FXw= X-Google-Smtp-Source: ABdhPJzBlGa8pRyORN9VfkxYK6uS9yYFgJ+P+api98VAci2dze2b44LkJO23g2hPYWaTyLOZjLZlM9OY1A6nBYiGccY= X-Received: by 2002:a37:67d2:: with SMTP id b201mr25044313qkc.96.1600296634020; Wed, 16 Sep 2020 15:50:34 -0700 (PDT) MIME-Version: 1.0 References: <31c36c34-f1aa-3d4d-ccd3-3d76dc9bf69e@digital-chaos.com> In-Reply-To: <31c36c34-f1aa-3d4d-ccd3-3d76dc9bf69e@digital-chaos.com> From: Adrian Chadd Date: Wed, 16 Sep 2020 15:50:21 -0700 Message-ID: Subject: Re: Edimax EW-7811Un (rtwn): Slow speeds / rate control To: James Wright Cc: "freebsd-wireless@freebsd.org" X-Rspamd-Queue-Id: 4BsFgG4w6nz4P71 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=kwHfVpUY; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of adrianchadd@gmail.com designates 2607:f8b0:4864:20::744 as permitted sender) smtp.mailfrom=adrianchadd@gmail.com X-Spamd-Result: default: False [-3.34 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.39)[-0.390]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.966]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-0.98)[-0.982]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-wireless@freebsd.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::744:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-wireless] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 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 22:50:35 -0000 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 < > james.wright@digital-chaos.com > > 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: 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 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 > > < > 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 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 > > >