Monday 26 August 2013

Breaking Change to Realtek r8168 drivers

If you have ever installed the linux kernel manually you might have encountered an issue with the r8168 drivers for your ethernet port. Specifically my
3:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)

I found that I have to download and install them directly from realtek since - perhaps - my .config wasn't correct. I downloaded version r8168-8.036.00.

Nevertheless, when I tried to install the drivers for 3.11.0-rc7 I found that they didn't compile:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
r8168-8.036.00/src/r8168_n.c: In function ‘rtl8168_rx_vlan_skb’:
r8168-8.036.00/src/r8168_n.c:2237:9: error: too few arguments to function ‘__vlan_hwaccel_put_tag’
In file included from r8168-8.036.00/src/r8168_n.c:46:0:
include/linux/if_vlan.h:236:31: note: declared here
r8168-8.036.00/src/r8168_n.c: In function ‘rtl8168_hw_set_features’:
8168-8.036.00/src/r8168_n.c:2298:25: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
r8168-8.036.00/src/r8168_n.c:2298:25: note: each undeclared identifier is reported only once for each function it appears in
r8168-8.036.00/src/r8168_n.c: In function ‘rtl8168_init_one’:
r8168-8.036.00/src/r8168_n.c:16198:26: error: ‘NETIF_F_HW_VLAN_TX’ undeclared (first use in this function)
r8168-8.036.00/src/r8168_n.c:16198:47: error: ‘NETIF_F_HW_VLAN_RX’ undeclared (first use in this function)
make[3]: *** [r8168-8.036.00/src/r8168_n.o] Error 1

So it appears there are 2 issues.

  1. The first is that the number of arugments for __vlan_hwaccel_put_tag is wrong. This appears to be a breaking change to if_vlan.h in the kernel introduced here. So AFAIK the quick fix is just to add an extra parameter indicating the protocol. Here, I think you put  htons(ETH_P_8021Q) but someone much wiser can correct me there. That's what I put and it seemed to work for me.
  2. The second issue is that a #define has been renamed. The NETIF_F_HW_VLAN_{R,T}X defines have been changed to NETIF_F_HW_VLAN_CTAG_{R,T}X in this change.
The patch can be found here.

This isn't the most scalable of fixes since it's not backwards compatible so I guess the vendor will have to apply to kung-foo using the KERNEL_VERSION macro. I didn't bother to look at exactly which kernel version this was broken in.

HTH.

Installing Linux kernel from source

I thought I would try my hand at a little bit of linux kernel programming.

So, I followed the instructions found here: http://kernelnewbies.org/KernelBuild

Everything went pretty smoothly for the install part. git clone and then compile and install. This was all fine.

I then did a reboot and have since then, come across two problems.

  1. No ethernet. That is, my eth0 interface would not appear with a `sudo ifconfig -a`.
  2. No FUSE (can't mount ntfs file-system)

The fixes are:

No ethernet: for some reason the wrong driver comes installed for me. I have (from lspci):
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 06)

but the 8169 drivers apparently got installed. I thus followed the guide listed at: http://ubuntuforums.org/showthread.php?t=1634291
Which involved downloading an installing the proper driver from the realtek website.

For problem two, it turns out that the default config for the linux kernel decides that FUSE should not be loaded at boot. To fix this, you simply edit /boot/config-xxxx for your running kernel and add the line
CONFIG_FUSE_FS=y
and that fixes it.

Undoubtedly more to come...

Can we just autofill city and state? Please!

Coming from a country that is not the US where zip/postal codes are hyper specific, it always drives me nuts when you are filling in a form ...