svn commit: r239318 - head/sys/nfs

Konstantin Belousov kostikbel at gmail.com
Thu Aug 16 08:37:36 UTC 2012


On Thu, Aug 16, 2012 at 12:51:50AM +0000, Oleksandr Tymoshenko wrote:
> Author: gonzo
> Date: Thu Aug 16 00:51:50 2012
> New Revision: 239318
> URL: http://svn.freebsd.org/changeset/base/239318
> 
> Log:
>   Merge somewhat modified r230399 from projects/armv6:
>   
>   Add timeout to wait for network controllers to appear when netbooting.
>   
>   USB ethernet adapter initialization usually is delayed and
>   they're not available immidiately after autoconfiguration. So we need
>   to wait a bit before giving up
>   
>   Reviewed by:	stas@
> 
> Modified:
>   head/sys/nfs/bootp_subr.c
> 
> Modified: head/sys/nfs/bootp_subr.c
> ==============================================================================
> --- head/sys/nfs/bootp_subr.c	Wed Aug 15 22:51:01 2012	(r239317)
> +++ head/sys/nfs/bootp_subr.c	Thu Aug 16 00:51:50 2012	(r239318)
> @@ -82,6 +82,14 @@ __FBSDID("$FreeBSD$");
>  #define BOOTP_SETTLE_DELAY 3
>  #endif
>  
> +/* 
> + * Wait 10 seconds for interface appearance
> + * USB ethernet adapters might reqquire some time to pop up
s/qq/q/

> + */
> +#ifndef	BOOTP_IFACE_WAIT_TIMEOUT
> +#define	BOOTP_IFACE_WAIT_TIMEOUT	10
> +#endif
> +
>  /*
>   * What is the longest we will wait before re-sending a request?
>   * Note this is also the frequency of "RPC timeout" messages.
> @@ -1515,6 +1523,8 @@ bootpc_init(void)
>  #endif
>  	struct nfsv3_diskless *nd;
>  	struct thread *td;
> +	int timeout = BOOTP_IFACE_WAIT_TIMEOUT * hz;
> +	int delay = hz / 10;
According to style(9), initialization and declaration shall be separated.

>  
>  	nd = &nfsv3_diskless;
>  	td = curthread;
> @@ -1567,6 +1577,7 @@ bootpc_init(void)
>  		allocifctx(gctx);
>  #endif
>  
> +retry:
>  	ifctx = STAILQ_FIRST(&gctx->interfaces);
>  	IFNET_RLOCK();
>  	TAILQ_FOREACH(ifp, &V_ifnet, if_link) {
> @@ -1613,6 +1624,11 @@ bootpc_init(void)
>  
>  	if (STAILQ_EMPTY(&gctx->interfaces) ||
>  	    STAILQ_FIRST(&gctx->interfaces)->ifp == NULL) {
> +		if (timeout > 0) {
> +			pause("bootpc", delay);
> +			timeout -= delay;
> +			goto retry;
> +		}
>  #ifdef BOOTP_WIRED_TO
>  		panic("%s: Could not find interface specified "
>  		      "by BOOTP_WIRED_TO: "
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20120816/017e889c/attachment.pgp


More information about the svn-src-all mailing list