linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: ipconfig: Make device wait timeout configurable
@ 2019-11-19 12:06 Thomas Bogendoerfer
  2019-11-20  2:44 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Bogendoerfer @ 2019-11-19 12:06 UTC (permalink / raw)
  To: Jonathan Corbet, David S. Miller, Alexey Kuznetsov,
	Hideaki YOSHIFUJI, linux-doc, linux-kernel, netdev

If network device drivers are using deferred probing it's possible
that waiting for devices to show up in ipconfig is already over,
when the device eventually shows up. With the new netdev_max_wait
kernel cmdline pataremter it's now possible to extend this time.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
 Documentation/admin-guide/kernel-parameters.txt |  5 +++++
 net/ipv4/ipconfig.c                             | 22 +++++++++++++++++++---
 2 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index a84a83f8881e..6083ac04f075 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -2755,6 +2755,11 @@
 			This usage is only documented in each driver source
 			file if at all.
 
+	netdev_max_wait=
+			[IP_PNP] set the maximum time in seconds to wait
+			for net devices showing up, when doing kernel
+			IP configuration
+
 	nf_conntrack.acct=
 			[NETFILTER] Enable connection tracking flow accounting
 			0 to disable accounting
diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c
index 9bcca08efec9..851ea8239f5f 100644
--- a/net/ipv4/ipconfig.c
+++ b/net/ipv4/ipconfig.c
@@ -103,6 +103,9 @@
 /* Wait for carrier timeout default in seconds */
 static unsigned int carrier_timeout = 120;
 
+/* Wait for devices to show up in seconds */
+static unsigned int device_max_wait = 12;
+
 /*
  * Public IP configuration
  */
@@ -1402,13 +1405,11 @@ __be32 __init root_nfs_parse_addr(char *name)
 	return addr;
 }
 
-#define DEVICE_WAIT_MAX		12 /* 12 seconds */
-
 static int __init wait_for_devices(void)
 {
 	int i;
 
-	for (i = 0; i < DEVICE_WAIT_MAX; i++) {
+	for (i = 0; i < device_max_wait; i++) {
 		struct net_device *dev;
 		int found = 0;
 
@@ -1797,3 +1798,18 @@ static int __init set_carrier_timeout(char *str)
 	return 1;
 }
 __setup("carrier_timeout=", set_carrier_timeout);
+
+static int __init set_device_max_wait(char *str)
+{
+	ssize_t ret;
+
+	if (!str)
+		return 0;
+
+	ret = kstrtouint(str, 0, &device_max_wait);
+	if (ret)
+		return 0;
+
+	return 1;
+}
+__setup("netdev_max_wait=", set_device_max_wait);
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ipconfig: Make device wait timeout configurable
  2019-11-19 12:06 [PATCH net-next] net: ipconfig: Make device wait timeout configurable Thomas Bogendoerfer
@ 2019-11-20  2:44 ` David Miller
  2019-11-20  7:39   ` Thomas Bogendoerfer
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2019-11-20  2:44 UTC (permalink / raw)
  To: tbogendoerfer; +Cc: corbet, kuznet, yoshfuji, linux-doc, linux-kernel, netdev

From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Date: Tue, 19 Nov 2019 13:06:46 +0100

> If network device drivers are using deferred probing it's possible
> that waiting for devices to show up in ipconfig is already over,
> when the device eventually shows up. With the new netdev_max_wait
> kernel cmdline pataremter it's now possible to extend this time.
> 
> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>

This is one of those "user's shouldn't have to figure this crap out"
situations.

To me, a knob is always a step backwards, and makes Linux harder to
use.

The irony in all of this, is that the kernel knows when this stuff is
happening.  So the ipconfig code should be taught that drivers are
still plugging themselves together and probing, instead of setting
some arbitrary timeout to wait for these things to occur.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: ipconfig: Make device wait timeout configurable
  2019-11-20  2:44 ` David Miller
@ 2019-11-20  7:39   ` Thomas Bogendoerfer
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2019-11-20  7:39 UTC (permalink / raw)
  To: David Miller; +Cc: corbet, kuznet, yoshfuji, linux-doc, linux-kernel, netdev

On Tue, 19 Nov 2019 18:44:46 -0800 (PST)
David Miller <davem@davemloft.net> wrote:

> From: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> Date: Tue, 19 Nov 2019 13:06:46 +0100
> 
> > If network device drivers are using deferred probing it's possible
> > that waiting for devices to show up in ipconfig is already over,
> > when the device eventually shows up. With the new netdev_max_wait
> > kernel cmdline pataremter it's now possible to extend this time.
> > 
> > Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
> 
> This is one of those "user's shouldn't have to figure this crap out"
> situations.
> 
> To me, a knob is always a step backwards, and makes Linux harder to
> use.
> 
> The irony in all of this, is that the kernel knows when this stuff is
> happening.  So the ipconfig code should be taught that drivers are
> still plugging themselves together and probing, instead of setting
> some arbitrary timeout to wait for these things to occur.

fine with, I'll have a look how to solve it taht way.

Thomas.

-- 
SUSE Software Solutions Germany GmbH
HRB 36809 (AG Nürnberg)
Geschäftsführer: Felix Imendörffer

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-11-20  7:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 12:06 [PATCH net-next] net: ipconfig: Make device wait timeout configurable Thomas Bogendoerfer
2019-11-20  2:44 ` David Miller
2019-11-20  7:39   ` Thomas Bogendoerfer

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).