summaryrefslogtreecommitdiffstats
path: root/src/usr/autoboot.c
diff options
context:
space:
mode:
authorMichael Brown2008-04-22 18:40:50 +0200
committerMichael Brown2008-04-22 18:40:50 +0200
commit1ba959c6b342b314dfb01ca0a926ed6832c090b3 (patch)
treed977e301ebfe46d76f9def376e9edb173b96eb26 /src/usr/autoboot.c
parent[Infiniband] Fix event queue doorbell ringing on Arbel (diff)
downloadipxe-1ba959c6b342b314dfb01ca0a926ed6832c090b3.tar.gz
ipxe-1ba959c6b342b314dfb01ca0a926ed6832c090b3.tar.xz
ipxe-1ba959c6b342b314dfb01ca0a926ed6832c090b3.zip
[NETDEV] Add notion of link state
Add ability for network devices to flag link up/down state to the networking core. Autobooting code will now wait for link-up before attempting DHCP. IPoIB reflects the Infiniband link state as the network device link state (which is not strictly correct; we also need a succesful IPoIB IPv4 broadcast group join), but is probably more informative.
Diffstat (limited to 'src/usr/autoboot.c')
-rw-r--r--src/usr/autoboot.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c
index c1a61ec0..cff6e95d 100644
--- a/src/usr/autoboot.c
+++ b/src/usr/autoboot.c
@@ -38,6 +38,9 @@
*
*/
+/** Time to wait for link-up */
+#define LINK_WAIT_MS 15000
+
/**
* Identify the boot network device
*
@@ -136,6 +139,14 @@ static int netboot ( struct net_device *netdev ) {
return rc;
ifstat ( netdev );
+ /* Wait for link-up */
+ printf ( "Waiting for link-up on %s...", netdev->name );
+ if ( ( rc = iflinkwait ( netdev, LINK_WAIT_MS ) ) != 0 ) {
+ printf ( " no link detected\n" );
+ return rc;
+ }
+ printf ( " ok\n" );
+
/* Configure device via DHCP */
if ( ( rc = dhcp ( netdev ) ) != 0 )
return rc;