[CentOS] Disable autoneg on r8169?

Tue Dec 20 05:36:40 UTC 2011
Scott Johnson <scottej23 at gmail.com>

Two problems I hope to solve:

1. The switch being used has autoneg off and has port set to 100 full duplex.
2. Many times NIC fails to come up properly during PXE boot:
r8169: eth0: link down
ADDRCONF(NETDEV_UP): eth0: link is not ready

I can't use ethtool to disable autoneg because the nic driver is built
into a bzImage.  The root fs is currently being mounted via nfs during
pxeboot at speed 10, half-duplex.  In the past for sk98lin driver I
could pass a kernel module parameter sk98lin.ConType=100FD on the
kernel boot line.

I looked at the r8169.c and tried to hard code the default to autoneg
off but that didn't work.

--- linux-2.6.18-274.12.1.el5.i686/drivers/net/r8169.c
+++ disable-autoneg/drivers/net/r8169.c
@@ -2814,7 +2814,8 @@
         * rtl8169_set_speed_xmii takes good care of the Fast Ethernet
         * only 8101. Don't panic.
-       rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL);
+       //rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL);
+       rtl8169_set_speed(dev, AUTONEG_DISABLE, SPEED_100, DUPLEX_FULL);

        if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
                printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);

Any other ideas?