netdev
[Top] [All Lists]

Re: [PATCH 1/7] netpoll: shorten carrier detect timeout

To: Matt Mackall <mpm@xxxxxxxxxxx>
Subject: Re: [PATCH 1/7] netpoll: shorten carrier detect timeout
From: Patrick McHardy <kaber@xxxxxxxxx>
Date: Sun, 06 Mar 2005 01:09:28 +0100
Cc: Jeff Garzik <jgarzik@xxxxxxxxx>, netdev@xxxxxxxxxxx, Jeff Moyer <jmoyer@xxxxxxxxxx>
In-reply-to: <2.454130102@selenic.com>
References: <2.454130102@selenic.com>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.5) Gecko/20050106 Debian/1.7.5-1
Matt Mackall wrote:
Shorten carrier detect timeout to 4 seconds.

The carrier detection looks partially broken to me. The current logic detects an instantly available carrier as flaky because netif_carrier_ok() takes less than 1/10s. This patch does what I assume is intended, make sure the carrier is stable for 1/10s.

Signed-off-by: Patrick McHardy <kaber@xxxxxxxxx>
===== net/core/netpoll.c 1.27 vs edited =====
--- 1.27/net/core/netpoll.c     2005-01-26 06:32:56 +01:00
+++ edited/net/core/netpoll.c   2005-03-06 01:07:16 +01:00
@@ -592,8 +592,7 @@
                }
                rtnl_shunlock();
 
-               atleast = jiffies + HZ/10;
-               atmost = jiffies + 10*HZ;
+               atmost = jiffies + 4*HZ;
                while (!netif_carrier_ok(ndev)) {
                        if (time_after(jiffies, atmost)) {
                                printk(KERN_NOTICE
@@ -604,9 +603,15 @@
                        cond_resched();
                }
 
+               atleast = jiffies + HZ/10;
+               while (netif_carrier_ok(ndev)) {
+                       if (time_after(jiffies, atleast))
+                               break;
+                       cond_resched();
+               }
                if (time_before(jiffies, atleast)) {
                        printk(KERN_NOTICE "%s: carrier detect appears flaky,"
-                              " waiting 10 seconds\n",
+                              " waiting 4 seconds\n",
                               np->name);
                        while (time_before(jiffies, atmost))
                                cond_resched();
<Prev in Thread] Current Thread [Next in Thread>