# The dreaded RTL8111/8168B, the r8168 driver and slow rates

## Zulon

Hi everyone,

So I've got one of the infamous R8168 Realtek ethernet NIC, which have some problems under Linux. After some research, I found out I had to use the r8168 driver for this card (and not the r8169 which still loads when nothing else is available), which I did. So now everything works fine... Sort of.

My download and upload rates are more than halved compared to what I should get. When I test (with eg. speedtest) I get something like 20M (often 15M) in download and 30M in upload, but if I test under Windows (everything is otherwise identical: same ethernet cable, same connection, at the same time of the day (well 5 min apart)...), I get 50M upload/download (which is what I expect). Where can it come from? Here is the relevant info (if you need more, ask, this is all I can think of):

```
~ # lspci -v

[...]

06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 06)

        Subsystem: Dell Device 04b6

        Flags: bus master, fast devsel, latency 0, IRQ 44

        I/O ports at 2000 [size=256]

        Memory at f1804000 (64-bit, prefetchable) [size=4K]

        Memory at f1800000 (64-bit, prefetchable) [size=16K]

        Capabilities: [40] Power Management version 3

        Capabilities: [50] MSI: Enable+ Count=1/1 Maskable- 64bit+

        Capabilities: [70] Express Endpoint, MSI 01

        Capabilities: [b0] MSI-X: Enable- Count=4 Masked-

        Capabilities: [d0] Vital Product Data

        Capabilities: [100] Advanced Error Reporting

        Capabilities: [140] Virtual Channel

        Capabilities: [160] Device Serial Number 00-00-00-00-00-00-00-00

        Kernel driver in use: r8168

        Kernel modules: r8168

~ # modinfo r8168

filename:       /lib/modules/3.2.1-gentoo-r2/net/r8168.ko

version:        8.028.00-NAPI

license:        GPL

description:    RealTek RTL-8168 Gigabit Ethernet driver

author:         Realtek and the Linux r8168 crew <netdev@vger.kernel.org>

srcversion:     638662AC20F4563725136BB

alias:          pci:v00001186d00004300sv00001186sd00004B10bc*sc*i*

alias:          pci:v000010ECd00008168sv*sd*bc*sc*i*

depends:        

vermagic:       3.2.1-gentoo-r2 SMP mod_unload 

parm:           eee_enable:int

parm:           speed:force phy operation. Deprecated by ethtool (8). (array of int)

parm:           duplex:force phy operation. Deprecated by ethtool (8). (array of int)

parm:           autoneg:force phy operation. Deprecated by ethtool (8). (array of int)

parm:           rx_copybreak:Copy breakpoint for copy-only-tiny-frames (int)

parm:           use_dac:Enable PCI DAC. Unsafe on 32 bit PCI slot. (int)

parm:           debug:Debug verbosity level (0=none, ..., 16=all) (int)

~ # mii-tool -v

eth0: negotiated 100baseTx-FD, link ok

  product info: vendor 00:07:32, model 17 rev 4

  basic mode:   autonegotiation enabled

  basic status: autonegotiation complete, link ok

  capabilities: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD

  advertising:  100baseTx-HD 10baseT-FD 10baseT-HD flow-control

  link partner: 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD

~ # ethtool eth0 

Settings for eth0:

        Supported ports: [ TP ]

        Supported link modes:   10baseT/Half 10baseT/Full 

                                100baseT/Half 100baseT/Full 

                                1000baseT/Full 

        Supported pause frame use: No

        Supports auto-negotiation: Yes

        Advertised link modes:  10baseT/Half 10baseT/Full 

                                100baseT/Half 100baseT/Full 

        Advertised pause frame use: No

        Advertised auto-negotiation: Yes

        Speed: 100Mb/s

        Duplex: Full

        Port: Twisted Pair

        PHYAD: 0

        Transceiver: internal

        Auto-negotiation: on

        MDI-X: Unknown

        Supports Wake-on: pumbg

        Wake-on: d

        Current message level: 0x00000033 (51)

                               drv probe ifdown ifup

        Link detected: yes

~ # ifconfig eth0 

eth0      Link encap:Ethernet  HWaddr 14:fe:b5:c2:2f:c8  

          inet addr:129.199.157.73  Bcast:129.199.159.255  Mask:255.255.252.0

          inet6 addr: fec0::a:16fe:b5ff:fec2:2fc8/64 Scope:Site

          inet6 addr: 2002:81c7:9d52:a:16fe:b5ff:fec2:2fc8/64 Scope:Global

          inet6 addr: fec0::b:16fe:b5ff:fec2:2fc8/64 Scope:Site

          inet6 addr: 2002:81c7:9f0f:b:16fe:b5ff:fec2:2fc8/64 Scope:Global

          inet6 addr: fe80::16fe:b5ff:fec2:2fc8/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:931762 errors:0 dropped:89 overruns:0 frame:0

          TX packets:558162 errors:0 dropped:4 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:1083491129 (1.0 GiB)  TX bytes:141377763 (134.8 MiB)

          Interrupt:44 Base address:0xe000 

~ # uname -a

Linux catamorphisme 3.2.1-gentoo-r2 #1 SMP Fri Jan 27 17:41:11 CET 2012 x86_64 Intel(R) Core(TM) i7-2630QM CPU @ 2.00GHz GenuineIntel GNU/Linux

```

----------

