freebsd-dev/sys
Adrian Chadd 8a5350984f Fix link status handling on if_arge upon system boot to allow bootp/NFS to
function.

From the submitter:

This patch fixes an issue I encountered using an NFS root with an
ar71xx-based MikroTik RouterBoard 450G on -current where the kernel fails
to contact a DHCP/BOOTP server via if_arge when it otherwise should be able
to.  This may be the same issue that Monthadar Al Jaberi reported against
an RSPRO on 6 March, as the signature is the same:

%%%

DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
.
.
.
DHCP/BOOTP timeout for server 255.255.255.255
DHCP/BOOTP timeout for server 255.255.255.255
arge0: initialization failed: no memory for rx buffers
DHCP/BOOTP timeout for server 255.255.255.255
arge0: initialization failed: no memory for rx buffers

%%%

The primary issue that I found is that the DHCP/BOOTP message that
bootpc_call() is sending never makes it onto the wire, which I believe is
due to the following:

- Last December, a change was made to the ifioctl that bootpc_call() uses
to adjust the netmask around the sosend().

- The new ioctl (SIOCAIFADDR) performs an if_init when invoked, whereas the
old one (SIOCSIFNETMASK) did not.

- if_arge maintains its own sense of link state in sc->arge_link_status.

- On a single-phy interface, sc->arge_link_status is initialized to 0 in
arge_init_locked().

- sc->arge_link_status remains 0 until a phy state change notification
causes arge_link_task to run, notice the link is up, and set it to 1.

- The inits caused by the ifioctls in bootpc_call are reinitializing the
interface, but not the phy, so sc->arge_link_status goes to 0 and remains
there.

- arge_start_locked() always sees sc->arge_link_status == 0 and returns
without queuing anything.

The attached patch changes arge_init_locked() such that in the single-phy
case, instead of initializing sc->arge_link_status to 0, it runs
arge_link_task() to set it according to the current phy state.  This change
has allowed my setup to mount an NFS root successfully.

Submitted by:	Patrick Kelsey <kelsey@ieee.org>
Reviewed by:	juli
2012-03-13 06:28:52 +00:00
..
amd64 Simplify the error checking in one branch of trap_pfault() and update 2012-03-12 00:47:13 +00:00
arm Disable the option VFS_ALLOW_NONMPSAFE by default on all the supported 2012-03-06 20:01:25 +00:00
boot Fix a bug introduced in r223938; on big-endian machines coping a 32-bit 2012-03-11 13:39:19 +00:00
bsm
cam Add LUN resizing to CTL. Also make it possible to explicitly set 2012-03-06 13:43:57 +00:00
cddl Analogous to r232059, add a parameter for the ZFS file system: 2012-02-26 16:30:39 +00:00
compat Fix race condition in KfRaiseIrql(). 2012-03-04 17:08:43 +00:00
conf Don't build kernel.tramp on Octeon. Probably building it should be opt-in 2012-03-13 06:22:49 +00:00
contrib Disable the Simple Executive's error decoding/reporting code. 2012-03-11 06:55:17 +00:00
crypto Add support for the extended FPU states on amd64, both for native 2012-01-21 17:45:27 +00:00
ddb Use strchr() and strrchr(). 2012-01-02 12:12:10 +00:00
dev Remove a stale comment. 2012-03-12 20:31:58 +00:00
fs Update comment. 2012-03-11 15:58:27 +00:00
gdb kern cons: introduce infrastructure for console grabbing by kernel 2011-12-17 15:08:43 +00:00
geom Remove unactionable message about label geometry 2012-03-08 01:48:44 +00:00
gnu/fs Remove fifo.h. The only used function declaration from the header is 2012-03-11 12:19:58 +00:00
i386 Simplify the error checking in one branch of trap_pfault() and update 2012-03-12 05:28:02 +00:00
ia64 Disable the option VFS_ALLOW_NONMPSAFE by default on all the supported 2012-03-06 20:01:25 +00:00
isa - There's no need to overwrite the default device method with the default 2011-11-22 21:28:20 +00:00
kern Allways call fdrop(). 2012-03-12 11:56:57 +00:00
kgssapi
libkern Implement extensions on top of standards instead of the other way around. 2012-01-03 07:05:30 +00:00
mips Fix link status handling on if_arge upon system boot to allow bootp/NFS to 2012-03-13 06:28:52 +00:00
modules Provide wbwd(4), a driver for the watchdog timer found on various 2012-03-06 18:44:52 +00:00
net - remove an extra parenthesis in a closing brace; 2012-03-11 17:35:12 +00:00
net80211 Add missing \n's. 2012-03-08 23:46:42 +00:00
netatalk Fix typos 2012-02-28 15:07:05 +00:00
netgraph Upgrade the netgraph vlan node to support 802.1q, encapsulation type, 2012-03-11 19:08:56 +00:00
netinet Fix VNET build broken by r232865. 2012-03-12 15:41:36 +00:00
netinet6 In nd6_options() ignore the RFC 6106 options completely rather than printing 2012-03-04 18:51:45 +00:00
netipsec Add multi-FIB IPv6 support to the core network stack supplementing 2012-02-03 13:08:44 +00:00
netipx Convert all users of IF_ADDR_LOCK to use new locking macros that specify 2012-01-05 19:00:36 +00:00
netnatm
netncp
netsmb Add unicode support to msdosfs and smbfs; original pathes from imura, 2011-11-18 03:05:20 +00:00
nfs Add multi-FIB IPv6 support to the core network stack supplementing 2012-02-03 13:08:44 +00:00
nfsclient Remove fifo.h. The only used function declaration from the header is 2012-03-11 12:19:58 +00:00
nfsserver Honor NFSv3 commit call (RFC 1813, Section 3.3.21) where when count is 0, 2011-12-15 02:26:53 +00:00
nlm jwd@ reported a problem via email to freebsd-fs@ on Aug 25, 2011 2012-01-31 02:11:05 +00:00
ofed Remove spurious 8bit chars, turning files into plain ASCII. 2012-01-15 13:23:54 +00:00
opencrypto
pc98 Disable the option VFS_ALLOW_NONMPSAFE by default on all the supported 2012-03-06 20:01:25 +00:00
pci Use correct Config registers for RTL8139 family. Unlike RTL8168 and 2012-02-25 04:54:51 +00:00
powerpc Add casts to __uint16_t to the __bswap16() macros on all arches which 2012-03-09 20:34:31 +00:00
rpc Both a crash reported on freebsd-current on Oct. 18 under the 2011-11-03 14:38:03 +00:00
security Remove direct access to si_name. 2012-02-10 12:35:57 +00:00
sparc64 Add casts to __uint16_t to the __bswap16() macros on all arches which 2012-03-09 20:34:31 +00:00
sys Tune cpuset macros to optimize cases when CPU_SETSIZE fits into single 2012-03-12 07:02:16 +00:00
teken
tools Make vnode_if.awk parse vnode operations with underscores, like VOP_FOO_BAR. 2012-02-21 19:35:59 +00:00
ufs Remove superfluous brackets. 2012-03-11 21:25:42 +00:00
vm Add KTR_VFS traces to track modifications to a vnode's writecount. 2012-03-08 20:27:20 +00:00
x86 Move i386's intr_machdep.c to the x86 tree and share it with amd64. 2012-03-09 20:43:29 +00:00
xdr
xen blkif interface comment cleanups. No functional changes 2012-02-29 17:47:01 +00:00
Makefile Improve the cscope target's handling of MD directories. Automatically 2012-01-03 17:31:27 +00:00