From: Martin Kepplinger <martink@posteo.de>
To: davem@davemloft.net, kuznet@ms2.inr.ac.ru,
yoshfuji@linux-ipv6.org, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Manfred Schlaegl <manfred.schlaegl@ginzinger.com>,
Martin Kepplinger <martin.kepplinger@ginzinger.com>
Subject: [PATCH] ipconfig: make the wait for carrier timeout configurable
Date: Mon, 28 Jan 2019 12:30:05 +0100 [thread overview]
Message-ID: <20190128113005.7683-1-martink@posteo.de> (raw)
From: Manfred Schlaegl <manfred.schlaegl@ginzinger.com>
commit 3fb72f1e6e61 ("ipconfig wait for carrier") added a
"wait for carrier" policy, with a fixed worst case maximum wait
of two minutes.
This makes the wait for carrier timeout configurable (0 - 240 seconds).
The informative timeout messages introduced with
commit 5e404cd65860 ("ipconfig: add informative timeout messages while
waiting for carrier") were adapted. Message output is done in a fixed
interval of 20 seconds, just like before (240/12).
Signed-off-by: Manfred Schlaegl <manfred.schlaegl@ginzinger.com>
Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
---
This is really just something we always set shorter on embedded devices
and don't understand why it isn't configurable :)
thanks
martin
net/ipv4/Kconfig | 11 +++++++++++
net/ipv4/ipconfig.c | 7 ++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/Kconfig b/net/ipv4/Kconfig
index 32cae39cdff6..299c5dbbea97 100644
--- a/net/ipv4/Kconfig
+++ b/net/ipv4/Kconfig
@@ -113,6 +113,17 @@ config IP_PNP
on NFS" as well), because all other machines configure the network
in their startup scripts.
+config IP_PNP_CARRIER_TIMEOUT
+ int "Wait for carrier timeout (in seconds)"
+ default 120
+ range 0 240
+ depends on IP_PNP
+ help
+ This defines the timeout waiting for carrier in seconds before
+ continuing kernel startup.
+
+ Use the default if unsure.
+
config IP_PNP_DHCP
bool "IP: DHCP support"
depends on IP_PNP
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index b9a9873c25c6..e8041c0c2b97 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -85,7 +85,8 @@
/* 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 */
+/* Wait for carrier timeout */
+#define CONF_CARRIER_TIMEOUT (CONFIG_IP_PNP_CARRIER_TIMEOUT*1000)
/* Define the timeout for waiting for a DHCP/BOOTP/RARP reply */
#define CONF_OPEN_RETRIES 2 /* (Re)open devices twice */
@@ -268,7 +269,7 @@ static int __init ic_open_devs(void)
/* wait for a carrier on at least one device */
start = jiffies;
- next_msg = start + msecs_to_jiffies(CONF_CARRIER_TIMEOUT/12);
+ next_msg = start + msecs_to_jiffies(20000);
while (time_before(jiffies, start +
msecs_to_jiffies(CONF_CARRIER_TIMEOUT))) {
int wait, elapsed;
@@ -285,7 +286,7 @@ static int __init ic_open_devs(void)
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);
+ next_msg = jiffies + msecs_to_jiffies(20000);
}
have_carrier:
rtnl_unlock();
--
2.20.1
next reply other threads:[~2019-01-28 11:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 11:30 Martin Kepplinger [this message]
2019-01-31 5:36 ` [PATCH] ipconfig: make the wait for carrier timeout configurable David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190128113005.7683-1-martink@posteo.de \
--to=martink@posteo.de \
--cc=davem@davemloft.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred.schlaegl@ginzinger.com \
--cc=martin.kepplinger@ginzinger.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).