aboutsummaryrefslogtreecommitdiff
path: root/src/usr
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2021-01-26 15:44:59 +0000
committerMichael Brown <mcb30@ipxe.org>2021-01-26 17:07:52 +0000
commit42db0bd0417721a026313fc151f36a8ef0bff4e4 (patch)
tree5173a90e3bcb34d060161233ba77d91f402f0cdf /src/usr
parentade4d2b4fe5215f3cd850fd6fb1dc2400902cb5e (diff)
downloadipxe-42db0bd0417721a026313fc151f36a8ef0bff4e4.zip
ipxe-42db0bd0417721a026313fc151f36a8ef0bff4e4.tar.gz
ipxe-42db0bd0417721a026313fc151f36a8ef0bff4e4.tar.bz2
[cmdline] Expose "iflinkwait" as a command
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/ifmgmt.c11
-rw-r--r--src/usr/lotest.c4
2 files changed, 9 insertions, 6 deletions
diff --git a/src/usr/ifmgmt.c b/src/usr/ifmgmt.c
index f1172ba..2150bff 100644
--- a/src/usr/ifmgmt.c
+++ b/src/usr/ifmgmt.c
@@ -212,17 +212,20 @@ static int iflinkwait_progress ( struct ifpoller *ifpoller ) {
*
* @v netdev Network device
* @v timeout Timeout period, in ticks
+ * @v verbose Always display progress message
+ * @ret rc Return status code
*/
-int iflinkwait ( struct net_device *netdev, unsigned long timeout ) {
+int iflinkwait ( struct net_device *netdev, unsigned long timeout,
+ int verbose ) {
int rc;
/* Ensure device is open */
if ( ( rc = ifopen ( netdev ) ) != 0 )
return rc;
- /* Return immediately if link is already up */
+ /* Return immediately if link is already up, unless being verbose */
netdev_poll ( netdev );
- if ( netdev_link_ok ( netdev ) )
+ if ( netdev_link_ok ( netdev ) && ( ! verbose ) )
return 0;
/* Wait for link-up */
@@ -273,7 +276,7 @@ int ifconf ( struct net_device *netdev,
int rc;
/* Ensure device is open and link is up */
- if ( ( rc = iflinkwait ( netdev, LINK_WAIT_TIMEOUT ) ) != 0 )
+ if ( ( rc = iflinkwait ( netdev, LINK_WAIT_TIMEOUT, 0 ) ) != 0 )
return rc;
/* Start configuration */
diff --git a/src/usr/lotest.c b/src/usr/lotest.c
index 6b75b50..5b88ef2 100644
--- a/src/usr/lotest.c
+++ b/src/usr/lotest.c
@@ -208,9 +208,9 @@ int loopback_test ( struct net_device *sender, struct net_device *receiver,
return rc;
/* Wait for link-up */
- if ( ( rc = iflinkwait ( sender, 0 ) ) != 0 )
+ if ( ( rc = iflinkwait ( sender, 0, 0 ) ) != 0 )
return rc;
- if ( ( rc = iflinkwait ( receiver, 0 ) ) != 0 )
+ if ( ( rc = iflinkwait ( receiver, 0, 0 ) ) != 0 )
return rc;
/* Allocate data buffer */