freebsd-skq/sys/mips/atheros
adrian a7180c207d 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
..
apb.c - Rename apb_intr to apb_filter since it's a filter handler 2012-03-12 01:23:09 +00:00
apbvar.h - Add intr counters for APB interrupts 2009-11-18 22:53:05 +00:00
ar71xx_bus_space_reversed.c - Handle byte-order issue for non-word accesses to memory mapped 2009-04-19 22:56:35 +00:00
ar71xx_bus_space_reversed.h - Handle byte-order issue for non-word accesses to memory mapped 2009-04-19 22:56:35 +00:00
ar71xx_chip.c Style(9) changes. 2011-12-13 05:13:51 +00:00
ar71xx_chip.h Preparation work for supporting the AR91xx and AR724x. 2010-08-19 02:03:12 +00:00
ar71xx_cpudef.h Join chip depended methods for arge0 and arge1 into single call with unit. 2011-11-27 11:15:59 +00:00
ar71xx_ehci.c Implement better support for USB controller suspend and resume. 2011-12-14 00:28:54 +00:00
ar71xx_gpio.c Remove these locks - they aren't strictly needed and cause measurable 2011-12-20 00:33:56 +00:00
ar71xx_gpiovar.h Fix GPIO_MAXPINS calculation for the AR71xx, AR724x, AR913x SoC. 2011-05-06 02:45:02 +00:00
ar71xx_machdep.c Remove platform APIs which are not used by any code and which had only stub 2012-03-12 07:34:15 +00:00
ar71xx_ohci.c Implement better support for USB controller suspend and resume. 2011-12-14 00:28:54 +00:00
ar71xx_pci_bus_space.c - Add pci bus space that translates byte order to little endian, 2009-05-15 21:36:50 +00:00
ar71xx_pci_bus_space.h - Add pci bus space that translates byte order to little endian, 2009-05-15 21:36:50 +00:00
ar71xx_pci.c Stop overloading opt_global.h. 2012-01-16 05:07:32 +00:00
ar71xx_setup.c Remove duplicate header includes 2011-06-26 10:07:48 +00:00
ar71xx_setup.h Preparation work for supporting the AR91xx and AR724x. 2010-08-19 02:03:12 +00:00
ar71xx_spi.c - Remove unnecessary register writes in activate_device 2010-01-21 00:15:59 +00:00
ar71xx_wdog.c Preparation work for supporting the AR91xx and AR724x. 2010-08-19 02:03:12 +00:00
ar71xxreg.h - Fix values of CS1_EN and CS2_EN flags 2010-09-29 23:06:41 +00:00
ar91xx_chip.c Style(9) changes. 2011-12-13 05:13:51 +00:00
ar91xx_chip.h Add initial Atheros AR91XX support. 2010-08-19 11:40:10 +00:00
ar91xxreg.h Fix GPIO_MAXPINS calculation for the AR71xx, AR724x, AR913x SoC. 2011-05-06 02:45:02 +00:00
ar724x_chip.c Style(9) changes. 2011-12-13 05:13:51 +00:00
ar724x_chip.h Add some initial AR724X chipset support. 2010-08-19 11:53:55 +00:00
ar724x_pci.c Fix the ar724x shift calculation when writing to the PCI config space. 2012-01-07 04:13:25 +00:00
ar724xreg.h Fix GPIO_MAXPINS calculation for the AR71xx, AR724x, AR913x SoC. 2011-05-06 02:45:02 +00:00
files.ar71xx Add some initial PCIe bridge support for the AR724x chipsets. 2011-04-30 11:36:16 +00:00
if_arge.c Fix link status handling on if_arge upon system boot to allow bootp/NFS to 2012-03-13 06:28:52 +00:00
if_argevar.h * Add some more debugging to if_arge 2011-04-05 06:33:35 +00:00
pcf2123_rtc.c - Add driver for PCF2123, SPI real time clock/calendar 2010-01-22 22:14:12 +00:00
pcf2123reg.h - Add driver for PCF2123, SPI real time clock/calendar 2010-01-22 22:14:12 +00:00
std.ar71xx o) Use ABI, not ISA_* options, to determine whether to compile bits if libkern 2012-03-12 21:25:32 +00:00
uart_bus_ar71xx.c Preparation work for supporting the AR91xx and AR724x. 2010-08-19 02:03:12 +00:00
uart_cpu_ar71xx.c Preparation work for supporting the AR91xx and AR724x. 2010-08-19 02:03:12 +00:00