Bug 208597 - nfe, MCP79: up-down pingpong at boot time, but no dhcp
Summary: nfe, MCP79: up-down pingpong at boot time, but no dhcp
Status: Closed Not A Bug
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 10.3-BETA2
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Pyun YongHyeon
Depends on:
Reported: 2016-04-07 06:50 UTC by Harri
Modified: 2016-04-27 01:13 UTC (History)
1 user (show)

See Also:

screenshot (49.50 KB, image/jpeg)
2016-04-07 06:50 UTC, Harri
no flags Details
dmesg output (7.24 KB, text/plain)
2016-04-10 18:00 UTC, Harri
no flags Details
nfe(4) link patch (508 bytes, patch)
2016-04-11 01:24 UTC, Pyun YongHyeon
no flags Details | Diff
rgephy(4) link patch (844 bytes, patch)
2016-04-13 12:15 UTC, Pyun YongHyeon
no flags Details | Diff
ifconfig output immediately after boot (764 bytes, text/plain)
2016-04-18 17:07 UTC, Harri
no flags Details
/var/log/messages after manual "ifconfig nfe0 up" (11.40 KB, text/plain)
2016-04-18 17:08 UTC, Harri
no flags Details
ifconfig output after "ifconfig up" and manually configuring an IP address (837 bytes, text/plain)
2016-04-18 17:11 UTC, Harri
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Harri 2016-04-07 06:50:20 UTC
Created attachment 169066 [details]

Hi folks,

the nfe driver of FreeBSD 4.3 does some kind of up-down pingpong at boot time. DHCP is stuck in an endless loop. No login, unless I disconnect the ethernet cable . See the attached snapshot.

Hardware is MCP79. (Booting without ACPI fails; the kernel panics very early at boot time with "panic: running without device atpic requires a local APIC".)

Every helpful comment is highly appreciated. Regards
Comment 1 Harri 2016-04-09 10:17:26 UTC
PS: OpenBSD 5.9 does not show this problem.
Comment 2 Pyun YongHyeon freebsd_committer 2016-04-10 07:20:31 UTC
I guess you're using FreeBSD 10.3(not 4.3R, right?
Would you show me the output of dmesg(nfe(4) and its PHY driver only)?
BTW, I think this is the first report on link flipping. Did it ever work on previous FreeBSD releases?
Comment 3 Harri 2016-04-10 18:00:56 UTC
Created attachment 169159 [details]
dmesg output

Yes, 10.3 is correct. I am not sure where the 4.3 came from, sorry.

I did not try 10.2 or older on this device (Acer R3600 Revo). The installer image (FreeBSD-10.3-RELEASE-amd64-memstick.img.xz) seems to work fine, but of course I booted it only twice by now. The problem comes up when I try to run the just installed system.

dmesg output is attached.
Comment 4 Harri 2016-04-10 18:18:50 UTC
PS: If I switch it off and wait a few minutes before turning it on again, then it seems to work.
Comment 5 Pyun YongHyeon freebsd_committer 2016-04-11 01:24:09 UTC
Created attachment 169169 [details]
nfe(4) link patch

Thanks for the info.
Does attached diff make any difference for you?
Comment 6 Harri 2016-04-11 04:13:56 UTC
Do you have some step-1-2-3 guidelines how to clone the right source repository? Chapter 8 in the handbook doesn't tell, and the appendix A4 just explains how to install and use svn. 

Its not there :-(.
Comment 7 Pyun YongHyeon freebsd_committer 2016-04-11 04:31:02 UTC
(In reply to Harri from comment #6)
Did you install source code for kernel?
If the answer is YES, you don't need to use svnlite to fetch kernel sources.
If the answer is NO, you may have two options.
1. Install kernel sources from install media.
2. Use svnlite to fetch kernel sources(You don't need to install full-featured svn to get kernel sources).
   For svnlite, use the following repository.
   #cd /usr
   #svnlite co https://svn.FreeBSD.org/base/release/10.3.0 src

After getting kernel sources do the following.
   #cd /usr/src
   #patch -p0 < /path-to-diff/nfe.link.diff
   # rebuild kernel and reboot
Comment 8 Harri 2016-04-11 19:17:26 UTC
I didn't know the "https://svn.FreeBSD.org/base/release/10.3.0 src". Maybe it should be added to the wiki? 

I copied the GENERIC to CUSTOM, applied the patch and built a new kernel, as described in the handbook. After installing it and rebooting twice I still got the up-down-up-down, unfortunately. 

"uname -a" shows the expected "CUSTOM". AFAICT the nfe module is linked into the kernel, i.e. there is no chance for an old forgotten module file. /boot/kernel has only files created today.

Sorry to say, but it seems to me the patch did not help.
Comment 9 Pyun YongHyeon freebsd_committer 2016-04-12 07:15:13 UTC
(In reply to Harri from comment #8)
Thank a lot for testing.
Would you show me the output of 'devinfo -rv | rgephy'?
Comment 10 Harri 2016-04-12 17:44:38 UTC

rgephy0 pnpinfo oui=0xe04c model=0x11 rev=0x2 at phyno=1

Hope this helps.
Comment 11 Pyun YongHyeon freebsd_committer 2016-04-13 12:15:21 UTC
Created attachment 169285 [details]
rgephy(4) link patch

Thanks for the PHY information.
I've attached a diff that modifies link handling of rgephy(4).
Please revert previous diff(nfe.link.diff) and apply the new one(rgephy.link.diff) and let me know how it goes.
Comment 12 Harri 2016-04-13 19:25:42 UTC
(In reply to Pyun YongHyeon from comment #11)

Unfortunately there is no improvement.
Comment 13 Pyun YongHyeon freebsd_committer 2016-04-15 06:31:35 UTC
(In reply to Harri from comment #12)
Hmm, if you remove DHCP configuration in rc.conf and manually UP the interface without network configuration do you still see link UP/DOWN messages on console?
For instance, remove ifconfig_nfe0="DHCP" in /etc/rc.conf and reboot your box.
After logging in, try the following.
#ifconfig up nfe0
And see whether you still see link change messages.
Comment 14 Harri 2016-04-16 05:02:59 UTC
I have disabled IPv6 (SLAAC) in rc.conf. Now it doesn't get stuck at boot time anymore, as it seems. I still see the down-up-down-up, though. If I wait for DHCP to finish, then I can ifconfig nfe0 as expected, but it keeps on flipping as before. An explicit "ifconfig down; ifconfig up" does not help.

If I boot without DHCP and SLAAC, then I get the same. Its still flipping.

Of course I also tried different ports in my switch. No change. 

I had wiped out openBSD from this disk again, but booting Linux from USB stick the network seems to be fine.
Comment 15 Pyun YongHyeon freebsd_committer 2016-04-16 07:50:01 UTC
(In reply to Harri from comment #14)
It seems you still have some kind of network configuration.
What I wanted was to get system booted without *ANY* network
configuration(Uncommnet all network configuration in rc.conf).
After boot with UTP cable plugged in, you would get just lo0 and
nfe0 interfaces. Then do the dollowing.

#ifconfig nfe0
This will show current nfe0 status.

#ifconfig nfe0 up
This will UP the interface without ANY network configuration.

Wait 2 ~ 3 seconds and do:
#ifconfig nfe0
This will show current interface status after UP command above.
And watch you still see link flips.

Let me know the out of three ifconfig outputs.
Comment 16 Harri 2016-04-18 17:07:13 UTC
Created attachment 169443 [details]
ifconfig output immediately after boot

Both ifconfig_nfe0 and ifconfig_nfe0_ipv6 are commented out. After booting with the net cable plugged in the nfe0 interface was shown as "active". Link speed was 10mbit half-duplex. dmesg showed that the interface went up, too. The LEDs on my switch were off. See the attached output of ifconfig.

After waiting a few minutes I ran "ifconfig nfe0 up". ifconfig showed "no carrier" for a few seconds, then it showed "active" and 1000mbit full duplex. The LEDs on my switch went on. No flipping.

Using ifconfig I could configure a local IP address and copy /var/log/messages and the ifconfig output to another host to attach it here.

If there is yet another option to disable nfe0, then I haven't found it.
Comment 17 Harri 2016-04-18 17:08:22 UTC
Created attachment 169444 [details]
/var/log/messages after manual "ifconfig nfe0 up"
Comment 18 Harri 2016-04-18 17:11:24 UTC
Created attachment 169445 [details]
ifconfig output after "ifconfig up" and manually configuring an IP address
Comment 19 Pyun YongHyeon freebsd_committer 2016-04-19 06:31:13 UTC
(In reply to Harri from comment #16)
Thanks all detailed output for each ifconfig.
Because you don't see link flips in this configuration I started to think the link flips could be side effect of long link establishment time or other activities of network startup script.
How about using synchronous mode of dhclient? For example, in rc.conf,


This will make system wait until dhclient get a lease.
Comment 20 Harri 2016-04-19 17:51:19 UTC
Nope, SYNCDHCP doesn't help. Its still flipping.

Surely I can do a static IPv4 configuration of the interface. But as soon as I enable IPv6 autoconfiguration, it starts flipping again :-(.

What about the ifconfig showing "active" and "10mbit", even though nobody set nfe0 to "up"? Doesn't this show that the interface isn't properly initialized or reset?
Comment 21 Harri 2016-04-26 15:15:26 UTC
I tried 2 other switches: On both it worked fine. Even though there were 3 other hosts connected to the first switch, it seems to have a problem with the FreeBSD box. The new switches works for all.

Thanx *very* much for all your effort and patience in this case. I highly appreciate that.

Comment 22 Pyun YongHyeon freebsd_committer 2016-04-27 01:13:10 UTC
Good to know you narrowed down the issue.
Thanks a lot.