# Realtek 8168B: Which driver? In kernel or Realtek's?

## jasn

Does anyone know if this makes a difference? I've got a Clevo W870CU which has the following wired ethernet port;

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

using the following in kernel driver from 2.6.33;

```
filename:       /lib/modules/2.6.33-gentoo/kernel/drivers/net/r8169.ko

version:        2.3LK-NAPI

license:        GPL

description:    RealTek RTL-8169 Gigabit Ethernet driver

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

srcversion:     DCEAD93CF882810D5F7DD29

alias:          pci:v00000001d00008168sv*sd00002410bc*sc*i*

alias:          pci:v00001737d00001032sv*sd00000024bc*sc*i*

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

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

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

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

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

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

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

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

depends:        mii

vermagic:       2.6.33-gentoo SMP preempt mod_unload 

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)
```

I ask because I've run into some problems with the ethernet port link continuously going up and down, and I'm curious if the driver could have anything to do with this. This continuous cycling of the ethernet link going up and then down, got so bad that I was seconds away from boxing it up and sending it back for RMA repair. I then tried a PXE boot, (just to see if that part worked ok), and the PXE boot messages seemed normal. I then rebooted normally, and so far the ethernet port has worked without any link "flapping" behavior. Having said that, not only is there no PXE server here, I'm not even sure doing that had anything to do with "fixing" this issue, or even if it's fixed. So it's not consistent behavior, but this very well may be failing hardware even though the laptop is only 3 months old.

The reason for posting this question here, is that looking around the internet I noticed more Realtek wired ethernet Linux issues, (even some Windows ones), and I read from this Ubuntu thread that there's a recommendation to download the Realtek Linux driver for the 8168 from the Realtek support website, and use that instead of the in kernel 8169 module. Does anyone know if this still holds true with 2.6.33? Or in general what's the story with Realtek Linux wired ethernet drivers?

Lastly any recommendations on ethernet diagnostic/stress testing tools would be appreciated. If it's failing hardware, I'd like to confirm it, rather than wait for it to die again.

Thanks..

----------

## doctork

I've been using the kernel supplied driver for the 8168B since June 2008. I've never had a problem with this through kernel 2.6.32-gentoo-r5.  This is on an MSI K9A2 Platinum motherboard with a AMD Phenom 9550.

You might try net-misc/iperf as a stress test. 

--

doc

----------

## jasn

I'm trying the Realtek linux driver downloaded from the Realtek website support page, (which is named r8168 btw), and I'll see if it makes any difference at all. So far no more port flapping, but again it had stopped while I was using the in kernel r8169 as well. I'll try it and see if anything of note develops while using it. Also thanks for the iperf suggestion. I set it up on in server mode on my Gentoo filer here, and I can test my network throughput pretty much from any machine now.

Thanks..

----------

## madal

Hate to revive a dormant post but.......I can emphatically say that one should use the Realtek driver. The built-in kernel module works, but that's about all it does. I just built a Sandy Bridge box, MSI mobo w/ the Realtek 8168B. Here's what I found while watching my gnome system monitor (GigE Samba server + GigE switch + Cat6 cable yadda-yadda-yadda):

Built-in 8169

File transfer from Samba Server max speed = about 800KB/s

Streaming video from same Samba server max speed = 87.5 KB/s (yes, that's KILObytes). All video was unwatchable, and watching the graph in the system monitor showed an absolutely flat line @ 87KB/s.

Realtek driver

File transfer from (same) Samba Server max speed = about 47MB/s

Streaming video from (same) Samba server = peaked at about 4MB/s, never got to a maximum cutoff like above. All video was now smooth, even H264 stuff.

It was like night and day.

So, if you have an r8168 in your system, take the 5 minutes to recompile kernel, download the driver, build module, and install it. Here's sort of a "how to" taken from https://forums.gentoo.org/viewtopic-t-462360.html

1. Recompile kernel SANS built-in 8169

2. Download driver from Realtek's website

3. extract "r8168-*.tar.bz2" folder to /usr/src/linux 

4. 

```
cd /usr/src/linux/r8168-*
```

5. check to see if you have a folder named '/lib/modules/<kernel version>/kernel/drivers/net' if not: 

```
mkdir /lib/modules/<kernel version>/kernel/drivers/net
```

6. build the module: 

```
make clean modules

make install

depmod -a
```

7. 

```
echo 'r8168' >>  /etc/modules.autoload.d/kernel-2.6
```

8. Reboot

What really chaffs my wheat about all of this is that the 8168 is a very popular and fairly capable network chip, and no one (Realtek) has gotten around to putting the right stuff in the kernel. The internet (particularly the Ubuntu boards) are strewn with "slow Samba" complaints. If they post their lspci, more than likely you'll see an 8168. I guess I'm lucky that I didn't have to go to "Plan C," which it seems that many of them have done. That is, buying another NIC. The Intels seem to be popular choices.........

madal

----------

## aceFruchtsaft

I just got a motherboard with 

```

lspci | grep -i real

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

```

and ran a few benchmarks after finding this thread:

SMB Client (samba 3.5.x client and server), server had RAID5, client used tmpfs to avoid hard disk bottle necks:

reading a 1.5 GB file from server:   105420,3 KiloBytes/sec

writing the same file back: 97183,9 kb/s

For NFS3 with same testing setup the speeds were ~ 72.000 kbyte/s and 64.000kbyte/s.

Using netperf the result was

```

Recv   Send    Send                                                                                                 

Socket Socket  Message  Elapsed                                                                                     

Size   Size    Size     Time     Throughput                                                                         

bytes  bytes   bytes    secs.    KBytes/sec                                                                         

                                                                                                                    

 87380  16384  16384    10.01    114723.06 

```

which is pretty close to the theoretical maximum.

I cannot say much about stability yet, but so far the NIC seems to perform just as well as the previous one using the in-kernel 8169.ko driver.

The last thing I'd want to use is an external driver. C'mon, this is 2011.

// Update: After using the in-kernel driver for ~ 2 weeks now I had no stability problems whatsover with the kernel 2.6.38.x series.Last edited by aceFruchtsaft on Mon May 02, 2011 6:36 pm; edited 1 time in total

----------

## Ant P.

If I hadn't seen this post I never would've even realised I have a "broken" chipset, because it's worked fine for me so far. Using 100Mbps and I can max it out on the LAN no problem...

----------

## frostschutz

I have one of these in a root server:

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

In kernel r8169 driver worked fine for me in 2.6.34, stopped working in 2.6.35-2.6.37 (hiccups on the host network causing KVM guests to get stuck), started working again in 2.6.38.

So in short, every time I upgrade the kernel, I have to test the network in case it breaks again.

I never actually tried Realtek's driver, because I prefer to not use third party modules if I can help it at all, and the in kernel driver does work fine for me in certain kernel versions.

If it wasn't a remote server but a local box, I'd spend some € for an Intel or otherwise non-broken network card. Unfortunately, for the server this would cost me an extra 15€ - per month.

----------

