From owner-svn-src-all@FreeBSD.ORG Thu Aug 16 00:51:50 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A5ADD1065673; Thu, 16 Aug 2012 00:51:50 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 910B68FC12; Thu, 16 Aug 2012 00:51:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q7G0pomF036088; Thu, 16 Aug 2012 00:51:50 GMT (envelope-from gonzo@svn.freebsd.org) Received: (from gonzo@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7G0poqM036086; Thu, 16 Aug 2012 00:51:50 GMT (envelope-from gonzo@svn.freebsd.org) Message-Id: <201208160051.q7G0poqM036086@svn.freebsd.org> From: Oleksandr Tymoshenko Date: Thu, 16 Aug 2012 00:51:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239318 - head/sys/nfs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Aug 2012 00:51:50 -0000 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 + */ +#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; 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: "