ipconfig: make the wait for carrier timeout configurable
Subsystems (3)
PATCH 1/1 ipconfig: make the wait for carrier timeout configurable
From: Manfred Schlaegl <[email protected]>
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).
---
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(-)
net/ipv4/Kconfig +11 -0
@@ -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
net/ipv4/ipconfig.c +4 -3
@@ -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 ();
Signature · 1 line
2.20.1
David Miller
maintainerFrom: Martin Kepplinger <[email protected]>
Date: Mon, 28 Jan 2019 12:30:05 +0100
Quoted 8 lines
From: Manfred Schlaegl <[email protected]>
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).
Quoted 7 lines
The informative timeout messages introduced with
commit5e404cd65860("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 <[email protected]>Signed-off-by Martin Kepplinger <[email protected]>
I would prefer that this be implemented using a kernel command line parameter.
That way you don't need to rebuild the kernel to adjust the value.
Thanks.