From: Patrick McHardy <kaber@trash.net>
To: Matt Mackall <mpm@selenic.com>
Cc: Jeff Garzik <jgarzik@pobox.com>,
netdev@oss.sgi.com, Jeff Moyer <jmoyer@redhat.com>
Subject: Re: [PATCH 1/7] netpoll: shorten carrier detect timeout
Date: Sun, 06 Mar 2005 02:01:01 +0100 [thread overview]
Message-ID: <422A564D.4080809@trash.net> (raw)
In-Reply-To: <20050306002015.GD3120@waste.org>
[-- Attachment #1: Type: text/plain, Size: 747 bytes --]
Matt Mackall wrote:
> On Sun, Mar 06, 2005 at 01:09:28AM +0100, Patrick McHardy wrote:
>>
>>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.
>
>
> Looks ok, but I've been meaning to change the second loop to something
> like msleep().
How about this one ? I also removed oflags, reading it outside of
the locked section was racy.
> Did you try this with a card that otherwise goes into the wait?
Yes, I tried with sk98lin. I don't have a card here that actually
supports netpoll.
Signed-off-by: Patrick McHardy <kaber@trash.net>
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1605 bytes --]
===== 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:58:48 +01:00
@@ -18,6 +18,7 @@
#include <linux/interrupt.h>
#include <linux/netpoll.h>
#include <linux/sched.h>
+#include <linux/delay.h>
#include <linux/rcupdate.h>
#include <net/tcp.h>
#include <net/udp.h>
@@ -575,16 +576,14 @@
}
if (!netif_running(ndev)) {
- unsigned short oflags;
unsigned long atmost, atleast;
+ long left;
printk(KERN_INFO "%s: device %s not up yet, forcing it\n",
np->name, np->dev_name);
- oflags = ndev->flags;
-
rtnl_shlock();
- if (dev_change_flags(ndev, oflags | IFF_UP) < 0) {
+ if (dev_change_flags(ndev, ndev->flags | IFF_UP) < 0) {
printk(KERN_ERR "%s: failed to open %s\n",
np->name, np->dev_name);
rtnl_shunlock();
@@ -592,8 +591,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,12 +602,16 @@
cond_resched();
}
+ atleast = jiffies + HZ/10;
+ while (netif_carrier_ok(ndev) && time_before(jiffies, atleast))
+ 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();
+ left = atmost - jiffies;
+ if (left > 0)
+ msleep(jiffies_to_msecs(left));
}
}
next prev parent reply other threads:[~2005-03-06 1:01 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-03-03 20:46 [PATCH 0/7] netpoll: recursion fixes, queueing, and cleanups Matt Mackall
2005-03-03 20:46 ` [PATCH 1/7] netpoll: shorten carrier detect timeout Matt Mackall
2005-03-03 20:46 ` [PATCH 2/7] netpoll: filter inlines Matt Mackall
2005-03-03 20:46 ` [PATCH 3/7] netpoll: add netpoll point to net_device Matt Mackall
2005-03-03 20:46 ` [PATCH 4/7] netpoll: fix ->poll() locking Matt Mackall
2005-03-03 20:46 ` [PATCH 5/7] netpoll: add optional dropping and queueing support Matt Mackall
2005-03-03 20:46 ` [PATCH 6/7] netpoll: handle xmit_lock recursion similarly Matt Mackall
2005-03-03 20:46 ` [PATCH 7/7] netpoll: avoid kfree_skb on packets with destructo Matt Mackall
2005-03-03 21:00 ` David S. Miller
2005-03-03 21:17 ` Jeff Garzik
2005-03-03 21:29 ` David S. Miller
2005-03-03 21:33 ` Jeff Garzik
2005-03-03 21:39 ` Matt Mackall
2005-03-03 21:41 ` David S. Miller
2005-03-03 21:32 ` Matt Mackall
2005-03-23 2:35 ` David S. Miller
2005-04-22 22:24 ` [PATCH 4/7] netpoll: fix ->poll() locking Jeff Moyer
2005-04-22 22:52 ` David S. Miller
2005-04-22 23:02 ` Jeff Moyer
2005-04-22 22:59 ` David S. Miller
2005-04-23 2:14 ` Matt Mackall
2005-04-23 5:12 ` David S. Miller
2005-03-06 0:09 ` [PATCH 1/7] netpoll: shorten carrier detect timeout Patrick McHardy
2005-03-06 0:20 ` Matt Mackall
2005-03-06 1:01 ` Patrick McHardy [this message]
2005-03-10 23:01 ` Matt Mackall
2005-03-11 4:35 ` Patrick McHardy
2005-03-11 4:42 ` Matt Mackall
2005-03-11 4:53 ` Patrick McHardy
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=422A564D.4080809@trash.net \
--to=kaber@trash.net \
--cc=jgarzik@pobox.com \
--cc=jmoyer@redhat.com \
--cc=mpm@selenic.com \
--cc=netdev@oss.sgi.com \
/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).