[PATCH 1/4] net: make dev_kfree_skb_irq not inline

2006-12-14 Thread Stephen Hemminger
Move the dev_kfree_skb_irq function from netdevice.h to dev.c
for a couple of reasons. Primarily, I want to make softnet_data
local to dev.c; also this function is called 300+ places already.

Signed-off-by: Stephen Hemminger [EMAIL PROTECTED]

--- linux-2.6.20-rc1.orig/include/linux/netdevice.h
+++ linux-2.6.20-rc1/include/linux/netdevice.h
@@ -676,20 +676,7 @@ static inline int netif_running(const st
 /* Use this variant when it is known for sure that it
  * is executing from interrupt context.
  */
-static inline void dev_kfree_skb_irq(struct sk_buff *skb)
-{
-   if (atomic_dec_and_test(skb-users)) {
-   struct softnet_data *sd;
-   unsigned long flags;
-
-   local_irq_save(flags);
-   sd = __get_cpu_var(softnet_data);
-   skb-next = sd-completion_queue;
-   sd-completion_queue = skb;
-   raise_softirq_irqoff(NET_TX_SOFTIRQ);
-   local_irq_restore(flags);
-   }
-}
+extern void dev_kfree_skb_irq(struct sk_buff *skb);
 
 /* Use this variant in places where it could be invoked
  * either from interrupt or non-interrupt context.
--- linux-2.6.20-rc1.orig/net/core/dev.c
+++ linux-2.6.20-rc1/net/core/dev.c
@@ -1141,6 +1141,21 @@ void dev_kfree_skb_any(struct sk_buff *s
 }
 EXPORT_SYMBOL(dev_kfree_skb_any);
 
+void dev_kfree_skb_irq(struct sk_buff *skb)
+{
+   if (atomic_dec_and_test(skb-users)) {
+   struct softnet_data *sd;
+   unsigned long flags;
+
+   local_irq_save(flags);
+   sd = __get_cpu_var(softnet_data);
+   skb-next = sd-completion_queue;
+   sd-completion_queue = skb;
+   raise_softirq_irqoff(NET_TX_SOFTIRQ);
+   local_irq_restore(flags);
+   }
+}
+EXPORT_SYMBOL(dev_kfree_skb_irq);
 
 /* Hot-plugging. */
 void netif_device_detach(struct net_device *dev)

-- 

-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/4] net: make dev_kfree_skb_irq not inline

2006-12-14 Thread David Miller
From: Christoph Hellwig [EMAIL PROTECTED]
Date: Thu, 14 Dec 2006 22:30:09 +

 Maybe you should only move the slowpath out of line ala:
 
 static inline void dev_kfree_skb_irq(struct sk_buff *skb)
 {
   if (atomic_dec_and_test(skb-users)) 
   __dev_kfree_skb_irq(skb);
 }

The atomic operation all by itself is either a function
call or a 6-7 instruction sequence, so the inlining doesn't
make sense even in this case.
-
To unsubscribe from this list: send the line unsubscribe netdev in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html