Realtek network card stability issue, and latest driver compilation issue

Hi,

I have a few servers with on board a Realtek network card but most of them are facing reliability issues during large transfers such as >20 MB/s over NFS or Samba. The network interface suddenly become disconnected and the only solution is to reboot the server.

The problem will occur even with or without the following tuning:
Code:
> kern.ipc.somaxconn=2048
> kern.ipc.nmbclusters=32768
> 
> kern.ipc.maxsockbuf=8388608
> net.inet.tcp.sendbuf_max=16777216
> net.inet.tcp.recvbuf_max=16777216
> net.inet.tcp.inflight.enable=0
> net.inet.tcp.sendspace=65536
> net.inet.tcp.recvspace=65536
> net.inet.udp.recvspace=65536
> net.inet.tcp.inflight.enable=0
> net.inet.tcp.rfc1323=1
> net.inet.tcp.sack.enable=1
> net.inet.tcp.path_mtu_discovery=1
> net.inet.tcp.sendbuf_auto=1
> net.inet.tcp.sendbuf_inc=16384
> net.inet.tcp.recvbuf_auto=1
> net.inet.tcp.recvbuf_inc=524288

Trying on FreeBSD 9.0, 9.1 and 9.2-RC1, problem still persist.
On board network card is RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet

Downloading the latest driver from Realtek website however having problem on make depend.
Code:
root@nas:/usr/src/sys/i386/compile/GENERIC # make depend
cc -c -O -pipe -std=c99 -g -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual -Wundef -Wno-pointer-sign -fformat-extensions -Wmissing-include-dirs -fdiagnostics-show-option -nostdinc -I. -I../../.. -I../../../contrib/altq -I../../../contrib/ipfilter -I../../../contrib/pf -I../../../dev/ath -I../../../dev/ath/ath_hal -I../../../contrib/ngatm -I../../../dev/twa -I../../../gnu/fs/xfs/FreeBSD -I../../../gnu/fs/xfs/FreeBSD/support -I../../../gnu/fs/xfs -I../../../dev/cxgb -I../../../dev/cxgbe -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -finline-limit=8000 --param inline-unit-growth=100 --param large-function-growth=1000 -mno-align-long-strings -mpreferred-stack-boundary=2 -mno-mmx -mno-sse -msoft-float -ffreestanding -fstack-protector ../../../i386/i386/genassym.c
../../../i386/i386/genassym.c:1: error: -mpreferred-stack-boundary=2 is not between 4 and 12
*** [genassym.o] Error code 1

below is the instruction of driver compilation
Code:
=================================================================================
=  Realtek 8169S/8169SB/8169SC/8168B/8168C/8168CP/8168D/8168DP8168E/8168F       =
=  8168FB/8168G/818GU/8168EP/8411                                               =
=  8101E/8102E/8103E/8401/8105E/8106E/8402 Driver                               =
=  for FreeBSD v4.x/5.x/6.x/7.x/8.x/9.x                                         =
=================================================================================

This driver is modified by Realtek Semiconductor corp. and it has been tested OK
on FreeBSD v5.4, FreeBSD v6.4, FreeBSD v7.3, FreeBSD v8.0, and FreeBSD v9.0. To
update the driver, you may use method 1. If method 1 failed, you must use method 2
which is more complex.

Method 1:
	1.Copy if_re.ko in "modules" directory to "/modules" directory and overwrite 
	  the existing file.
	2.Modify the file "/boot/defaults/loader.conf" and set "if_re_load" in "Network 
	  drivers" section to "Yes"
	3.Reboot.

Method 2:
	Because the FreeBSD kernel has default drivers to support RTL8139C and RTL8169S. To use the RTL8139C+, RTL8169SB, RTL8169SC, RTL8168B, and RTL8101E, you need to update your NIC driver by recompiling your FreeBSD kernel.

	The main steps you have to do:(FreeBSDSrcDir means the directory of FreeBSD source code
	and it may be "/usr/src/sys")

		1. keep the orginal driver source code:
			# cd /usr/src/sys/dev/re
			# cp if_re.c if_re.c.org
			
			# cd /usr/src/sys/modules
			# cp Makefile Makefile.org
			
			# cd /usr/src/sys/modules/re
			# cp Makefile Makefile.org
			
			# cd /usr/src/sys/i386/conf/
			# cp GENERIC GENERIC.org
			
		2. recompile your kernel (you must install your FreeBSD source code first !!)
			# vim /usr/src/sys/i386/conf/GENERIC and delete re
			# vim /usr/src/sys/modules/Makefile and delete re
			# cd /usr/src/sys/i386/conf
			# /usr/sbin/config GENERIC
			
			(for FreeBSD 5.x/6.x/7.x/8.x/9.x)
			# cd ../compile/GENERIC
			(for FreeBSD 4.x)
			# cd ../../compile/GENERIC

			# make cleandepend
			# make depend
			# make
			# make install
			# reboot
		
		3. update the driver source code:
		    Copy the dirver source code( if_re.c and if_rereg.h) into /usr/src/sys/dev/re
		    Copy the Makefile into /usr/src/sys/modules/re
		    
		4. build the driver:
			# cd /usr/src/sys/modules/re
			# make clean
			# make
		
		5. install the driver
			# cd /usr/src/sys/modules/re
			# kldload ./if_re.ko
			
		6. configurate the static IP address
			# ifconfig re0 xxx.xxx.xxx.xxx
			
		7. configurate the IP address by DHCP
			# /sbin/dhclient re0

The user can use the following command to change link speed and duplexmode.
	1. For auto negotiation,
		#ifconfig re<device_num> media autoselect

	2. For 1000Mbps full-duplex,
		#ifconfig re<device_num> media 1000baseTX mediaopt full-duplex

	3. For 100Mbps full-duplex,
		#ifconfig re<device_num> media 100baseTX mediaopt full-duplex

	4. For 100Mbps half-duplex,
		#ifconfig re<device_num> media 100baseTX -mediaopt full-duplex

	5. For 10Mbps full-duplex,
		#ifconfig re<device_num> media 10baseT/UTP mediaopt full-duplex

	6. For 10Mbps half-duplex,
		#ifconfig re<device_num> media 10baseT/UTP -mediaopt full-duplex

Any solution? Or will FreeBSD 9.2-Released includes the latest Realtek NIC driver?
 
After deep investigation, I think the problem doesn't relate to FreeBSD because the system kept crashing randomly even running Linux and ESXi.
 
Back
Top