Thursday, July 04, 2013

Fun with the r8169 driver on Linux and a RTL8102E NIC

My son's netbook has a Realtek RTL8102E fast ethernet controller which (on linux kernels <= 3.9.7) was handled by the, technically incorrect but just about works, r8169 built-in kernel module. However, installing linux kernel 3.9.8, the ethernet connection (eth0 in this case) just had LOTS of entries of the following form in the output of dmesg (roughly 6 seconds apart) :
...
eth0 link up
...
I worked out the regression range of the kernel to the following kernel change which was backported to 3.9.8 : r8169: fix offloaded tx checksum for small packets.

So, it's a linux kernel regression yeah? Well, I think so, yeah, a non-technical user of Linux (after upgrading) would be at a loss (and i'll consider logging a kernel bug or mentioning it on #linux). However, technically, you could argue it's not a bug, since really the r8169 module is not intended for this NIC, the correct module (r8101) can be found at the official Realtek website.

So, after downloading the correct driver from the Realtek website (and extracting to a r8101 folder), I installed in the usual way :
$ sudo apt-get install build-essential
...
$ cd r8101
$ sudo ./autorun.sh
autorun.sh will rmmod the r8169 module and load the r8101 module. Also, just to make sure that the r8169 module was never loaded, I manually blacklisted r8169 by adding "blacklist r8169" to /etc/modprobe.d/blacklist.conf. The only downside now, though, is that every kernel update will have to rerun the driver installer, but hey ho, I'd rather have the benefits of latest kernels and drivers.

Note, that at time of writing, the Realtek driver does not compile against a 3.10 kernel, but is fine against 3.9.9 (the latest 3.9.x stable kernel at time of writing).

No comments: