diff options
| author | Joe Groocock | 2019-09-20 14:41:29 +0200 |
|---|---|---|
| committer | Michael Brown | 2020-07-22 13:44:51 +0200 |
| commit | a08ee6e7221ea50d9096579d57674a07f3409da3 (patch) | |
| tree | ffad4a137e5e0f9375bf17e92691b1040198b2aa | |
| parent | [intelx] Added PCI_ROM entry for Intel x553/x557-AT and x553 (SFP+) NICs (diff) | |
| download | ipxe-a08ee6e7221ea50d9096579d57674a07f3409da3.tar.gz ipxe-a08ee6e7221ea50d9096579d57674a07f3409da3.tar.xz ipxe-a08ee6e7221ea50d9096579d57674a07f3409da3.zip | |
[cmdline] Add "--timeout" parameter to "ifconf" command
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
| -rw-r--r-- | src/hci/commands/ifmgmt_cmd.c | 8 | ||||
| -rw-r--r-- | src/include/usr/ifmgmt.h | 3 | ||||
| -rw-r--r-- | src/usr/autoboot.c | 2 | ||||
| -rw-r--r-- | src/usr/ifmgmt.c | 6 |
4 files changed, 14 insertions, 5 deletions
diff --git a/src/hci/commands/ifmgmt_cmd.c b/src/hci/commands/ifmgmt_cmd.c index c89af2e81..2e976d3fb 100644 --- a/src/hci/commands/ifmgmt_cmd.c +++ b/src/hci/commands/ifmgmt_cmd.c @@ -193,6 +193,8 @@ static int ifstat_exec ( int argc, char **argv ) { /** "ifconf" options */ struct ifconf_options { + /** Configuration timeout */ + unsigned long timeout; /** Configurator */ struct net_device_configurator *configurator; }; @@ -202,6 +204,9 @@ static struct option_descriptor ifconf_opts[] = { OPTION_DESC ( "configurator", 'c', required_argument, struct ifconf_options, configurator, parse_netdev_configurator ), + OPTION_DESC ( "timeout", 't', required_argument, + struct ifconf_options, timeout, + parse_timeout ), }; /** @@ -216,7 +221,8 @@ static int ifconf_payload ( struct net_device *netdev, int rc; /* Attempt configuration */ - if ( ( rc = ifconf ( netdev, opts->configurator ) ) != 0 ) { + if ( ( rc = ifconf ( netdev, opts->configurator, + opts->timeout ) ) != 0 ) { /* Close device on failure, to avoid memory exhaustion */ netdev_close ( netdev ); diff --git a/src/include/usr/ifmgmt.h b/src/include/usr/ifmgmt.h index 5c386327b..52f88f957 100644 --- a/src/include/usr/ifmgmt.h +++ b/src/include/usr/ifmgmt.h @@ -14,7 +14,8 @@ struct net_device_configurator; extern int ifopen ( struct net_device *netdev ); extern int ifconf ( struct net_device *netdev, - struct net_device_configurator *configurator ); + struct net_device_configurator *configurator, + unsigned long timeout ); extern void ifclose ( struct net_device *netdev ); extern void ifstat ( struct net_device *netdev ); extern int iflinkwait ( struct net_device *netdev, unsigned long timeout ); diff --git a/src/usr/autoboot.c b/src/usr/autoboot.c index 106e0f879..51b07e125 100644 --- a/src/usr/autoboot.c +++ b/src/usr/autoboot.c @@ -396,7 +396,7 @@ int netboot ( struct net_device *netdev ) { ifstat ( netdev ); /* Configure device */ - if ( ( rc = ifconf ( netdev, NULL ) ) != 0 ) + if ( ( rc = ifconf ( netdev, NULL, 0 ) ) != 0 ) goto err_dhcp; route(); diff --git a/src/usr/ifmgmt.c b/src/usr/ifmgmt.c index f367149f7..f1172bafb 100644 --- a/src/usr/ifmgmt.c +++ b/src/usr/ifmgmt.c @@ -264,10 +264,12 @@ static int ifconf_progress ( struct ifpoller *ifpoller ) { * * @v netdev Network device * @v configurator Network device configurator, or NULL to use all + * @v timeout Timeout period, in ticks * @ret rc Return status code */ int ifconf ( struct net_device *netdev, - struct net_device_configurator *configurator ) { + struct net_device_configurator *configurator, + unsigned long timeout ) { int rc; /* Ensure device is open and link is up */ @@ -296,5 +298,5 @@ int ifconf ( struct net_device *netdev, ( configurator ? configurator->name : "" ), ( configurator ? "] " : "" ), netdev->name, netdev->ll_protocol->ntoa ( netdev->ll_addr ) ); - return ifpoller_wait ( netdev, configurator, 0, ifconf_progress ); + return ifpoller_wait ( netdev, configurator, timeout, ifconf_progress ); } |
