Commit 5e404cd6 authored by Paul Gortmaker's avatar Paul Gortmaker Committed by David S. Miller

ipconfig: add informative timeout messages while waiting for carrier

Commit 3fb72f1e ("ipconfig wait
for carrier") added a "wait for carrier on at least one interface"
policy, with a worst case maximum wait of two minutes.

However, if you encounter this, you won't get any feedback from
the console as to the nature of what is going on.  You just see
the booting process hang for two minutes and then continue.

Here we add a message so the user knows what is going on, and
hence can take action to rectify the situation (e.g. fix network
cable or whatever.)  After the 1st 10s pause, output now begins
that looks like this:

	Waiting up to 110 more seconds for network.
	Waiting up to 100 more seconds for network.
	Waiting up to 90 more seconds for network.
	Waiting up to 80 more seconds for network.
	...

Since most systems will have no problem getting link/carrier in the
1st 10s, the only people who will see these messages are people with
genuine issues that need to be resolved.
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f7f22874
...@@ -206,7 +206,7 @@ static int __init ic_open_devs(void) ...@@ -206,7 +206,7 @@ static int __init ic_open_devs(void)
struct ic_device *d, **last; struct ic_device *d, **last;
struct net_device *dev; struct net_device *dev;
unsigned short oflags; unsigned short oflags;
unsigned long start; unsigned long start, next_msg;
last = &ic_first_dev; last = &ic_first_dev;
rtnl_lock(); rtnl_lock();
...@@ -263,12 +263,23 @@ static int __init ic_open_devs(void) ...@@ -263,12 +263,23 @@ static int __init ic_open_devs(void)
/* wait for a carrier on at least one device */ /* wait for a carrier on at least one device */
start = jiffies; start = jiffies;
next_msg = start + msecs_to_jiffies(CONF_CARRIER_TIMEOUT/12);
while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) { while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) {
int wait, elapsed;
for_each_netdev(&init_net, dev) for_each_netdev(&init_net, dev)
if (ic_is_init_dev(dev) && netif_carrier_ok(dev)) if (ic_is_init_dev(dev) && netif_carrier_ok(dev))
goto have_carrier; goto have_carrier;
msleep(1); msleep(1);
if time_before(jiffies, next_msg)
continue;
elapsed = jiffies_to_msecs(jiffies - start);
wait = (CONF_CARRIER_TIMEOUT - elapsed + 500)/1000;
pr_info("Waiting up to %d more seconds for network.\n", wait);
next_msg = jiffies + msecs_to_jiffies(CONF_CARRIER_TIMEOUT/12);
} }
have_carrier: have_carrier:
rtnl_unlock(); rtnl_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment