From patchwork Sun Jun 21 18:46:36 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Arlott X-Patchwork-Id: 28957 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@bilbo.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from ozlabs.org (ozlabs.org [203.10.76.45]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mx.ozlabs.org", Issuer "CA Cert Signing Authority" (verified OK)) by bilbo.ozlabs.org (Postfix) with ESMTPS id B707FB71F3 for ; Mon, 22 Jun 2009 04:56:26 +1000 (EST) Received: by ozlabs.org (Postfix) id A5D5BDDDB2; Mon, 22 Jun 2009 04:56:26 +1000 (EST) Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 3D053DDDA2 for ; Mon, 22 Jun 2009 04:56:26 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754155AbZFUS4R (ORCPT ); Sun, 21 Jun 2009 14:56:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754075AbZFUS4Q (ORCPT ); Sun, 21 Jun 2009 14:56:16 -0400 Received: from proxima.lp0.eu ([81.2.80.65]:49543 "EHLO proxima.lp0.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753863AbZFUS4P (ORCPT ); Sun, 21 Jun 2009 14:56:15 -0400 X-Greylist: delayed 651 seconds by postgrey-1.27 at vger.kernel.org; Sun, 21 Jun 2009 14:56:15 EDT DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=exim; d=fire.lp0.eu; h=Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=SlrZPFMnsYjjq32QK0wwrxb6NEc0D6Lv+WWG99pr010SivTzdFBh/jsGh0omftLTk0iOQJqx5VCwf09iDHvyLwOBSjGDHOrZDr1mZ8jq7kUS4tsezHEfPA7x5dzZpPON; Received: from redrum.lp0.eu ([2001:8b0:ffea:0:2e0:81ff:fe4d:2bec]:39872) by proxima.lp0.eu ([2001:8b0:ffea:0:205:b4ff:fe12:530]:465) with esmtpsav (TLSv1:AES256-SHA:256/CN=Simon Arlott) id 1MIS3o-0005VE-Dr; Sun, 21 Jun 2009 19:46:36 +0100 Message-ID: <4A3E800C.5090702@simon.arlott.org.uk> Date: Sun, 21 Jun 2009 19:46:36 +0100 From: Simon Arlott User-Agent: Thunderbird 2.0.0.21 (X11/20090328) MIME-Version: 1.0 To: netdev , Linux Kernel Mailing List Subject: [PATCH] ipconfig: add ipdelay= option to disable delays Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org ipdelay= This parameter enables/disables the pre/post delays when opening network devices. It defaults to both. If the physical link is already up it may be unnecessary to wait before it can be used. Disabling both the pre and post delay makes booting 1.5s faster. Signed-off-by: Simon Arlott --- Documentation/filesystems/nfsroot.txt | 12 ++++++++++++ net/ipv4/ipconfig.c | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Documentation/filesystems/nfsroot.txt b/Documentation/filesystems/nfsroot.txt index 68baddf..8bdbbf7 100644 --- a/Documentation/filesystems/nfsroot.txt +++ b/Documentation/filesystems/nfsroot.txt @@ -157,6 +157,18 @@ ip=:::::: Default: any +ipdelay= + + This parameter enables/disables the pre/post delays when opening + network devices. It defaults to both. If the physical link is + already up it may be unnecessary to wait before it can be used. + + none: Do not wait before or after opening network devices. + pre: Wait before opening network devices. + post: Wait after opening network devices. + both: Wait before or after opening network devices. + + 3.) Boot Loader diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index f8d04c2..1b7e54e 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -114,6 +114,8 @@ int ic_set_manually __initdata = 0; /* IPconfig parameters set manually */ static int ic_enable __initdata = 0; /* IP config enabled? */ +static int ic_pre_delay __initdata = 1; /* Delay before opening? */ +static int ic_post_delay __initdata = 1; /* Delay after opening? */ /* Protocol choice */ int ic_proto_enabled __initdata = 0 @@ -1327,14 +1329,16 @@ static int __init ip_auto_config(void) try_try_again: #endif /* Give hardware a chance to settle */ - msleep(CONF_PRE_OPEN); + if (ic_pre_delay) + msleep(CONF_PRE_OPEN); /* Setup all network devices */ if (ic_open_devs() < 0) return -1; /* Give drivers a chance to settle */ - ssleep(CONF_POST_OPEN); + if (ic_post_delay) + ssleep(CONF_POST_OPEN); /* * If the config information is insufficient (e.g., our IP address or @@ -1574,6 +1578,30 @@ static int __init vendor_class_identifier_setup(char *addrs) return 1; } +static int __init ipdelay_setup(char *delays) +{ + if (!strcmp(delays, "both")) { + ic_pre_delay = 1; + ic_post_delay = 1; + return 1; + } else if (!strcmp(delays, "pre")) { + ic_pre_delay = 1; + ic_post_delay = 0; + return 1; + } else if (!strcmp(delays, "post")) { + ic_pre_delay = 0; + ic_post_delay = 1; + return 1; + } else if (!strcmp(delays, "none")) { + ic_pre_delay = 0; + ic_post_delay = 0; + return 1; + } + + return 0; +} + __setup("ip=", ip_auto_config_setup); __setup("nfsaddrs=", nfsaddrs_config_setup); __setup("dhcpclass=", vendor_class_identifier_setup); +__setup("ipdelay=", ipdelay_setup);