Date: Sat, 10 Mar 2012 15:11:28 +0200 From: Aleksandr Rybalko <ray@ddteam.net> To: Patrick Kelsey <kelsey@ieee.org> Cc: freebsd-mips@freebsd.org Subject: Re: [PATCH] Fix for using NFS root with if_arge Message-ID: <20120310151128.647d4a18.ray@ddteam.net> In-Reply-To: <CAD44qMVKyL-Fdrp-Tf3o9HXMH_UudCSfEOKnHz3nK%2BaqMwW6Pw@mail.gmail.com> References: <CAD44qMVKyL-Fdrp-Tf3o9HXMH_UudCSfEOKnHz3nK%2BaqMwW6Pw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 9 Mar 2012 21:53:13 -0500 Patrick Kelsey <kelsey@ieee.org> wrote: > 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. > > I think there is a secondary issue here regarding the "arge0: > initialization failed: no memory for rx buffers". I have not dug > into it completely yet, but at first blush it seems that arge_stop() > leaks mbufs from the rx ring, so after some number of arge_init() > calls (in this case triggered by the DHCP/BOOTP message timeouts), > all mbufs are exhausted. > > -Patrick Hi Patrick, yeah, if_arge really have two or even three problems: 1. Different levels of allocate/free ring buffer (allocate in if_start, but free in device_detatch), so we get memory leak when do if_up/if_down. 2. some wrong value which sometime passed to arge_set_pll, then we try to send some packet without run MAC clock. 3. problem that you explain First and second fixed by http://my.ddteam.net/files/if_arge.c.patch. Not yet commited, because not solve main problem. We will test your patch and commit it ASAP. Thank you! WBW -- Aleksandr Rybalko <ray@ddteam.net>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120310151128.647d4a18.ray>