Bug 199718

Summary: [patch] urtwn(4): poor performance on rtl8188eu devices
Product: Base System Reporter: mp39590
Component: wirelessAssignee: freebsd-wireless (Nobody) <wireless>
Status: Closed FIXED    
Severity: Affects Only Me CC: kevlo
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description mp39590 2015-04-26 19:22:57 UTC
Created attachment 156016 [details]
patch

r264912[1] brought initial support of rtl8188eu chips into FreeBSD, it was noted by OpenBSD developers during porting efforts that it has bad performance compared to other urtwn chips.

The problem seem to be in the way the driver initialize aggregation mode: in native linux implementation USB aggregation is disabled[2] if RX DMA one is used (and it's actually used for 88 chips[3]), in FreeBSD both methods are enabled unconditionally.

Attached patch boosts performance for about 10 times for me.

Please review and commit if appropriate.

[1] - https://svnweb.freebsd.org/base?view=revision&revision=264912
[2] - https://github.com/lwfinger/rtl8188eu/blob/master/hal/usb_halinit.c#L524
[3] - https://github.com/lwfinger/rtl8188eu/blob/master/hal/usb_halinit.c#L95
Comment 1 Kevin Lo freebsd_committer freebsd_triage 2015-04-27 15:34:03 UTC
I'm not surprised. :)  As I mentioned that issue on current@:
http://lists.freebsd.org/pipermail/freebsd-current/2014-April/049562.html

Like RTL8192CUS, RTL8188EU chips could support both dma and aggregation
modes.  It seems that initializing rate adaptation and descriptors setting
are incorrect.  I'll investigate further, thanks.
Comment 2 commit-hook freebsd_committer freebsd_triage 2015-04-30 02:47:34 UTC
A commit references this bug:

Author: kevlo
Date: Thu Apr 30 02:47:22 UTC 2015
New revision: 282266
URL: https://svnweb.freebsd.org/changeset/base/282266

Log:
  - Disable usb aggregation mode by default since it boots performance
  - Minor tweak

  PR:	199718
  Submitted by:	Mikhail <mp39590 at gmail dot com>

Changes:
  head/sys/dev/usb/wlan/if_urtwn.c
Comment 3 Kevin Lo freebsd_committer freebsd_triage 2015-04-30 02:48:43 UTC
Disabling usb aggregation mode does boost performance and it turns out
later Realtek chips don't usb aggregation mode. 

I committed it as r282266 with minor tweak, thanks.