summaryrefslogtreecommitdiffstats
path: root/sys/nfs
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-08-16 00:51:50 +0000
committergonzo <gonzo@FreeBSD.org>2012-08-16 00:51:50 +0000
commit7f9126925a160a8c695a6a3ee5cfa91590e27e4f (patch)
tree055239bbd2ef36e991d8a3f1c0e216b51f74cc71 /sys/nfs
parentf71a949eda23820a738a01c318963f0cdf3d97cf (diff)
downloadFreeBSD-src-7f9126925a160a8c695a6a3ee5cfa91590e27e4f.zip
FreeBSD-src-7f9126925a160a8c695a6a3ee5cfa91590e27e4f.tar.gz
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@
Diffstat (limited to 'sys/nfs')
-rw-r--r--sys/nfs/bootp_subr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/nfs/bootp_subr.c b/sys/nfs/bootp_subr.c
index b29a0e9..165999a 100644
--- a/sys/nfs/bootp_subr.c
+++ b/sys/nfs/bootp_subr.c
@@ -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: "
OpenPOWER on IntegriCloud