OpenWrt Forum Archive

Topic: No link on eth1 (wan) when connected after boot

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

When I boot my Dlink DIR-825 (OpenWRT BB R36083), it checks on link on eth1 (wan), if there is link, it continues and all is well in the world.

If however, it does not get link during boot, it seems to disable eth1, plugging/replugging ethernet into eth1 will not give me a link.

When I suffer from this problem, I've discovered that when I replug the cable once, then all is well in the world again.

I have 28 of these boxes, and many of them will not come back to life after power-failures because the switch they are connected to boot slower than the DIR-825, thus it is not ready to provide link when the DIR-825 is asking for it during it's own boot.

I've tried connecting eth1 to a Netgear Switch, HP Procurve Switch and my Intel desktop NIC without any difference in behavior.

How do I fix this?

Edit: "it seems like ifconfig eth1 up" is not necessary, all that is needed is an extra replug

(Last edited by SlimG on 26 Apr 2013, 08:46)

I have flashed it with OpenWRT AA 12.09, and still no change in behaviour

This is what I get when I run dmesg after boot, both before and after I plug in the ethernet connector (no change):

root@OpenWrt:/# dmesg
[    0.000000] Linux version 3.3.8 (blogic@Debian-60-squeeze-64-minimal) (gcc version 4.6.3 20120201 (prerelease) (Linaro GCC 4.6-2012.02) ) #1 Sat Mar 23 16:49:30 UTC 2013
[    0.000000] MyLoader: sysp=aaaa5554, boardp=aaaa5554, parts=aaaa5554
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Atheros AR7161 rev 2
[    0.000000] Clocks: CPU:680.000MHz, DDR:340.000MHz, AHB:170.000MHz, Ref:40.000MHz
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone PFN ranges:
[    0.000000]   Normal   0x00000000 -> 0x00004000
[    0.000000] Movable zone start PFN for each node
[    0.000000] Early memory PFN ranges
[    0.000000]     0: 0x00000000 -> 0x00004000
[    0.000000] On node 0 totalpages: 16384
[    0.000000] free_area_init_node: node 0, pgdat 802f1100, node_mem_map 81000000
[    0.000000]   Normal zone: 128 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 16256 pages, LIFO batch:3
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line:  board=DIR-825-B1 console=ttyS0,115200 mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware),64k@0x7f0000(caldata_copy) rootfstype=squashfs,jffs2 noinitrd
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 61488k/65536k available (2211k kernel code, 4048k reserved, 418k data, 212k init, 0k highmem)
[    0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Calibrating delay loop... 452.19 BogoMIPS (lpj=2260992)
[    0.060000] pid_max: default: 32768 minimum: 301
[    0.060000] Mount-cache hash table entries: 512
[    0.070000] NET: Registered protocol family 16
[    0.070000] gpiochip_add: registered GPIOs 0 to 15 on device: ath79
[    0.080000] MIPS: machine is D-Link DIR-825 rev. B1
[    0.380000] registering PCI controller with io_map_base unset
[    2.690000] bio: create slab <bio-0> at 0
[    2.690000] PCI host bridge to bus 0000:00
[    2.700000] pci_bus 0000:00: root bus resource [mem 0x10000000-0x16ffffff]
[    2.700000] pci_bus 0000:00: root bus resource [io  0x0000]
[    2.710000] pci 0000:00:11.0: [168c:ff1d] type 0 class 0x000200
[    2.710000] pci 0000:00:11.0: fixup device configuration
[    2.710000] pci 0000:00:11.0: reg 10: [mem 0x00000000-0x0000ffff]
[    2.710000] pci 0000:00:11.0: PME# supported from D0 D3hot
[    2.710000] pci 0000:00:12.0: [168c:ff1d] type 0 class 0x000200
[    2.710000] pci 0000:00:12.0: fixup device configuration
[    2.720000] pci 0000:00:12.0: reg 10: [mem 0x00000000-0x0000ffff]
[    2.720000] pci 0000:00:12.0: PME# supported from D0 D3hot
[    2.720000] pci 0000:00:11.0: BAR 0: assigned [mem 0x10000000-0x1000ffff]
[    2.720000] pci 0000:00:12.0: BAR 0: assigned [mem 0x10010000-0x1001ffff]
[    2.730000] pci 0000:00:11.0: using irq 40 for pin 1
[    2.730000] pci 0000:00:12.0: using irq 41 for pin 1
[    2.740000] Switching to clocksource MIPS
[    2.740000] NET: Registered protocol family 2
[    2.750000] IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
[    2.750000] TCP established hash table entries: 2048 (order: 2, 16384 bytes)
[    2.760000] TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
[    2.760000] TCP: Hash tables configured (established 2048 bind 2048)
[    2.770000] TCP reno registered
[    2.770000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    2.780000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    2.780000] NET: Registered protocol family 1
[    2.790000] PCI: CLS 0 bytes, default 32
[    2.800000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    2.810000] JFFS2 version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    2.820000] msgmni has been set to 120
[    2.820000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
[    2.830000] io scheduler noop registered
[    2.830000] io scheduler deadline registered (default)
[    2.840000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    2.870000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11) is a 16550A
[    2.870000] console [ttyS0] enabled, bootconsole disabled
[    2.890000] m25p80 spi0.0: found m25p64, expected m25p80
[    2.890000] m25p80 spi0.0: m25p64 (8192 Kbytes)
[    2.900000] 8 cmdlinepart partitions found on MTD device spi0.0
[    2.900000] Creating 8 MTD partitions on "spi0.0":
[    2.910000] 0x000000000000-0x000000040000 : "uboot"
[    2.910000] 0x000000040000-0x000000050000 : "config"
[    2.920000] 0x000000050000-0x000000150000 : "kernel"
[    2.930000] 0x000000150000-0x000000660000 : "rootfs"
[    2.930000] mtd: partition "rootfs" set to be root filesystem
[    2.940000] mtd: partition "rootfs_data" created automatically, ofs=320000, len=340000 
[    2.950000] 0x000000320000-0x000000660000 : "rootfs_data"
[    2.950000] 0x000000660000-0x000000670000 : "caldata"
[    2.960000] 0x000000670000-0x000000800000 : "unknown"
[    2.970000] 0x000000050000-0x000000660000 : "firmware"
[    2.970000] 0x0000007f0000-0x000000800000 : "caldata_copy"
[    2.980000] Realtek RTL8366S ethernet switch driver version 0.2.2
[    2.990000] rtl8366s rtl8366s: using GPIO pins 5 (SDA) and 7 (SCK)
[    2.990000] rtl8366s rtl8366s: RTL8366 ver. 1 chip found
[    3.020000] rtl8366s rtl8366s: applying initvals
[    3.030000] rtl8366s: probed
[    3.050000] ag71xx_mdio: probed
[    3.050000] eth0: Atheros AG71xx at 0xb9000000, irq 4
[    3.360000] eth1: Atheros AG71xx at 0xba000000, irq 5
[    3.670000] ag71xx ag71xx.1: eth1: connected to PHY at rtl8366s:04 [uid=001cc960, driver=Generic PHY]
[    3.680000] TCP cubic registered
[    3.680000] NET: Registered protocol family 17
[    3.680000] Bridge firewalling registered
[    3.690000] 8021q: 802.1Q VLAN Support v1.8
[    3.700000] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    3.700000] Freeing unused kernel memory: 212k freed
[    5.110000] ar71xx: pll_reg 0xb8050010: 0x11110000
[    5.110000] eth0: link up (1000Mbps/Full duplex)
[    5.130000] Registered led device: d-link:blue:usb
[    5.130000] Registered led device: d-link:orange:power
[    5.130000] Registered led device: d-link:blue:power
[    5.130000] Registered led device: d-link:blue:wps
[    5.140000] Registered led device: d-link:orange:planet
[    5.140000] Registered led device: d-link:blue:planet
[    8.340000] JFFS2 notice: (606) jffs2_build_xattr_subsystem: complete building xattr subsystem, 1 of xdatum (0 unchecked, 0 orphan) and 12 of xref (0 dead, 2 orphan) found.
[    8.470000] eth0: link down
[    9.570000] Compat-drivers backport release: compat-drivers-2012-09-04-2-gddac993
[    9.580000] Backport based on wireless-testing.git master-2012-09-07
[    9.590000] compat.git: wireless-testing.git
[    9.610000] cfg80211: Calling CRDA to update world regulatory domain
[    9.610000] cfg80211: World regulatory domain updated:
[    9.620000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[    9.630000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.630000] cfg80211:   (2457000 KHz - 2482000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    9.640000] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
[    9.650000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.660000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[    9.880000] usbcore: registered new interface driver usbfs
[    9.890000] usbcore: registered new interface driver hub
[    9.890000] usbcore: registered new device driver usb
[   10.270000] PCI: Enabling device 0000:00:11.0 (0000 -> 0002)
[   10.280000] ath: EEPROM regdomain: 0x0
[   10.280000] ath: EEPROM indicates default country code should be used
[   10.280000] ath: doing EEPROM country->regdmn map search
[   10.280000] ath: country maps to regdmn code: 0x3a
[   10.280000] ath: Country alpha2 being used: US
[   10.280000] ath: Regpair used: 0x3a
[   10.280000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
[   10.290000] Registered led device: ath9k-phy0
[   10.290000] ieee80211 phy0: Atheros AR9280 Rev:2 mem=0xb0000000, irq=40
[   10.290000] PCI: Enabling device 0000:00:12.0 (0000 -> 0002)
[   10.300000] ath: phy1: eeprom contains invalid mac address: 99:32:40:60:20:10
[   10.310000] ath: phy1: random mac address will be used: 06:21:22:bd:ce:af
[   10.320000] ath: EEPROM regdomain: 0x0
[   10.320000] ath: EEPROM indicates default country code should be used
[   10.320000] ath: doing EEPROM country->regdmn map search
[   10.320000] ath: country maps to regdmn code: 0x3a
[   10.320000] ath: Country alpha2 being used: US
[   10.320000] ath: Regpair used: 0x3a
[   10.320000] ieee80211 phy1: Selected rate control algorithm 'minstrel_ht'
[   10.330000] Registered led device: ath9k-phy1
[   10.330000] ieee80211 phy1: Atheros AR9280 Rev:2 mem=0xb0010000, irq=41
[   10.330000] cfg80211: Calling CRDA for country: US
[   10.340000] cfg80211: Regulatory domain changed to country: US
[   10.350000] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
[   10.350000] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
[   10.360000] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
[   10.370000] cfg80211:   (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[   10.380000] cfg80211:   (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[   10.380000] cfg80211:   (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
[   10.390000] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
[   10.420000] PPP generic driver version 2.4.2
[   10.580000] ip_tables: (C) 2000-2006 Netfilter Core Team
[   10.710000] NET: Registered protocol family 24
[   10.730000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   10.730000] ehci-platform ehci-platform: Generic Platform EHCI Controller
[   10.740000] ehci-platform ehci-platform: new USB bus registered, assigned bus number 1
[   10.780000] ehci-platform ehci-platform: irq 3, io mem 0x1b000000
[   10.800000] ehci-platform ehci-platform: USB 2.0 started, EHCI 1.00
[   10.800000] hub 1-0:1.0: USB hub found
[   10.810000] hub 1-0:1.0: 2 ports detected
[   10.820000] nf_conntrack version 0.5.0 (964 buckets, 3856 max)
[   10.960000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[   10.970000] ohci-platform ohci-platform: Generic Platform OHCI Controller
[   10.980000] ohci-platform ohci-platform: new USB bus registered, assigned bus number 2
[   10.990000] ohci-platform ohci-platform: irq 14, io mem 0x1c000000
[   11.050000] hub 2-0:1.0: USB hub found
[   11.050000] hub 2-0:1.0: 2 ports detected
[   13.140000] rtl8366s rtl8366s: applying initvals
[   13.650000] ar71xx: pll_reg 0xb8050010: 0x11110000
[   13.650000] eth0: link up (1000Mbps/Full duplex)
[   13.670000] device eth0.1 entered promiscuous mode
[   13.670000] device eth0 entered promiscuous mode
[   13.680000] br-lan: port 1(eth0.1) entered forwarding state
[   13.680000] br-lan: port 1(eth0.1) entered forwarding state
[   15.680000] br-lan: port 1(eth0.1) entered forwarding state

After I plug out and back in the ethernet cable again, the following two entries are appended to my dmesg output:

[  400.890000] ar71xx: pll_reg 0xb8050014: 0x11110000
[  400.890000] eth1: link up (1000Mbps/Full duplex)

After this last action has been performed, link is established and network works as it should.

None of the other ports (1-4) have this problem.

Here is the default unaltered config it's running (/etc/config/network):

config interface 'loopback'                                                                                                                    
        option ifname 'lo'                                                                                                                     
        option proto 'static'                                                                                                                  
        option ipaddr '127.0.0.1'                                                                                                              
        option netmask '255.0.0.0'                                                                                                             
                                                                                                                                               
config interface 'lan'                                                                                                                         
        option ifname 'eth0.1'                                                                                                                 
        option type 'bridge'                                                                                                                   
        option proto 'static'                                                                                                                  
        option ipaddr '192.168.1.1'                                                                                                            
        option netmask '255.255.255.0'                                                                                                         
                                                                                                                                               
config interface 'wan'                                                                                                                         
        option ifname 'eth1'                                                                                                                   
        option proto 'dhcp'                                                                                                                    
                                                                                                                                               
config switch                                                                                                                                  
        option name 'rtl8366s'                                                                                                                 
        option reset '1'                                                                                                                       
        option enable_vlan '1'                                                                                                                 
                                                                                                                                               
config switch_vlan                                                                                                                             
        option device 'rtl8366s'                                                                                                               
        option vlan '1'                                                                                                                        
        option ports '0 1 2 3 5t'

Here is the output of "ethtool eth1" after booting wihout eth1 connected:

Settings for eth1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 10Mb/s
        Duplex: Half
        Port: MII
        PHYAD: 4
        Transceiver: external
        Auto-negotiation: on
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: no

Here is the output after eth1 has been connected:

Settings for eth1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 100Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 4
        Transceiver: external
        Auto-negotiation: on
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: no

The output after eth1 has been diconnected is the same as the first output after boot without ethernet connected.

Here is the output after eth1 has been connected the second time:

Settings for eth1:
        Supported ports: [ TP MII ]
        Supported link modes:   10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Supported pause frame use: No
        Supports auto-negotiation: Yes
        Advertised link modes:  10baseT/Half 10baseT/Full 
                                100baseT/Half 100baseT/Full 
                                1000baseT/Half 1000baseT/Full 
        Advertised pause frame use: No
        Advertised auto-negotiation: Yes
        Speed: 1000Mb/s
        Duplex: Full
        Port: MII
        PHYAD: 4
        Transceiver: external
        Auto-negotiation: on
        Current message level: 0x000000ff (255)
                               drv probe link timer ifdown ifup rx_err tx_err
        Link detected: yes

What I can see is that "Speed" and "Link detected" is the only changing variables.

I have flashed it with OpenWRT Backfire 10.03.1, and still no change in behaviour

Instead of replugging the ethernet cable, I've found that the following does the same (fixes the problem):

mii-tool --restart eth1

Does anyone know how to fix this problem permanently?

The discussion might have continued from here.