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 4/8] netpoll: netpoll_send_skb simplify
Date: Thu, 11 Aug 2005 21:19:11 -0500 [thread overview]
Message-ID: <5.502409567@selenic.com> (raw)
In-Reply-To: <4.502409567@selenic.com>
Minor netpoll_send_skb restructuring
Restructure to avoid confusing goto and move some bits out of the
retry loop.
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: l/net/core/netpoll.c
===================================================================
--- l.orig/net/core/netpoll.c 2005-08-07 15:15:48.000000000 -0500
+++ l/net/core/netpoll.c 2005-08-07 16:59:27.000000000 -0500
@@ -248,14 +248,14 @@ static void netpoll_send_skb(struct netp
int status;
struct netpoll_info *npinfo;
-repeat:
- if(!np || !np->dev || !netif_running(np->dev)) {
+ if (!np || !np->dev || !netif_running(np->dev)) {
__kfree_skb(skb);
return;
}
- /* avoid recursion */
npinfo = np->dev->npinfo;
+
+ /* avoid recursion */
if (npinfo->poll_owner == smp_processor_id() ||
np->dev->xmit_lock_owner == smp_processor_id()) {
if (np->drop)
@@ -265,29 +265,31 @@ repeat:
return;
}
- spin_lock(&np->dev->xmit_lock);
- np->dev->xmit_lock_owner = smp_processor_id();
+ while (1) {
+ spin_lock(&np->dev->xmit_lock);
+ np->dev->xmit_lock_owner = smp_processor_id();
+
+ /*
+ * network drivers do not expect to be called if the queue is
+ * stopped.
+ */
+ if (netif_queue_stopped(np->dev)) {
+ np->dev->xmit_lock_owner = -1;
+ spin_unlock(&np->dev->xmit_lock);
+ netpoll_poll(np);
+ continue;
+ }
- /*
- * network drivers do not expect to be called if the queue is
- * stopped.
- */
- if (netif_queue_stopped(np->dev)) {
+ status = np->dev->hard_start_xmit(skb, np->dev);
np->dev->xmit_lock_owner = -1;
spin_unlock(&np->dev->xmit_lock);
- netpoll_poll(np);
- goto repeat;
- }
-
- status = np->dev->hard_start_xmit(skb, np->dev);
- np->dev->xmit_lock_owner = -1;
- spin_unlock(&np->dev->xmit_lock);
+ /* success */
+ if(!status)
+ return;
- /* transmit busy */
- if(status) {
+ /* transmit busy */
netpoll_poll(np);
- goto repeat;
}
}
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 ` Matt Mackall [this message]
2005-08-12 2:19 ` [PATCH 5/8] netpoll: add retry timeout Matt Mackall
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=5.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).