From: Stephen Hemminger <shemminger@osdl.org>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH 4/4] net: rearrange functions in netdevice.h
Date: Thu, 14 Dec 2006 12:48:18 -0800 [thread overview]
Message-ID: <20061214204901.047161000@osdl.org> (raw)
In-Reply-To: 20061214204814.631279000@osdl.org
[-- Attachment #1: netdevice-reorg.patch --]
[-- Type: text/plain, Size: 2256 bytes --]
Use existing inline functions rather than having multiple
copies of same code.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
--- linux-2.6.20-rc1.orig/include/linux/netdevice.h
+++ linux-2.6.20-rc1/include/linux/netdevice.h
@@ -615,9 +615,14 @@ static inline int unregister_gifconf(uns
extern void __netif_schedule(struct net_device *dev);
+static inline int netif_queue_stopped(const struct net_device *dev)
+{
+ return test_bit(__LINK_STATE_XOFF, &dev->state);
+}
+
static inline void netif_schedule(struct net_device *dev)
{
- if (!test_bit(__LINK_STATE_XOFF, &dev->state))
+ if (!netif_queue_stopped(dev))
__netif_schedule(dev);
}
@@ -645,11 +650,6 @@ static inline void netif_stop_queue(stru
set_bit(__LINK_STATE_XOFF, &dev->state);
}
-static inline int netif_queue_stopped(const struct net_device *dev)
-{
- return test_bit(__LINK_STATE_XOFF, &dev->state);
-}
-
static inline int netif_running(const struct net_device *dev)
{
return test_bit(__LINK_STATE_START, &dev->state);
@@ -841,15 +841,20 @@ extern int netif_rx_reschedule(struct ne
* it completes the work. The device cannot be out of poll list at this
* moment, it is BUG().
*/
-static inline void netif_rx_complete(struct net_device *dev)
+static inline void __netif_rx_complete(struct net_device *dev)
{
- unsigned long flags;
-
- local_irq_save(flags);
BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state));
list_del(&dev->poll_list);
smp_mb__before_clear_bit();
clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
+}
+
+static inline void netif_rx_complete(struct net_device *dev)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ __netif_rx_complete(dev);
local_irq_restore(flags);
}
@@ -865,17 +870,6 @@ static inline void netif_poll_enable(str
clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
}
-/* same as netif_rx_complete, except that local_irq_save(flags)
- * has already been issued
- */
-static inline void __netif_rx_complete(struct net_device *dev)
-{
- BUG_ON(!test_bit(__LINK_STATE_RX_SCHED, &dev->state));
- list_del(&dev->poll_list);
- smp_mb__before_clear_bit();
- clear_bit(__LINK_STATE_RX_SCHED, &dev->state);
-}
-
static inline void netif_tx_lock(struct net_device *dev)
{
spin_lock(&dev->_xmit_lock);
--
prev parent reply other threads:[~2006-12-14 20:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-14 20:48 [PATCH 0/4] network device interface cleanups Stephen Hemminger
2006-12-14 20:48 ` [PATCH 1/4] net: make dev_kfree_skb_irq not inline Stephen Hemminger
2006-12-14 22:30 ` Christoph Hellwig
2006-12-14 22:34 ` Stephen Hemminger
2006-12-14 23:00 ` David Miller
2006-12-14 20:48 ` [PATCH 2/4] net: uninline netif_rx_reschedule Stephen Hemminger
2006-12-14 20:48 ` [PATCH 3/4] net: move softnet_data Stephen Hemminger
2006-12-20 18:39 ` David Miller
2006-12-14 20:48 ` 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=20061214204901.047161000@osdl.org \
--to=shemminger@osdl.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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).