[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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user