netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netpoll: Introduce netpoll_carrier_timeout kernel option
@ 2009-07-08  1:00 Anton Vorontsov
  2009-07-08  1:03 ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: Anton Vorontsov @ 2009-07-08  1:00 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Some PHYs require longer timeouts for carrier detection, and
auto-negotiation process may take indefinite amount of time.

It may be inconvenient to force longer timeouts for sane PHYs,
so let's introduce a kernel command line option.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
 Documentation/kernel-parameters.txt |    5 +++++
 net/core/netpoll.c                  |   11 ++++++++++-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index d77fbd8..9eac5bd 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1531,6 +1531,11 @@ and is between 256 and 4096 characters. It is defined in the file
 			symbolic names: lapic and ioapic
 			Example: nmi_watchdog=2 or nmi_watchdog=panic,lapic
 
+	netpoll_carrier_timeout=
+			[NET] Specifies amount of time (in seconds) that
+			netpoll should wait for a carrier. By default netpoll
+			waits 4 seconds.
+
 	no387		[BUGS=X86-32] Tells the kernel to use the 387 maths
 			emulation library even if a 387 maths coprocessor
 			is present.
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 9675f31..4371da2 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -50,6 +50,15 @@ static atomic_t trapped;
 static void zap_completion_queue(void);
 static void arp_reply(struct sk_buff *skb);
 
+static unsigned int carrier_timeout = 4;
+
+static int __init carrier_timeout_setup(char *str)
+{
+	carrier_timeout = simple_strtoul(str, NULL, 0);
+	return 1;
+}
+__setup("netpoll_carrier_timeout=", carrier_timeout_setup);
+
 static void queue_process(struct work_struct *work)
 {
 	struct netpoll_info *npinfo =
@@ -732,7 +741,7 @@ int netpoll_setup(struct netpoll *np)
 		}
 
 		atleast = jiffies + HZ/10;
-		atmost = jiffies + 4*HZ;
+		atmost = jiffies + carrier_timeout * HZ;
 		while (!netif_carrier_ok(ndev)) {
 			if (time_after(jiffies, atmost)) {
 				printk(KERN_NOTICE
-- 
1.6.3.3

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

end of thread, other threads:[~2009-07-08 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-08  1:00 [PATCH] netpoll: Introduce netpoll_carrier_timeout kernel option Anton Vorontsov
2009-07-08  1:03 ` Stephen Hemminger
2009-07-08  1:30   ` [PATCH v2] " Anton Vorontsov
2009-07-08 10:59     ` Neil Horman
2009-07-08 12:23       ` Anton Vorontsov
2009-07-08 18:11     ` David Miller

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