# rtl8192cu Slow Speed

## alienjon

I did a recent install of Gentoo.  I'm using an ASUSTek Computer, Inc. USB-N13 802.11n Network Adapter (rev. B1) which uses the Realtek RTL8192CU driver (installed as a module in gentoo-sources-3.18.7).  I'm connected to a Netgear R6300v2 flashed with DD-WRT (build 25697) at a 2.4ghz frequency (there's also a 5ghz band, but my adapter can't see it).  The problem is that I'm finding that I'm downloading at a very slow speed (I'm downloading a file right now at about 14k/s and Steam is downloading a game at 211k/s).  Running an Ookla speedtest measures 0.52mbps download, 2.77mbps upload, and a ping of 96ms.  I'm connected to the same network on my iPad and ran the same Ookla speedtest with much improved results (11.51mbps download, 3.43mbps upload, ping of 60ms).

These are the entries in dmesg related to my adapter:

```
[    6.804872] rtl8192cu 6-1.3:1.0 wlp0s29u1u3: renamed from wlan0

[    6.809266] systemd-udevd[1489]: renamed network interface wlan0 to wlp0s29u1u3

[   13.950731] IPv6: ADDRCONF(NETDEV_UP): wlp0s29u1u3: link is not ready

[   15.012140] wlp0s29u1u3: authenticate with 04:a1:51:e9:41:47

[   15.035075] wlp0s29u1u3: send auth to 04:a1:51:e9:41:47 (try 1/3)

[   15.063443] wlp0s29u1u3: authenticated

[   15.064495] wlp0s29u1u3: associate with 04:a1:51:e9:41:47 (try 1/3)

[   15.165393] wlp0s29u1u3: associate with 04:a1:51:e9:41:47 (try 2/3)

[   15.169456] wlp0s29u1u3: RX AssocResp from 04:a1:51:e9:41:47 (capab=0x1411 status=0 aid=1)

[   15.170298] wlp0s29u1u3: associated

[   15.170322] IPv6: ADDRCONF(NETDEV_CHANGE): wlp0s29u1u3: link becomes ready

[   15.250029] wlp0s29u1u3: Limiting TX power to 30 (30 - 0) dBm as advertised by 04:a1:51:e9:41:47

[  531.464016] wlp0s29u1u3: Limiting TX power to 30 (30 - 0) dBm as advertised by 04:a1:51:e9:41:47

[  544.763275] wlp0s29u1u3: Limiting TX power to 30 (30 - 0) dBm as advertised by 04:a1:51:e9:41:47
```

I'm wondering if the last 3 entries are telling to the problem (that the power is being limited).  Also, here's my iwconfig:

```
wlp0s29u1u3  IEEE 802.11bgn  ESSID:"{my ssid}"  

          Mode:Managed  Frequency:2.412 GHz  Access Point: 04:A1:51:E9:41:47   

          Bit Rate=72.2 Mb/s   Tx-Power=20 dBm   

          Retry short limit:7   RTS thr=2347 B   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=70/70  Signal level=-33 dBm  

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:3733   Missed beacon:0
```

Any ideas what could be slowing it down?

----------

## yagami

yeah , i have on adapter that also uses rtl8192cu module.

Try it with this one : https://github.com/pvaret/rtl8192cu-fixes : it completly makes the difference in terms of stability and speed !

----------

## alienjon

That's the module I had been using, actually, prior to my re-install.  I started using it because it fixed an issue where a power saving feature turned off the device after 30 seconds of inactivity.  I didn't use it by default this time because the kernel I'm using now has an option to disable automatic power saving (figured I'd give it a try).  THAT problem hasn't been happening, so I preferred to stick with the kernel driver, but I'll give this one a go and let you know how it works.  Thanks for the suggestion!

----------

## alienjon

Hmm... I'm having a problem building the module.  It all goes well until I run the build/install command:

```
Kernel preparation unnecessary for this kernel.  Skipping...

Building module:

make -C /lib/modules/3.18.7-gentoo/biuld M=/var/lib/dkms/8192cu1.9/build clean

make: Entering directory '/usr/src/linux-3.18.7-gentoo'

  CLEAN  /var/lib/dkms/8192cu/1.9/build/Module.symvers

make: Leaving directory '/usr/src/linux-3.18.7-gentoo

{ make KERNELRELEASE=3.18.7-gentoo -C /lib/modules/3.18.7-gentoo/build M=/var/lib/dkms/8192cu/1.9/build; } >> /var/lib/dkms/8192cu/1.9/build/make.log 2>&1

Error! Build of 8192cu.ko failed for: 3.18.7-gentoo (x86_64)

Consult the make.log in the build directory

/var/lib/dkms/8192cu/1.9/build for more information.
```

So I go to make.log, expecting to see a build error, or at least something to point out what went wrong, but I don't find the contents to be so obvious:

```
DKMS make.log for 8192cu-1.9 for kernel 3.18.7-gentoo (x86_64)

Sun Mar 22 00:00:44 edt 2015

make: Entering directory '/usr/src/linux-3.18.7-gentoo'

  LD        /var/lib/dkms/8192cu/1.9/build/built-in.o

  Building modules, stage 2.

  MODPOST 0 modules

make: Leaving directory '/usr/src/linux-3.18.7-gentoo
```

As a side note, I typed all this in by hand, so if something looks odd it may be a typo.

----------

## yagami

can you try doing it without dkms ?

can you check if /usr/src/linux points to your currenct configured kernel ( not a clean kernel , like when after doing make mrproper ) ?

----------

## alienjon

Kernel is linked fine:

```
lrwxrwxrwx 1 root root 19 Mar  7 08:59 /usr/src/linux -> linux-3.18.7-gentoo
```

As for the build if I do it manually I get several warnings, but no errors and (to me) it looks as though it builds okay:

```
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/3.18.7-gentoo/build M=/home/alienjon/rtl8192cu-fixes  modules

make[1]: Entering directory '/usr/src/linux-3.18.7-gentoo'

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_cmd.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_security.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_debug.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_io.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_ioctl_query.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_ioctl_set.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_ieee80211.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_mlme.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_mlme_ext.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_wlan_util.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_pwrctrl.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_rf.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_recv.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_sta_mgt.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_ap.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_xmit.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_p2p.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_tdls.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_br_ext.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_iol.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/rtw_sreset.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/core/efuse/rtw_efuse.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/hal_intf.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/hal_com.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/dm.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_hal_init.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_phycfg.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_rf6052.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_dm.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_rxdesc.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_cmd.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/usb/usb_halinit.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/usb/rtl8192cu_led.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/usb/rtl8192cu_xmit.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/usb/rtl8192cu_recv.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/usb/usb_ops_linux.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_sreset.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/rtl8192c_xmit.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/hal/rtl8192c/usb/Hal8192CUHWImg.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/osdep_service.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/os_intfs.o

/home/alienjon/rtl8192cu-fixes/os_dep/linux/os_intfs.c:1003:2: warning: initialization from incompatible pointer type [enabled by default]

  .ndo_select_queue = rtw_select_queue,

  ^

/home/alienjon/rtl8192cu-fixes/os_dep/linux/os_intfs.c:1003:2: warning: (near initialization for ‘rtw_netdev_ops.ndo_select_queue’) [enabled by default]

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/usb_intf.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/usb_ops_linux.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/ioctl_linux.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/xmit_linux.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/mlme_linux.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/recv_linux.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/ioctl_cfg80211.o

  CC [M]  /home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.o

/home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.c: In function ‘rtw_android_priv_cmd’:

/home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.c:382:30: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

  if (copy_from_user(command, (void *)priv_cmd.buf, priv_cmd.total_len)) {

                              ^

/home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.c:568:4: warning: passing argument 1 of ‘get_int_from_command’ makes pointer from integer without a cast [enabled by default]

    pwfd_info->rtsp_ctrlport = ( u16 ) get_int_from_command( priv_cmd.buf );

    ^

/home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.c:334:5: note: expected ‘char *’ but argument is of type ‘compat_uptr_t’

 int get_int_from_command( char* pcmd )

     ^

/home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.c:588:4: warning: passing argument 1 of ‘get_int_from_command’ makes pointer from integer without a cast [enabled by default]

    pwfd_info->wfd_device_type = ( u8 ) get_int_from_command( priv_cmd.buf );

    ^

/home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.c:334:5: note: expected ‘char *’ but argument is of type ‘compat_uptr_t’

 int get_int_from_command( char* pcmd )

     ^

/home/alienjon/rtl8192cu-fixes/os_dep/linux/rtw_android.c:612:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]

   if (copy_to_user((void *)priv_cmd.buf, command, bytes_written)) {

                    ^

  LD [M]  /home/alienjon/rtl8192cu-fixes/8192cu.o

  Building modules, stage 2.

  MODPOST 1 modules

  CC      /home/alienjon/rtl8192cu-fixes/8192cu.mod.o

  LD [M]  /home/alienjon/rtl8192cu-fixes/8192cu.ko

make[1]: Leaving directory '/usr/src/linux-3.18.7-gentoo'
```

----------

## yagami

 *alienjon wrote:*   

> Kernel is linked fine:
> 
> ```
> lrwxrwxrwx 1 root root 19 Mar  7 08:59 /usr/src/linux -> linux-3.18.7-gentoo
> ```
> ...

 

hum... so , after make install, modprobe -r rtl8192cu, modprobe 8192cu , is problem solved ?

----------

## alienjon

```
install -p -m 644 8192cu.ko  /lib/modules/3.18.7-gentoo/kernel/drivers/net/wireless/

/sbin/depmod -a 3.18.7-gentoo
```

The following is the dmesg for the period of time after loading this module:

```
[ 1750.754481] rtl8192cu driver version=v4.0.2_9000.20130911

[ 1750.754486] build time: Mar 22 2015 00:31:10

[ 1750.754537] 

usb_endpoint_descriptor(0):

[ 1750.754540] bLength=7

[ 1750.754541] bDescriptorType=5

[ 1750.754542] bEndpointAddress=81

[ 1750.754544] wMaxPacketSize=200

[ 1750.754545] bInterval=0

[ 1750.754546] RT_usb_endpoint_is_bulk_in = 1

[ 1750.754548] 

usb_endpoint_descriptor(1):

[ 1750.754549] bLength=7

[ 1750.754551] bDescriptorType=5

[ 1750.754552] bEndpointAddress=2

[ 1750.754553] wMaxPacketSize=200

[ 1750.754554] bInterval=0

[ 1750.754555] RT_usb_endpoint_is_bulk_out = 2

[ 1750.754557] 

usb_endpoint_descriptor(2):

[ 1750.754559] bLength=7

[ 1750.754560] bDescriptorType=5

[ 1750.754561] bEndpointAddress=3

[ 1750.754563] wMaxPacketSize=200

[ 1750.754564] bInterval=0

[ 1750.754565] RT_usb_endpoint_is_bulk_out = 3

[ 1750.754566] 

usb_endpoint_descriptor(3):

[ 1750.754576] bLength=7

[ 1750.754577] bDescriptorType=5

[ 1750.754578] bEndpointAddress=84

[ 1750.754579] wMaxPacketSize=40

[ 1750.754580] bInterval=1

[ 1750.754582] RT_usb_endpoint_is_int_in = 4, Interval = 1

[ 1750.754583] nr_endpoint=4, in_num=2, out_num=2

[ 1750.754585] USB_SPEED_HIGH

[ 1750.754595] CHIP TYPE: RTL8188C_8192C

[ 1750.754600] register rtw_netdev_ops to netdev_ops

[ 1750.754856] Chip Version ID: VERSION_NORMAL_TSMC_CHIP_92C.

[ 1750.754860] RF_Type is 2!!

[ 1750.755206] EEPROM type is E-FUSE

[ 1750.755209] ====> ReadAdapterInfo8192C

[ 1750.755324] Boot from EFUSE, Autoload OK !

[ 1750.905184] EEPROMVID = 0x0b05

[ 1750.905187] EEPROMPID = 0x17ab

[ 1750.905189] EEPROMCustomerID : 0x00

[ 1750.905191] EEPROMSubCustomerID: 0x00

[ 1750.905200] RT_CustomerID: 0x00

[ 1750.905202] _ReadMACAddress MAC Address from EFUSE = 10:c3:7b:cd:b5:5e

[ 1750.905204] EEPROMRegulatory = 0x3

[ 1750.905206] _ReadBoardType(0)

[ 1750.905207] BT Coexistance = disable

[ 1750.905209] mlmepriv.ChannelPlan = 0x00

[ 1750.905211] _ReadPSSetting...bHWPwrPindetect(0)-bHWPowerdown(0) ,bSupportRemoteWakeup(0)

[ 1750.905212] ### PS params=>  power_mgnt(1),usbss_enable(0) ###

[ 1750.905213] ### AntDivCfg(0)

[ 1750.905215] readAdapterInfo_8192CU(): REPLACEMENT = 1

[ 1750.905217] <==== ReadAdapterInfo8192C in 150 ms

[ 1750.905363] rtw_macaddr_cfg MAC Address  = 10:c3:7b:cd:b5:5e

[ 1750.905365] bDriverStopped:1, bSurpriseRemoved:0, bup:0, hw_init_completed:0

[ 1750.905640] _rtw_drv_register_netdev, MAC Address (if1) = 10:c3:7b:cd:b5:5e

[ 1750.905778] usbcore: registered new interface driver rtl8192cu

[ 1750.920000] rtl8192cu 6-1.3:1.0 enp0s29u1u3: renamed from wlan0

[ 1750.926512] systemd-udevd[3177]: renamed network interface wlan0 to enp0s29u1u3
```

I know that dbus names the devices based on certain parameters, so I don't know if this is odd to begin with an 'enp' when other wifi devices seem to start with a 'wlp'.  Also, I'm not sure why systemd-udev is being used, as I don't use systemd...  These may not be anything important, but I figured it was worth mentioning.

In any event, I have an /etc/init.d/net.enp0s29u1u3 linked to /etc/init.d/net.lo.  Starting it returns the following:

```
 * Bringing up interface enp0s29u1u3

 *   config_enp0s29u1u3 not specified; defaulting to DHCP

 *   dhcp ...

 *     Running dhcpcd ...

dhcpcd[4363]: version 6.6.7 starting

dhcpcd[4363]: enp0s29u1u3: adding address fe80::db5b:741a:6c74:c693

dhcpcd[4363]: enp0s29u1u3: waiting for carrier

dhcpcd[4363]: timed out

dhcpcd[4363]: exited                                                                                                                                 [ !! ]

 * ERROR: net.enp0s29u1u3 failed to start
```

dmesg output from the point of trying to start the device is:

```
[ 1781.967991] +871x_drv - drv_open, bup=0

[ 1781.972247]  ===> FirmwareDownload91C() fw:Rtl819XFwImageArray_TSMC

[ 1781.972252] FirmwareDownload92C accquire FW from embedded image

[ 1781.972254] fw_ver=v88, fw_subver=2, sig=0x88c0

[ 1781.997582] fw download ok!

[ 1781.997584] Set RF Chip ID to RF_6052 and RF type to 2.

[ 1782.357738] IQK:Start!!!

[ 1782.369478] Path A IQK Success!!

[ 1782.374223] Path B IQK Success!!

[ 1782.382715] Path A IQK Success!!

[ 1782.387460] Path B IQK Success!!

[ 1782.392206] IQK: final_candidate is 0

[ 1782.392209] IQK: RegE94=ff RegE9C=6 RegEA4=f8 RegEAC=3fd RegEB4=102 RegEBC=e RegEC4=f8 RegECC=3fe

 Path A IQ Calibration Success !

[ 1782.394328] Path B IQ Calibration Success !

[ 1782.503976] pdmpriv->TxPowerTrackControl = 1

[ 1782.508596] rtl8192cu_hal_init in 541ms

[ 1782.516090] MAC Address = 10:c3:7b:cd:b5:5e

[ 1782.516214] -871x_drv - drv_open, bup=1

[ 1782.516244] IPv6: ADDRCONF(NETDEV_UP): enp0s29u1u3: link is not ready

[ 1782.516368] ip (3238) used greatest stack depth: 11960 bytes left

[ 1784.519567] ==>rtw_ps_processor .fw_state(0)

[ 1784.519572] ==>ips_enter cnts:1

[ 1784.519573] ===> rtw_ips_pwr_down...................

[ 1784.519814] ====> rtw_ips_dev_unload...

[ 1784.543168] usb_read_port_cancel

[ 1784.543477] usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

[ 1784.543665] usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

[ 1784.543949] usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

[ 1784.544195] usb_read_port_complete()-1284: RX Warning! bDriverStopped(0) OR bSurpriseRemoved(0) bReadPortCancel(1)

[ 1784.544207] usb_write_port_cancel 

[ 1784.544217] ==> rtl8192cu_hal_deinit 

[ 1784.544219] bkeepfwalive(0)

[ 1784.544220] card disble without HWSM...........

[ 1784.549162] <=== rtw_ips_pwr_down..................... in 30ms
```

Not sure what to make of all this...

----------

## yagami

honestly, neither do i.

I remember one time, i had a very "light" kernel, and was missing some wireless usb modules that caused the usb wireless to not work.

I dunno if that is the problem, but can give a few hints:

* check if the required kernel modules are compiled and available, ( test a system rescue cd for example or another distro, try to compile that module and see if it works. if it does, take notice of the modules used. )

* check if using wext use flag, rtl8192cu doesnt need it but 8192cu does

Also , there seems to be some other 8192cu fixes versions available on github, but i think they are all based on the same. 

Other than missing some wireless kernel modules, i never had much problem with using 8192cu module. ( my wireless adapter is a tp-link )

----------

## alienjon

I'll try to check the loaded modules in my livecd when I have a moment.  I am having an unrelated-to-my-wifi issue with my wireless xbox controller that, previously, was fixed by enabling a certain USB specific option.  Didn't fix it this time.  Might be related, but not really confident that it is.  I double checked my /etc/conf.d/net file and noticed that I never actually added an entry for this device.  I think it defaults to dhcp and wext, but specifying it didn't make a difference in the output.

----------

