From patchwork Fri Sep 14 19:30:42 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erwan Velu X-Patchwork-Id: 184020 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C2C022C00A9 for ; Sat, 15 Sep 2012 05:30:54 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932354Ab2INTax (ORCPT ); Fri, 14 Sep 2012 15:30:53 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:49290 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932332Ab2INTav (ORCPT ); Fri, 14 Sep 2012 15:30:51 -0400 Received: by eaac11 with SMTP id c11so1816446eaa.19 for ; Fri, 14 Sep 2012 12:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=ARbyMNALG5esMPa85PMm7iOnCZynlzInKVPubHmeQT4=; b=L9qZxaPpXGVBjAqo/LSWvbaU2pcGwcvPXb0lDMRuSbU0PMctLL2OeROEKIrOmVjmpU M2IVJodEv+TMsLqAr6eiRupzhvcNbO5UPYvXNllMgPWqdRFboPbRun2tirINRG2vkwkp FGUEWy2n1L3juC+Cx5donRsattgGpokyst4SeZeDsMGQ+voCf2H65pxIzSmZ4ONQ+gac wfivyHJsqwvrxMyawJTxcFVFENmwZt6qNZCKo03P/bfCLXz1ThyMyKnjkMDyFzPbFa/w B6W9fU3sl09wso3M/SR/iJiBK7jxFDK/H46kanlWCEVtOGMXymTxaYP5D/cucb9udM0t IN0w== Received: by 10.14.221.197 with SMTP id r45mr5114802eep.41.1347651050238; Fri, 14 Sep 2012 12:30:50 -0700 (PDT) Received: from localhost.localdomain ([62.147.157.222]) by mx.google.com with ESMTPS id k49sm6939605een.4.2012.09.14.12.30.47 (version=SSLv3 cipher=OTHER); Fri, 14 Sep 2012 12:30:49 -0700 (PDT) Message-ID: <505385E2.6050600@gmail.com> Date: Fri, 14 Sep 2012 21:30:42 +0200 From: Erwan Velu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.7) Gecko/20120826 Thunderbird/10.0.7 MIME-Version: 1.0 To: David Miller CC: netdev@vger.kernel.org, rick.jones2@hp.com Subject: [PATCH V3] ipconfig: Inform user if carrier is not ready References: <50525758.1090609@gmail.com> <50525C5D.8040302@hp.com> <505380A0.7020407@gmail.com> <20120914.151724.505809965127351650.davem@davemloft.net> In-Reply-To: <20120914.151724.505809965127351650.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Erwan Velu While using the ip= option at the cmdline, the kernel can hold the boot process for 2 minutes (CONF_CARRIER_TIMEOUT) if the carrier is not present. While waiting the carrier, user is not informed about this situation and so could think the kernel is frozen. If we don't get the carrier after some seconds, let's display a message to inform the user about the remaining time before reaching the timeout. Signed-off-by: Erwan Velu --- net/ipv4/ipconfig.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) #define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */ @@ -205,6 +206,7 @@ static int __init ic_open_devs(void) struct net_device *dev; unsigned short oflags; unsigned long start; + unsigned int loops=0; last = &ic_first_dev; rtnl_lock(); @@ -266,6 +268,16 @@ static int __init ic_open_devs(void) if (ic_is_init_dev(dev) && netif_carrier_ok(dev)) goto have_carrier; + /* This loop is blocking the boot process until + we get the carrier or reach the timeout. + We have to inform the user about the situation as + it could look like a kernel freeze. + After CONF_WARN_CARRIER_TIMEOUT milliseconds, + we display the remaing time before reaching the timeout.*/ + if (++loops == CONF_WARN_CARRIER_TIMEOUT) { + pr_info("IP-Config: Waiting up to %d seconds for carrier on interface\n", + (CONF_CARRIER_TIMEOUT - CONF_WARN_CARRIER_TIMEOUT)/ 1000); + } msleep(1); } have_carrier: diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index 67e8a6b..b79dca6 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -90,6 +90,7 @@ /* Define the friendly delay before and after opening net devices */ #define CONF_POST_OPEN 10 /* After opening: 10 msecs */ #define CONF_CARRIER_TIMEOUT 120000 /* Wait for carrier timeout */ +#define CONF_WARN_CARRIER_TIMEOUT 5000 /* Time before showing a warning message */ /* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */