From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.com>, "David S. Miller" <davem@davemloft.net>
Cc: ak@suse.de, Jeff Moyer <jmoyer@redhat.com>,
netdev@oss.sgi.com, linux-kernel@vger.kernel.org, mingo@elte.hu,
john.ronciak@intel.com, rostedt@goodmis.org
Subject: [PATCH 5/8] netpoll: add retry timeout
Date: Thu, 11 Aug 2005 21:19:11 -0500 [thread overview]
Message-ID: <6.502409567@selenic.com> (raw)
In-Reply-To: <5.502409567@selenic.com>
Add limited retry logic to netpoll_send_skb
Each time we attempt to send, decrement our per-device retry counter.
On every successful send, we reset the counter.
We delay 50us between attempts with up to 20000 retries for a total of
1 second. After we've exhausted our retries, subsequent failed
attempts will try only once until reset by success.
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: lhg/net/core/netpoll.c
===================================================================
--- lhg.orig/net/core/netpoll.c 2005-08-11 16:17:45.000000000 -0700
+++ lhg/net/core/netpoll.c 2005-08-11 16:45:20.000000000 -0700
@@ -33,6 +33,7 @@
#define MAX_UDP_CHUNK 1460
#define MAX_SKBS 32
#define MAX_QUEUE_DEPTH (MAX_SKBS / 2)
+#define MAX_RETRIES 20000
static DEFINE_SPINLOCK(skb_list_lock);
static int nr_skbs;
@@ -265,7 +266,8 @@ static void netpoll_send_skb(struct netp
return;
}
- while (1) {
+ do {
+ npinfo->tries--;
spin_lock(&np->dev->xmit_lock);
np->dev->xmit_lock_owner = smp_processor_id();
@@ -277,6 +279,7 @@ static void netpoll_send_skb(struct netp
np->dev->xmit_lock_owner = -1;
spin_unlock(&np->dev->xmit_lock);
netpoll_poll(np);
+ udelay(50);
continue;
}
@@ -285,12 +288,15 @@ static void netpoll_send_skb(struct netp
spin_unlock(&np->dev->xmit_lock);
/* success */
- if(!status)
+ if(!status) {
+ npinfo->tries = MAX_RETRIES; /* reset */
return;
+ }
/* transmit busy */
netpoll_poll(np);
- }
+ udelay(50);
+ } while (npinfo->tries > 0);
}
void netpoll_send_udp(struct netpoll *np, const char *msg, int len)
@@ -642,6 +648,7 @@ int netpoll_setup(struct netpoll *np)
npinfo->rx_np = NULL;
npinfo->poll_lock = SPIN_LOCK_UNLOCKED;
npinfo->poll_owner = -1;
+ npinfo->tries = MAX_RETRIES;
npinfo->rx_lock = SPIN_LOCK_UNLOCKED;
} else
npinfo = ndev->npinfo;
Index: lhg/include/linux/netpoll.h
===================================================================
--- lhg.orig/include/linux/netpoll.h 2005-08-11 15:40:27.000000000 -0700
+++ lhg/include/linux/netpoll.h 2005-08-11 16:17:56.000000000 -0700
@@ -26,6 +26,7 @@ struct netpoll {
struct netpoll_info {
spinlock_t poll_lock;
int poll_owner;
+ int tries;
int rx_flags;
spinlock_t rx_lock;
struct netpoll *rx_np; /* netpoll that registered an rx_hook */
next prev parent reply other threads:[~2005-08-12 2:19 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-12 2:18 [PATCH 0/8] netpoll: various bugfixes Matt Mackall
2005-08-12 2:19 ` [PATCH 1/8] netpoll: rx_flags bugfix Matt Mackall
2005-08-12 2:19 ` [PATCH 2/8] netpoll: deadlock bugfix Matt Mackall
2005-08-12 2:19 ` [PATCH 3/8] netpoll: e1000 netpoll tweak Matt Mackall
2005-08-12 2:19 ` [PATCH 4/8] netpoll: netpoll_send_skb simplify Matt Mackall
2005-08-12 2:19 ` Matt Mackall [this message]
2005-08-12 2:19 ` [PATCH 6/8] netpoll: pre-fill skb pool Matt Mackall
2005-08-12 2:19 ` [PATCH 7/8] netpoll: fix initialization/NAPI race Matt Mackall
2005-08-12 2:19 ` [PATCH 8/8] netpoll: remove unused variable Matt Mackall
2005-08-12 19:02 ` [PATCH 3/8] netpoll: e1000 netpoll tweak John Ronciak
[not found] ` <56a8daef0508121202172bcd17@mail.gmail.com>
2005-08-12 19:10 ` David S. Miller
2005-08-12 19:17 ` Matt Mackall
2005-08-12 2:41 ` [PATCH 0/8] netpoll: various bugfixes David S. Miller
2005-08-12 17:21 ` Olaf Hering
[not found] ` <20050812172151.GA11104@suse.de>
2005-08-12 19:21 ` Matt Mackall
2005-08-12 19:31 ` Olaf Hering
[not found] ` <20050812193109.GA15434@suse.de>
2005-08-14 21:00 ` Matt Mackall
2005-08-15 6:16 ` Olaf Hering
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=6.502409567@selenic.com \
--to=mpm@selenic.com \
--cc=ak@suse.de \
--cc=akpm@osdl.com \
--cc=davem@davemloft.net \
--cc=jmoyer@redhat.com \
--cc=john.ronciak@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@oss.sgi.com \
--cc=rostedt@goodmis.org \
/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).