From: Stephen Hemminger <shemminger@osdl.org>
To: Stephen Hemminger <shemminger@osdl.org>
Cc: "David S. Miller" <davem@davemloft.net>,
Jeff Garzik <jgarzik@pobox.com>,
Linus Torvalds <torvalds@osdl.org>,
netdev@vger.kernel.org
Subject: [PATCH] netpoll: netpoll_send_skb local optimization
Date: Wed, 18 Oct 2006 13:55:51 -0700 [thread overview]
Message-ID: <20061018135551.789f7bb7@freekitty> (raw)
In-Reply-To: <20061018135033.4a4872b8@freekitty>
This cleans up netpoll_send_skb:
* np and np->dev are always non-null given the local callers
* get device into a local variable
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- orig/net/core/netpoll.c 2006-10-18 13:44:27.000000000 -0700
+++ new/net/core/netpoll.c 2006-10-18 13:46:03.000000000 -0700
@@ -270,19 +270,19 @@
static void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
{
+ struct net_device *dev = np->dev;
+ struct netpoll_info *npinfo = dev->npinfo;
int status;
- struct netpoll_info *npinfo;
- if (!np || !np->dev || !netif_device_present(np->dev) || !netif_running(np->dev)) {
+ if (!netif_device_present(dev) || !netif_running(dev)) {
__kfree_skb(skb);
return;
}
- npinfo = np->dev->npinfo;
/* avoid recursion */
if (npinfo->poll_owner == smp_processor_id() ||
- np->dev->xmit_lock_owner == smp_processor_id()) {
+ dev->xmit_lock_owner == smp_processor_id()) {
if (np->drop)
np->drop(skb);
else
@@ -292,17 +292,17 @@
do {
npinfo->tries--;
- netif_tx_lock(np->dev);
+ netif_tx_lock(dev);
/*
* network drivers do not expect to be called if the queue is
* stopped.
*/
status = NETDEV_TX_BUSY;
- if (!netif_queue_stopped(np->dev))
- status = np->dev->hard_start_xmit(skb, np->dev);
+ if (!netif_queue_stopped(dev))
+ status = dev->hard_start_xmit(skb, dev);
- netif_tx_unlock(np->dev);
+ netif_tx_unlock(dev);
/* success */
if(!status) {
prev parent reply other threads:[~2006-10-18 20:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-18 20:50 [PATCH] netpoll: don't send packets to detached device Stephen Hemminger
2006-10-18 20:55 ` Stephen Hemminger [this message]
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=20061018135551.789f7bb7@freekitty \
--to=shemminger@osdl.org \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
--cc=torvalds@osdl.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