Re: [patch] rtl8188eu support for urtwn(4)
On Tue, May 05, 2015 at 01:25:12PM +0200, Stefan Sperling wrote: On Mon, May 04, 2015 at 01:51:28PM +0200, Stefan Sperling wrote: On Mon, May 04, 2015 at 01:23:59PM +0200, Stefan Sperling wrote: Unfortunately, this patch doesn't still fix the performance problem for me. How are you testing performance? I'm using tcpbench(1). I've committed your patch so we can work on the remaining issues in smaller chunks. Thanks a lot for your work so far. It's always great to see someone new help us out with wireless. For the record: The speed issue happens only with an AP in 11b mode (the 88E firmware retries every data frame at 5Mbit/s). OFDM (11g) works. This diff fixes 11b performance on 88EU. Now getting the same results from tcpbench as with 88CUS. Test / OKs welcome. Index: if_urtwn.c === RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v retrieving revision 1.44 diff -u -p -r1.44 if_urtwn.c --- if_urtwn.c 4 May 2015 11:46:29 - 1.44 +++ if_urtwn.c 10 May 2015 14:05:54 - @@ -184,6 +184,10 @@ void urtwn_read_rom(struct urtwn_softc void urtwn_r88e_read_rom(struct urtwn_softc *); inturtwn_media_change(struct ifnet *); inturtwn_ra_init(struct urtwn_softc *); +inturtwn_r92c_ra_init(struct urtwn_softc *, u_int8_t, u_int32_t, + int, uint32_t, int); +inturtwn_r88e_ra_init(struct urtwn_softc *, u_int8_t, u_int32_t, + int, uint32_t, int); void urtwn_tsf_sync_enable(struct urtwn_softc *); void urtwn_set_led(struct urtwn_softc *, int, int); void urtwn_calib_to(void *); @@ -1083,7 +1087,6 @@ urtwn_ra_init(struct urtwn_softc *sc) struct ieee80211com *ic = sc-sc_ic; struct ieee80211_node *ni = ic-ic_bss; struct ieee80211_rateset *rs = ni-ni_rates; - struct r92c_fw_cmd_macid_cfg cmd; uint32_t rates, basicrates; uint8_t mode; int maxrate, maxbasicrate, error, i, j; @@ -1114,6 +1117,24 @@ urtwn_ra_init(struct urtwn_softc *sc) DPRINTF((mode=0x%x rates=0x%08x, basicrates=0x%08x\n, mode, rates, basicrates)); + if (sc-chip URTWN_CHIP_88E) + error = urtwn_r88e_ra_init(sc, mode, rates, maxrate, + basicrates, maxbasicrate); + else + error = urtwn_r92c_ra_init(sc, mode, rates, maxrate, + basicrates, maxbasicrate); + + /* Indicate highest supported rate. */ + ni-ni_txrate = rs-rs_nrates - 1; + return (error); +} + +int urtwn_r92c_ra_init(struct urtwn_softc *sc, u_int8_t mode, u_int32_t rates, +int maxrate, uint32_t basicrates, int maxbasicrate) +{ + struct r92c_fw_cmd_macid_cfg cmd; + int error; + /* Set rates mask for group addressed frames. */ cmd.macid = URTWN_MACID_BC | URTWN_MACID_VALID; cmd.mask = htole32(mode 28 | basicrates); @@ -1142,8 +1163,28 @@ urtwn_ra_init(struct urtwn_softc *sc) urtwn_write_1(sc, R92C_INIDATA_RATE_SEL(URTWN_MACID_BSS), maxrate); - /* Indicate highest supported rate. */ - ni-ni_txrate = rs-rs_nrates - 1; + return (0); +} + +int +urtwn_r88e_ra_init(struct urtwn_softc *sc, u_int8_t mode, u_int32_t rates, +int maxrate, uint32_t basicrates, int maxbasicrate) +{ + u_int32_t reg; + + urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, maxbasicrate); + + reg = urtwn_read_4(sc, R92C_RRSR); + reg = RW(reg, R92C_RRSR_RATE_BITMAP, rates); + urtwn_write_4(sc, R92C_RRSR, reg); + + /* +* Workaround for performance problems with firmware rate adaptation: +* If the AP only supports 11b rates, disable mixed B/G mode. +*/ + if (mode != R92C_RAID_11B maxrate = 3 /* 11M */) + sc-sc_flags |= URTWN_FLAG_FORCE_RAID_11B; + return (0); } @@ -1312,6 +1353,9 @@ urtwn_newstate_cb(struct urtwn_softc *sc urtwn_write_4(sc, R92C_EDCA_VI_PARAM, 0x005e4317); urtwn_write_4(sc, R92C_EDCA_BE_PARAM, 0x00105320); urtwn_write_4(sc, R92C_EDCA_BK_PARAM, 0xa444); + + /* Disable 11b-only AP workaround (see urtwn_r88e_ra_init). */ + sc-sc_flags = ~URTWN_FLAG_FORCE_RAID_11B; } switch (cmd-state) { case IEEE80211_S_INIT: @@ -1417,10 +1461,8 @@ urtwn_newstate_cb(struct urtwn_softc *sc urtwn_write_1(sc, R92C_T2T_SIFS + 1, 10); /* Intialize rate adaptation. */ - if (sc-chip URTWN_CHIP_88E) - ni-ni_txrate = ni-ni_rates.rs_nrates-1; - else - urtwn_ra_init(sc); + urtwn_ra_init(sc); + /* Turn link LED on. */ urtwn_set_led(sc, URTWN_LED_LINK, 1); @@ -1981,7 +2023,8 @@ urtwn_tx(struct urtwn_softc *sc, struct #endif if
Re: [patch] rtl8188eu support for urtwn(4)
On Mon, May 04, 2015 at 01:51:28PM +0200, Stefan Sperling wrote: On Mon, May 04, 2015 at 01:23:59PM +0200, Stefan Sperling wrote: Unfortunately, this patch doesn't still fix the performance problem for me. How are you testing performance? I'm using tcpbench(1). I've committed your patch so we can work on the remaining issues in smaller chunks. Thanks a lot for your work so far. It's always great to see someone new help us out with wireless. For the record: The speed issue happens only with an AP in 11b mode (the 88E firmware retries every data frame at 5Mbit/s). OFDM (11g) works.
Re: [patch] rtl8188eu support for urtwn(4)
On 20:20 26-Apr 2015 Stefan Sperling wrote: The chunk below is wrong for OpenBSD since it sets the intitial transmit rate to an 11n rate. 0x13 corresponds to the MCS7 11n rate, see linux/drivers/net/wireless/rtlwifi/rtl8188ee/def.h enum rtl_desc92c_rate. The value 11 corresponds to OFDM 54Mbit which is fine for OpenBSD. We only support 11a/b/g at present. --- sys/dev/usb/if_urtwn.c14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c19 Apr 2015 20:27:41 - @@ -1813,7 +2011,10 @@ urtwn_tx(struct urtwn_softc *sc, struct txd-txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8)); txd-txdw5 |= htole32(0x0001ff00); /* Send data at OFDM54. */ - txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); + if (sc-chip URTWN_CHIP_88E) + txd-txdw5 |= htole32(0x13 0x3f); + else + txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); } else { txd-txdw1 |= htole32( Hello, yes, this change, maybe harmless, but not accurate. I inline new patch against head with this change incorporated and with fix for USB aggregation mode, which Kevin has pushed into FreeBSD[1] to fix performance issues. [1] - https://svnweb.freebsd.org/base?view=revisionrevision=282266 Index: share/man/man4/urtwn.4 === RCS file: /cvs/src/share/man/man4/urtwn.4,v retrieving revision 1.31 diff -u -p -r1.31 urtwn.4 --- share/man/man4/urtwn.4 30 Mar 2015 12:35:15 - 1.31 +++ share/man/man4/urtwn.4 4 May 2015 10:09:59 - @@ -19,17 +19,17 @@ .Os .Sh NAME .Nm urtwn -.Nd Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless network device +.Nd Realtek RTL8188CU/RTL8188EU/RTL8192CU USB IEEE 802.11b/g/n wireless network device .Sh SYNOPSIS .Cd urtwn* at uhub? port ? .Sh DESCRIPTION The .Nm driver supports USB 2.0 wireless network devices based on Realtek -RTL8188CUS, RTL8188CE-VAU, RTL8188RU and RTL8192CU chipsets. +RTL8188CUS, RTL8188CE-VAU, RTL8188EUS, RTL8188RU and RTL8192CU chipsets. .Pp -The RTL8188CUS is a highly integrated 802.11n adapter that combines -a MAC, a 1T1R capable baseband and an RF in a single chip. +The RTL8188CUS and RTL8188EUS are a highly integrated 802.11n adapter +that combines a MAC, a 1T1R capable baseband and an RF in a single chip. It operates in the 2GHz spectrum only. The RTL8188RU is a high-power variant of the RTL8188CUS. The RTL8188CE-VAU is a PCI Express Mini Card adapter that attaches @@ -83,6 +83,7 @@ which are loaded when an interface is at .It /etc/firmware/urtwn-rtl8192cfwT .It /etc/firmware/urtwn-rtl8192cfwU .It /etc/firmware/urtwn-rtl8723fw +.It /etc/firmware/urtwn-rtl8188eufw .El .Pp A prepackaged version of the firmware can be installed using @@ -119,6 +120,8 @@ The following adapters should work: .It Solwise NET-WL-UMD-606N .It TP-Link TL-WN821N v4 .It TRENDnet TEW-648UBM +.It TP-LINK TL-WN723N v3 +.It TP-LINK TL-WN725N v2 .El .Sh EXAMPLES The following example scans for available networks: Index: sys/dev/usb/if_urtwn.c === RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v retrieving revision 1.43 diff -u -p -r1.43 if_urtwn.c --- sys/dev/usb/if_urtwn.c 14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c 4 May 2015 10:10:00 - @@ -2,6 +2,7 @@ /*- * Copyright (c) 2010 Damien Bergamini damien.bergam...@free.fr + * Copyright (c) 2014 Kevin Lo ke...@freebsd.org * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -17,7 +18,7 @@ */ /* - * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU. + * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU. */ #include bpfilter.h @@ -140,7 +141,10 @@ static const struct usb_devno urtwn_devs { USB_VENDOR_TPLINK,USB_PRODUCT_TPLINK_RTL8192CU }, { USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_RTL8188CU }, { USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_RTL8192CU }, - { USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_RTL8192CU } + { USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_RTL8192CU }, + /* URTWN_RTL8188E */ + { USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188ETV }, + { USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188EU } }; inturtwn_match(struct device *, void *, void *); @@ -167,14 +171,17 @@ uint8_t urtwn_read_1(struct urtwn_softc uint16_t urtwn_read_2(struct urtwn_softc *, uint16_t); uint32_t urtwn_read_4(struct urtwn_softc *, uint16_t); inturtwn_fw_cmd(struct urtwn_softc *, uint8_t, const void *, int); -void urtwn_rf_write(struct urtwn_softc *, int, uint8_t, uint32_t); +void urtwn_r92c_rf_write(struct urtwn_softc *, int, uint8_t, uint32_t); +void
Re: [patch] rtl8188eu support for urtwn(4)
On Mon, May 04, 2015 at 04:03:01PM +0300, Mikhail wrote: Hello, yes, this change, maybe harmless, but not accurate. I inline new patch against head with this change incorporated and with fix for USB aggregation mode, which Kevin has pushed into FreeBSD[1] to fix performance issues. [1] - https://svnweb.freebsd.org/base?view=revisionrevision=282266 Thanks Mikhail. Unfortunately, this patch doesn't still fix the performance problem for me. How are you testing performance? I'm using tcpbench(1). With your latest patch, on my 8188EU device: urtwn0 at uhub2 port 2 Realtek 802.11n NIC rev 2.00/0.00 addr 4 urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R, address c4:6e:1f:26:af:de tcpbench across the wireless to another openbsd box on my LAN which runs tcpbench -s gives numbers like: elapsed_ms bytes mbps bwidth Conn: 1 Mbps:0.385 Peak Mbps:0.413 Avg Mbps:0.385 10076 485520.382 100.00% Conn: 1 Mbps:0.382 Peak Mbps:0.413 Avg Mbps:0.382 11086 485520.385 100.00% Conn: 1 Mbps:0.385 Peak Mbps:0.413 Avg Mbps:0.385 12096 471240.374 100.00% Conn: 1 Mbps:0.374 Peak Mbps:0.413 Avg Mbps:0.374 13105 442680.351 100.00% Conn: 1 Mbps:0.351 Peak Mbps:0.413 Avg Mbps:0.351 14116 456960.362 100.00% Conn: 1 Mbps:0.362 Peak Mbps:0.413 Avg Mbps:0.362 Mbps never goes above 0.5. Downloading snapshots/i386/install57.fs directly from my access point takes more than 20 minutes. This device: urtwn0 at uhub2 port 2 Realtek 802.11n WLAN Adapter rev 2.00/2.00 addr 4 urtwn0: MAC/BB RTL8188CUS, RF 6052 1T1R, address 08:86:3b:6a:19:4b gives me the following numbers (nothing else changed besides urtwn device): elapsed_ms bytes mbps bwidth Conn: 1 Mbps:3.351 Peak Mbps:3.351 Avg Mbps:3.351 2013 4315043.452 100.00% Conn: 1 Mbps:3.452 Peak Mbps:3.452 Avg Mbps:3.452 3023 5039043.995 100.00% Conn: 1 Mbps:3.995 Peak Mbps:3.995 Avg Mbps:3.995 4033 5169364.099 100.00% Conn: 1 Mbps:4.099 Peak Mbps:4.099 Avg Mbps:4.099 5043 4937683.911 100.00% Conn: 1 Mbps:3.911 Peak Mbps:4.099 Avg Mbps:3.911 6044 4908723.923 100.00% Conn: 1 Mbps:3.923 Peak Mbps:4.099 Avg Mbps:3.923 7053 4691523.723 100.00% Conn: 1 Mbps:3.723 Peak Mbps:4.099 Avg Mbps:3.723 8053 4821843.857 100.00% Conn: 1 Mbps:3.857 Peak Mbps:4.099 Avg Mbps:3.857 9053 5401044.321 100.00% Conn: 1 Mbps:4.321 Peak Mbps:4.321 Avg Mbps:4.321 10063 4763923.777 100.00% Conn: 1 Mbps:3.777 Peak Mbps:4.321 Avg Mbps:3.777 11063 4648083.718 100.00% Conn: 1 Mbps:3.718 Peak Mbps:4.321 Avg Mbps:3.718 Downloading snapshots/i386/install57.fs directly from my access point takes about 8 minutes. Does FreeBSD have the same issue?
Re: [patch] rtl8188eu support for urtwn(4)
On Mon, May 04, 2015 at 01:23:59PM +0200, Stefan Sperling wrote: On Mon, May 04, 2015 at 04:03:01PM +0300, Mikhail wrote: Hello, yes, this change, maybe harmless, but not accurate. I inline new patch against head with this change incorporated and with fix for USB aggregation mode, which Kevin has pushed into FreeBSD[1] to fix performance issues. [1] - https://svnweb.freebsd.org/base?view=revisionrevision=282266 Thanks Mikhail. Unfortunately, this patch doesn't still fix the performance problem for me. How are you testing performance? I'm using tcpbench(1). I've committed your patch so we can work on the remaining issues in smaller chunks. Thanks a lot for your work so far. It's always great to see someone new help us out with wireless.
Re: [patch] rtl8188eu support for urtwn(4)
Just wanted to report that this works with my TL-WN723N v3.0. With both patches applied the adapter is able to saturate my DSL connection. Brendan MacDonell On Sun, Apr 26, 2015 at 4:46 PM, Mikhail mp39...@gmail.com wrote: On 21:22 26-Apr 2015 Mikhail wrote: On 20:20 26-Apr 2015 Stefan Sperling wrote: On Sun, Apr 26, 2015 at 01:31:17PM +0200, Stefan Sperling wrote: On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I'm seeing very low data transmission rates with your patch and a TP-Link TL-WN725N device. In both 11b and 11g mode, the data rate remains very low (less than 100Kbit/s). A different urtwn(4) device (with 8188CUS chip) has much better throughput. Are you seeing this, too? The chunk below is wrong for OpenBSD since it sets the intitial transmit rate to an 11n rate. 0x13 corresponds to the MCS7 11n rate, see linux/drivers/net/wireless/rtlwifi/rtl8188ee/def.h enum rtl_desc92c_rate. The value 11 corresponds to OFDM 54Mbit which is fine for OpenBSD. We only support 11a/b/g at present. --- sys/dev/usb/if_urtwn.c 14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c 19 Apr 2015 20:27:41 - @@ -1813,7 +2011,10 @@ urtwn_tx(struct urtwn_softc *sc, struct txd-txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8)); txd-txdw5 |= htole32(0x0001ff00); /* Send data at OFDM54. */ - txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); + if (sc-chip URTWN_CHIP_88E) + txd-txdw5 |= htole32(0x13 0x3f); + else + txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); } else { txd-txdw1 |= htole32( Reverting this change doesn't fix the transmit speed problem, unfortunately. I wonder if we're making some mistake while setting up the TX descriptor? There are several differences in the TX descriptors of 88E vs 92C. For example, 88E has third antenna C available. Hello, in urtwn_init(), in part: if (sc-chip URTWN_CHIP_88E) urtwn_write_1(sc, R92C_RXDMA_AGG_PG_TH + 1, 4); else urtwn_write_1(sc, R92C_USB_DMA_AGG_TO, 4); comment first 3 lines. It fixes speed problem for me, but I need to understand the issue further, before proposing any solution. The issue isn't in those lines, but a little bit higher - the driver enables usb and dma aggregations, but native linux implementation enables only dma and disables usb one. I've submitted bug report to FreeBSD[1] with a patch, which I see as a proper solution: urtwn_write_1(sc, R92C_USB_SPECIAL_OPTION, urtwn_read_1(sc, R92C_USB_SPECIAL_OPTION) | - R92C_USB_SPECIAL_OPTION_AGG_EN); + (sc-chip URTWN_CHIP_88E ? + ~R92C_USB_SPECIAL_OPTION_AGG_EN : +R92C_USB_SPECIAL_OPTION_AGG_EN)); I'd suggest to wait some time for feedback. Testing is welcome, of course. Thank you for pointing this out and review in general. [1] - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199718
Re: [patch] rtl8188eu support for urtwn(4)
On 23:25 26-Apr 2015 patrick keshishian wrote: On 4/26/15, Mikhail mp39...@gmail.com wrote: urtwn_write_1(sc, R92C_USB_SPECIAL_OPTION, urtwn_read_1(sc, R92C_USB_SPECIAL_OPTION) | - R92C_USB_SPECIAL_OPTION_AGG_EN); + (sc-chip URTWN_CHIP_88E ? + ~R92C_USB_SPECIAL_OPTION_AGG_EN : umm... maybe 0, as it is being ORed with what read returns. But maybe the check should be against URTWN_CHIP_92C since the option is specific to it (or at least implied to be so). It's what original driver does: https://github.com/lwfinger/rtl8188eu/blob/master/hal/usb_halinit.c#L520
Re: [patch] rtl8188eu support for urtwn(4)
On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I've committed the part below already. I put the ID 0x0179 before 0x018a though, not after. Index: sys/dev/usb/usbdevs === RCS file: /cvs/src/sys/dev/usb/usbdevs,v retrieving revision 1.646 diff -u -p -u -r1.646 usbdevs --- sys/dev/usb/usbdevs 2 Apr 2015 14:24:02 - 1.646 +++ sys/dev/usb/usbdevs 19 Apr 2015 20:27:41 - @@ -3486,6 +3486,7 @@ product RATOC REXUSB60F 0xb020 REX-USB6 /* Realtek products */ product REALTEK RTL8188CTV 0x018a RTL8188CTV +product REALTEK RTL8188ETV 0x0179 RTL8188ETV product REALTEK RTL8188RU_2 0x317f RTL8188RU product REALTEK RTL8150 0x8150 RTL8150 product REALTEK RTL8151 0x8151 RTL8151 PNA @@ -3499,6 +3500,7 @@ product REALTEK RTL8174 0x8174 RTL8174 product REALTEK RTL8188CU_0 0x8176 RTL8188CU product REALTEK RTL8191CU0x8177 RTL8191CU product REALTEK RTL8192CU0x8178 RTL8192CU +product REALTEK RTL8188EU0x8179 RTL8188EU product REALTEK RTL8188CU_1 0x817a RTL8188CU product REALTEK RTL8188CU_2 0x817b RTL8188CU product REALTEK RTL8192CE0x817c RTL8192CE
Re: [patch] rtl8188eu support for urtwn(4)
On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I'm seeing very low data transmission rates with your patch and a TP-Link TL-WN725N device. In both 11b and 11g mode, the data rate remains very low (less than 100Kbit/s). A different urtwn(4) device (with 8188CUS chip) has much better throughput. Are you seeing this, too?
Re: [patch] rtl8188eu support for urtwn(4)
On 20:20 26-Apr 2015 Stefan Sperling wrote: On Sun, Apr 26, 2015 at 01:31:17PM +0200, Stefan Sperling wrote: On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I'm seeing very low data transmission rates with your patch and a TP-Link TL-WN725N device. In both 11b and 11g mode, the data rate remains very low (less than 100Kbit/s). A different urtwn(4) device (with 8188CUS chip) has much better throughput. Are you seeing this, too? The chunk below is wrong for OpenBSD since it sets the intitial transmit rate to an 11n rate. 0x13 corresponds to the MCS7 11n rate, see linux/drivers/net/wireless/rtlwifi/rtl8188ee/def.h enum rtl_desc92c_rate. The value 11 corresponds to OFDM 54Mbit which is fine for OpenBSD. We only support 11a/b/g at present. --- sys/dev/usb/if_urtwn.c14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c19 Apr 2015 20:27:41 - @@ -1813,7 +2011,10 @@ urtwn_tx(struct urtwn_softc *sc, struct txd-txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8)); txd-txdw5 |= htole32(0x0001ff00); /* Send data at OFDM54. */ - txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); + if (sc-chip URTWN_CHIP_88E) + txd-txdw5 |= htole32(0x13 0x3f); + else + txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); } else { txd-txdw1 |= htole32( Reverting this change doesn't fix the transmit speed problem, unfortunately. I wonder if we're making some mistake while setting up the TX descriptor? There are several differences in the TX descriptors of 88E vs 92C. For example, 88E has third antenna C available. Hello, in urtwn_init(), in part: if (sc-chip URTWN_CHIP_88E) urtwn_write_1(sc, R92C_RXDMA_AGG_PG_TH + 1, 4); else urtwn_write_1(sc, R92C_USB_DMA_AGG_TO, 4); comment first 3 lines. It fixes speed problem for me, but I need to understand the issue further, before proposing any solution.
Re: [patch] rtl8188eu support for urtwn(4)
On 4/26/15, Mikhail mp39...@gmail.com wrote: On 21:22 26-Apr 2015 Mikhail wrote: On 20:20 26-Apr 2015 Stefan Sperling wrote: On Sun, Apr 26, 2015 at 01:31:17PM +0200, Stefan Sperling wrote: On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I'm seeing very low data transmission rates with your patch and a TP-Link TL-WN725N device. In both 11b and 11g mode, the data rate remains very low (less than 100Kbit/s). A different urtwn(4) device (with 8188CUS chip) has much better throughput. Are you seeing this, too? The chunk below is wrong for OpenBSD since it sets the intitial transmit rate to an 11n rate. 0x13 corresponds to the MCS7 11n rate, see linux/drivers/net/wireless/rtlwifi/rtl8188ee/def.h enum rtl_desc92c_rate. The value 11 corresponds to OFDM 54Mbit which is fine for OpenBSD. We only support 11a/b/g at present. --- sys/dev/usb/if_urtwn.c 14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c 19 Apr 2015 20:27:41 - @@ -1813,7 +2011,10 @@ urtwn_tx(struct urtwn_softc *sc, struct txd-txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8)); txd-txdw5 |= htole32(0x0001ff00); /* Send data at OFDM54. */ - txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); + if (sc-chip URTWN_CHIP_88E) + txd-txdw5 |= htole32(0x13 0x3f); + else + txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); } else { txd-txdw1 |= htole32( Reverting this change doesn't fix the transmit speed problem, unfortunately. I wonder if we're making some mistake while setting up the TX descriptor? There are several differences in the TX descriptors of 88E vs 92C. For example, 88E has third antenna C available. Hello, in urtwn_init(), in part: if (sc-chip URTWN_CHIP_88E) urtwn_write_1(sc, R92C_RXDMA_AGG_PG_TH + 1, 4); else urtwn_write_1(sc, R92C_USB_DMA_AGG_TO, 4); comment first 3 lines. It fixes speed problem for me, but I need to understand the issue further, before proposing any solution. The issue isn't in those lines, but a little bit higher - the driver enables usb and dma aggregations, but native linux implementation enables only dma and disables usb one. I've submitted bug report to FreeBSD[1] with a patch, which I see as a proper solution: urtwn_write_1(sc, R92C_USB_SPECIAL_OPTION, urtwn_read_1(sc, R92C_USB_SPECIAL_OPTION) | - R92C_USB_SPECIAL_OPTION_AGG_EN); + (sc-chip URTWN_CHIP_88E ? + ~R92C_USB_SPECIAL_OPTION_AGG_EN : umm... maybe 0, as it is being ORed with what read returns. But maybe the check should be against URTWN_CHIP_92C since the option is specific to it (or at least implied to be so). --patrick +R92C_USB_SPECIAL_OPTION_AGG_EN)); I'd suggest to wait some time for feedback. Testing is welcome, of course. Thank you for pointing this out and review in general. [1] - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199718
Re: [patch] rtl8188eu support for urtwn(4)
On Sun, Apr 26, 2015 at 01:31:17PM +0200, Stefan Sperling wrote: On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I'm seeing very low data transmission rates with your patch and a TP-Link TL-WN725N device. In both 11b and 11g mode, the data rate remains very low (less than 100Kbit/s). A different urtwn(4) device (with 8188CUS chip) has much better throughput. Are you seeing this, too? The chunk below is wrong for OpenBSD since it sets the intitial transmit rate to an 11n rate. 0x13 corresponds to the MCS7 11n rate, see linux/drivers/net/wireless/rtlwifi/rtl8188ee/def.h enum rtl_desc92c_rate. The value 11 corresponds to OFDM 54Mbit which is fine for OpenBSD. We only support 11a/b/g at present. --- sys/dev/usb/if_urtwn.c 14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c 19 Apr 2015 20:27:41 - @@ -1813,7 +2011,10 @@ urtwn_tx(struct urtwn_softc *sc, struct txd-txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8)); txd-txdw5 |= htole32(0x0001ff00); /* Send data at OFDM54. */ - txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); + if (sc-chip URTWN_CHIP_88E) + txd-txdw5 |= htole32(0x13 0x3f); + else + txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); } else { txd-txdw1 |= htole32( Reverting this change doesn't fix the transmit speed problem, unfortunately. I wonder if we're making some mistake while setting up the TX descriptor? There are several differences in the TX descriptors of 88E vs 92C. For example, 88E has third antenna C available.
Re: [patch] rtl8188eu support for urtwn(4)
On 21:22 26-Apr 2015 Mikhail wrote: On 20:20 26-Apr 2015 Stefan Sperling wrote: On Sun, Apr 26, 2015 at 01:31:17PM +0200, Stefan Sperling wrote: On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I'm seeing very low data transmission rates with your patch and a TP-Link TL-WN725N device. In both 11b and 11g mode, the data rate remains very low (less than 100Kbit/s). A different urtwn(4) device (with 8188CUS chip) has much better throughput. Are you seeing this, too? The chunk below is wrong for OpenBSD since it sets the intitial transmit rate to an 11n rate. 0x13 corresponds to the MCS7 11n rate, see linux/drivers/net/wireless/rtlwifi/rtl8188ee/def.h enum rtl_desc92c_rate. The value 11 corresponds to OFDM 54Mbit which is fine for OpenBSD. We only support 11a/b/g at present. --- sys/dev/usb/if_urtwn.c 14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c 19 Apr 2015 20:27:41 - @@ -1813,7 +2011,10 @@ urtwn_tx(struct urtwn_softc *sc, struct txd-txdw4 |= htole32(SM(R92C_TXDW4_RTSRATE, 8)); txd-txdw5 |= htole32(0x0001ff00); /* Send data at OFDM54. */ - txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); + if (sc-chip URTWN_CHIP_88E) + txd-txdw5 |= htole32(0x13 0x3f); + else + txd-txdw5 |= htole32(SM(R92C_TXDW5_DATARATE, 11)); } else { txd-txdw1 |= htole32( Reverting this change doesn't fix the transmit speed problem, unfortunately. I wonder if we're making some mistake while setting up the TX descriptor? There are several differences in the TX descriptors of 88E vs 92C. For example, 88E has third antenna C available. Hello, in urtwn_init(), in part: if (sc-chip URTWN_CHIP_88E) urtwn_write_1(sc, R92C_RXDMA_AGG_PG_TH + 1, 4); else urtwn_write_1(sc, R92C_USB_DMA_AGG_TO, 4); comment first 3 lines. It fixes speed problem for me, but I need to understand the issue further, before proposing any solution. The issue isn't in those lines, but a little bit higher - the driver enables usb and dma aggregations, but native linux implementation enables only dma and disables usb one. I've submitted bug report to FreeBSD[1] with a patch, which I see as a proper solution: urtwn_write_1(sc, R92C_USB_SPECIAL_OPTION, urtwn_read_1(sc, R92C_USB_SPECIAL_OPTION) | - R92C_USB_SPECIAL_OPTION_AGG_EN); + (sc-chip URTWN_CHIP_88E ? + ~R92C_USB_SPECIAL_OPTION_AGG_EN : +R92C_USB_SPECIAL_OPTION_AGG_EN)); I'd suggest to wait some time for feedback. Testing is welcome, of course. Thank you for pointing this out and review in general. [1] - https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199718
Re: [patch] rtl8188eu support for urtwn(4)
On Sun, Apr 26, 2015 at 6:31 AM, Stefan Sperling s...@stsp.name wrote: On Sun, Apr 19, 2015 at 11:48:32PM +0300, Mikhail wrote: Bellow new version of the patch with above things fixed, also I've fixed detection of ETV chip in urtwn_attach(), nothing else is changed. I'm seeing very low data transmission rates with your patch and a TP-Link TL-WN725N device. In both 11b and 11g mode, the data rate remains very low (less than 100Kbit/s). A different urtwn(4) device (with 8188CUS chip) has much better throughput. Are you seeing this, too? Hi I tested this diff with my previously unsupported urtwn device: TP-link TL-WN725N dmesg and usbdevs attached. I can confirm speed issue (30Kbits/s via tcpbench) Thanks for the work! dmesg Description: Binary data usbdevs Description: Binary data
Re: [patch] rtl8188eu support for urtwn(4)
On 2015/04/19 23:48, Mikhail wrote: I can take care of the firmware package, can you confirm if this is correct? SHA256 (urtwn-rtl8188eufw) = 1241ddbfc87f0495e0bf09d8b94c94680b60a3d8eeab89462b3c4d8d3e8a1ee0 Yes, that's correct. Thanks. I've committed it to ports/sysutils/firmware/urtwn, I'll build some packages when I can find the power supply for the signing machine ;-)
[patch] rtl8188eu support for urtwn(4)
Hello, I inline the patch for rtl8188eu chip support in urtwn driver, origins for this patch are in r264912[1] from FreeBSD. In order to work, correct firmware must be presented in /etc/firmware - one can be found in FreeBSD commit itself[2] - I'm not sure what is the correct procedure of submitting it to firmware.openbsd.org. I've tested it with TP-LINK TL-WN725N with usual network activity. [1] - http://svnweb.freebsd.org/base?view=revisionrevision=264912 [2] - http://svnweb.freebsd.org/base/head/sys/contrib/dev/urtwn/urtwn-rtl8188eufw.fw.uu?view=markuppathrev=264912 Index: share/man/man4/urtwn.4 === RCS file: /cvs/src/share/man/man4/urtwn.4,v retrieving revision 1.31 diff -u -p -u -r1.31 urtwn.4 --- share/man/man4/urtwn.4 30 Mar 2015 12:35:15 - 1.31 +++ share/man/man4/urtwn.4 18 Apr 2015 19:44:00 - @@ -14,22 +14,22 @@ .\ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\ -.Dd $Mdocdate: March 30 2015 $ +.Dd $Mdocdate: April 19 2015 $ .Dt URTWN 4 .Os .Sh NAME .Nm urtwn -.Nd Realtek RTL8188CU/RTL8192CU USB IEEE 802.11b/g/n wireless network device +.Nd Realtek RTL8188CU/RTL8188EU/RTL8192CU USB IEEE 802.11b/g/n wireless network device .Sh SYNOPSIS .Cd urtwn* at uhub? port ? .Sh DESCRIPTION The .Nm driver supports USB 2.0 wireless network devices based on Realtek -RTL8188CUS, RTL8188CE-VAU, RTL8188RU and RTL8192CU chipsets. +RTL8188CUS, RTL8188CE-VAU, RTL8188EUS, RTL8188RU and RTL8192CU chipsets. .Pp -The RTL8188CUS is a highly integrated 802.11n adapter that combines -a MAC, a 1T1R capable baseband and an RF in a single chip. +The RTL8188CUS and RTL8188EUS is a highly integrated 802.11n adapter +that combines a MAC, a 1T1R capable baseband and an RF in a single chip. It operates in the 2GHz spectrum only. The RTL8188RU is a high-power variant of the RTL8188CUS. The RTL8188CE-VAU is a PCI Express Mini Card adapter that attaches @@ -83,6 +83,7 @@ which are loaded when an interface is at .It /etc/firmware/urtwn-rtl8192cfwT .It /etc/firmware/urtwn-rtl8192cfwU .It /etc/firmware/urtwn-rtl8723fw +.It /etc/firmware/urtwn-rtl8188eufw .El .Pp A prepackaged version of the firmware can be installed using @@ -119,6 +120,8 @@ The following adapters should work: .It Solwise NET-WL-UMD-606N .It TP-Link TL-WN821N v4 .It TRENDnet TEW-648UBM +.It TP-LINK TL-WN723N v3 +.It TP-LINK TL-WN725N v2 .El .Sh EXAMPLES The following example scans for available networks: Index: sys/dev/usb/if_urtwn.c === RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v retrieving revision 1.43 diff -u -p -u -r1.43 if_urtwn.c --- sys/dev/usb/if_urtwn.c 14 Mar 2015 03:38:49 - 1.43 +++ sys/dev/usb/if_urtwn.c 18 Apr 2015 19:44:00 - @@ -2,6 +2,7 @@ /*- * Copyright (c) 2010 Damien Bergamini damien.bergam...@free.fr + * Copyright (c) 2014 Kevin Lo ke...@freebsd.org * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -17,7 +18,7 @@ */ /* - * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188RU/RTL8192CU. + * Driver for Realtek RTL8188CE-VAU/RTL8188CUS/RTL8188EU/RTL8188RU/RTL8192CU. */ #include bpfilter.h @@ -140,7 +141,10 @@ static const struct usb_devno urtwn_devs { USB_VENDOR_TPLINK,USB_PRODUCT_TPLINK_RTL8192CU }, { USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_RTL8188CU }, { USB_VENDOR_TRENDNET, USB_PRODUCT_TRENDNET_RTL8192CU }, - { USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_RTL8192CU } + { USB_VENDOR_ZYXEL, USB_PRODUCT_ZYXEL_RTL8192CU }, + /* URTWN_RTL8188E */ + { USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188ETV }, + { USB_VENDOR_REALTEK, USB_PRODUCT_REALTEK_RTL8188EU } }; inturtwn_match(struct device *, void *, void *); @@ -167,14 +171,17 @@ uint8_t urtwn_read_1(struct urtwn_softc uint16_t urtwn_read_2(struct urtwn_softc *, uint16_t); uint32_t urtwn_read_4(struct urtwn_softc *, uint16_t); inturtwn_fw_cmd(struct urtwn_softc *, uint8_t, const void *, int); -void urtwn_rf_write(struct urtwn_softc *, int, uint8_t, uint32_t); +void urtwn_r92c_rf_write(struct urtwn_softc *, int, uint8_t, uint32_t); +void urtwn_r88e_rf_write(struct urtwn_softc *, int, uint8_t, uint32_t); uint32_t urtwn_rf_read(struct urtwn_softc *, int, uint8_t); void urtwn_cam_write(struct urtwn_softc *, uint32_t, uint32_t); inturtwn_llt_write(struct urtwn_softc *, uint32_t, uint32_t); uint8_turtwn_efuse_read_1(struct urtwn_softc *, uint16_t); void urtwn_efuse_read(struct urtwn_softc *); +void urtwn_efuse_switch_power(struct urtwn_softc *); int
Re: [patch] rtl8188eu support for urtwn(4)
On Sun, Apr 19, 2015 at 11:27:52AM +0300, Mikhail wrote: I'm not sure what is the correct procedure of submitting it to firmware.openbsd.org. Please prepare a patch for /usr/ports/sysutils/firmware/urtwn. I've tested it with TP-LINK TL-WN725N with usual network activity. Thanks! I will take a detailed look at your patch ASAP.