aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2013-04-02 09:58:25 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-02 14:35:33 -0400
commit5e404cd65860d6da7c08362e9e4d0b5dc40a9985 (patch)
treeb778bfa09c5f163f32a1b0bd5a3b225a5fc3bb3b /net
parentf7f22874267bddcf2f2017d5045fdce390aee8c8 (diff)
ipconfig: add informative timeout messages while waiting for carrier
Commit 3fb72f1e6e6165c5f495e8dc11c5bbd14c73385c ("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: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/ipconfig.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index bf6c5cf31aed..efa1138fa523 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -206,7 +206,7 @@ static int __init ic_open_devs(void)
206 struct ic_device *d, **last; 206 struct ic_device *d, **last;
207 struct net_device *dev; 207 struct net_device *dev;
208 unsigned short oflags; 208 unsigned short oflags;
209 unsigned long start; 209 unsigned long start, next_msg;
210 210
211 last = &ic_first_dev; 211 last = &ic_first_dev;
212 rtnl_lock(); 212 rtnl_lock();
@@ -263,12 +263,23 @@ static int __init ic_open_devs(void)
263 263
264 /* wait for a carrier on at least one device */ 264 /* wait for a carrier on at least one device */
265 start = jiffies; 265 start = jiffies;
266 next_msg = start + msecs_to_jiffies(CONF_CARRIER_TIMEOUT/12);
266 while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) { 267 while (jiffies - start < msecs_to_jiffies(CONF_CARRIER_TIMEOUT)) {
268 int wait, elapsed;
269
267 for_each_netdev(&init_net, dev) 270 for_each_netdev(&init_net, dev)
268 if (ic_is_init_dev(dev) && netif_carrier_ok(dev)) 271 if (ic_is_init_dev(dev) && netif_carrier_ok(dev))
269 goto have_carrier; 272 goto have_carrier;
270 273
271 msleep(1); 274 msleep(1);
275
276 if time_before(jiffies, next_msg)
277 continue;
278
279 elapsed = jiffies_to_msecs(jiffies - start);
280 wait = (CONF_CARRIER_TIMEOUT - elapsed + 500)/1000;
281 pr_info("Waiting up to %d more seconds for network.\n", wait);
282 next_msg = jiffies + msecs_to_jiffies(CONF_CARRIER_TIMEOUT/12);
272 } 283 }
273have_carrier: 284have_carrier:
274 rtnl_unlock(); 285 rtnl_unlock();