lkml.org 
[lkml]   [2004]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH] Make netif_rx_ni preempt-safe
On Wed, 20 Oct 2004 23:32:33 +0300
Denis Vlasenko <vda@port.imtp.ilyichevsk.odessa.ua> wrote:

> On Wednesday 20 October 2004 23:25, Lee Revell wrote:
> > > > --- include/linux/netdevice.h~ 2004-10-20 15:51:00.000000000 -0400
> > > > +++ include/linux/netdevice.h 2004-10-20 15:51:54.000000000 -0400
> > > > @@ -694,11 +694,14 @@
> > > > /* Post buffer to the network code from _non interrupt_ context.
> > > > * see net/core/dev.c for netif_rx description.
> > > > */
> > > > -static inline int netif_rx_ni(struct sk_buff *skb)
> > > > +static int netif_rx_ni(struct sk_buff *skb)
> > >
> > > non-inline functions must not live in .h files
> >
> > Where do you suggest we put it?
>
> Somewhere near this place:
>
> http://lxr.linux.no/source/net/core/dev.c?v=2.6.8.1#L1555

I've done this as follows, thanks.

# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/10/20 16:57:53-07:00 davem@nuts.davemloft.net
# [NET]: Uninline netif_rx_ni().
#
# It expands to a lot of code when SMP or PREEMPT is
# enabled.
#
# Signed-off-by: David S. Miller <davem@davemloft.net>
#
# net/core/dev.c
# 2004/10/20 16:57:03-07:00 davem@nuts.davemloft.net +14 -0
# [NET]: Uninline netif_rx_ni().
#
# include/linux/netdevice.h
# 2004/10/20 16:57:03-07:00 davem@nuts.davemloft.net +1 -15
# [NET]: Uninline netif_rx_ni().
#
diff -Nru a/include/linux/netdevice.h b/include/linux/netdevice.h
--- a/include/linux/netdevice.h 2004-10-20 16:58:28 -07:00
+++ b/include/linux/netdevice.h 2004-10-20 16:58:28 -07:00
@@ -677,6 +677,7 @@

#define HAVE_NETIF_RX 1
extern int netif_rx(struct sk_buff *skb);
+extern int netif_rx_ni(struct sk_buff *skb);
#define HAVE_NETIF_RECEIVE_SKB 1
extern int netif_receive_skb(struct sk_buff *skb);
extern int dev_ioctl(unsigned int cmd, void __user *);
@@ -690,21 +691,6 @@
extern void dev_init(void);

extern int netdev_nit;
-
-/* Post buffer to the network code from _non interrupt_ context.
- * see net/core/dev.c for netif_rx description.
- */
-static inline int netif_rx_ni(struct sk_buff *skb)
-{
- int err = netif_rx(skb);
-
- preempt_disable();
- if (softirq_pending(smp_processor_id()))
- do_softirq();
- preempt_enable();
-
- return err;
-}

/* Called by rtnetlink.c:rtnl_unlock() */
extern void netdev_run_todo(void);
diff -Nru a/net/core/dev.c b/net/core/dev.c
--- a/net/core/dev.c 2004-10-20 16:58:28 -07:00
+++ b/net/core/dev.c 2004-10-20 16:58:28 -07:00
@@ -1587,6 +1587,20 @@
return NET_RX_DROP;
}

+int netif_rx_ni(struct sk_buff *skb)
+{
+ int err = netif_rx(skb);
+
+ preempt_disable();
+ if (softirq_pending(smp_processor_id()))
+ do_softirq();
+ preempt_enable();
+
+ return err;
+}
+
+EXPORT_SYMBOL(netif_rx_ni);
+
static __inline__ void skb_bond(struct sk_buff *skb)
{
struct net_device *dev = skb->dev;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:07    [W:1.339 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site