linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2.5.66] sychronize_net patch (1/2)
@ 2003-03-31 23:12 Stephen Hemminger
  2003-04-01 17:51 ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2003-03-31 23:12 UTC (permalink / raw)
  To: David Miller; +Cc: linux-net, Linux Kernel Mailing List

Several places are all doing the same thing to synchronize with network
receive BH.  This patch for 2.5.66 moves this into a new function
synchronize_net.

By putting it in one place, it gets the brlock semantics out of several
places. The motivation is that eventually on 2.5 based kernels the
function can call synchronize_kernel for RCU but leave the 2.4 code
alone. 

diff -urN -X dontdiff linux-2.4/include/linux/netdevice.h linux-2.4-netsync/include/linux/netdevice.h
--- linux-2.4/include/linux/netdevice.h	2003-03-31 11:09:07.000000000 -0800
+++ linux-2.4-netsync/include/linux/netdevice.h	2003-03-31 06:25:34.000000000 -0800
@@ -474,6 +474,7 @@
 extern int		dev_queue_xmit(struct sk_buff *skb);
 extern int		register_netdevice(struct net_device *dev);
 extern int		unregister_netdevice(struct net_device *dev);
+extern void		synchronize_net(void);
 extern int 		register_netdevice_notifier(struct notifier_block *nb);
 extern int		unregister_netdevice_notifier(struct notifier_block *nb);
 extern int		dev_new_index(void);
diff -urN -X dontdiff linux-2.4/net/core/dev.c linux-2.4-netsync/net/core/dev.c
--- linux-2.4/net/core/dev.c	2003-03-31 11:09:09.000000000 -0800
+++ linux-2.4-netsync/net/core/dev.c	2003-03-31 14:26:11.000000000 -0800
@@ -2508,6 +2508,12 @@
 	return 0;
 }
 
+/* Synchronize with packet receive processing. */
+void synchronize_net() {
+	br_write_lock_bh(BR_NETPROTO_LOCK);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
+}
+
 /**
  *	unregister_netdevice - remove device from the kernel
  *	@dev: device
@@ -2547,9 +2553,7 @@
 		return -ENODEV;
 	}
 
-	/* Synchronize to net_rx_action. */
-	br_write_lock_bh(BR_NETPROTO_LOCK);
-	br_write_unlock_bh(BR_NETPROTO_LOCK);
+ 	synchronize_net();
 
 	if (dev_boot_phase == 0) {
 #ifdef CONFIG_NET_FASTROUTE
diff -urN -X dontdiff linux-2.4/net/netsyms.c linux-2.4-netsync/net/netsyms.c
--- linux-2.4/net/netsyms.c	2003-03-31 11:09:08.000000000 -0800
+++ linux-2.4-netsync/net/netsyms.c	2003-03-31 06:25:34.000000000 -0800
@@ -478,6 +478,7 @@
 EXPORT_SYMBOL(loopback_dev);
 EXPORT_SYMBOL(register_netdevice);
 EXPORT_SYMBOL(unregister_netdevice);
+EXPORT_SYMBOL(synchronize_net);
 EXPORT_SYMBOL(netdev_state_change);
 EXPORT_SYMBOL(dev_new_index);
 EXPORT_SYMBOL(dev_get_by_index);




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.5.66] sychronize_net patch (1/2)
  2003-03-31 23:12 [PATCH 2.5.66] sychronize_net patch (1/2) Stephen Hemminger
@ 2003-04-01 17:51 ` David S. Miller
  2003-04-01 19:20   ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: David S. Miller @ 2003-04-01 17:51 UTC (permalink / raw)
  To: shemminger; +Cc: linux-net, linux-kernel

   From: Stephen Hemminger <shemminger@osdl.org>
   Date: 31 Mar 2003 15:12:58 -0800

   @@ -2508,6 +2508,12 @@
    	return 0;
    }
    
   +/* Synchronize with packet receive processing. */
   +void synchronize_net() {
   +	br_write_lock_bh(BR_NETPROTO_LOCK);
   +	br_write_unlock_bh(BR_NETPROTO_LOCK);
   +}
   +

Functions without arguments are specified with "(void)" not "()", I'm
surprised the compiler didn't warn you about this.

Also, bad code style:

void function_name(args)
{
}

Never like:

void function_name(args) {
}

Functions are not braced like conditional statements such as:

	if (foo) {
	}

or

	while (foo) {
	}

Please fix this stuff.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.5.66] sychronize_net patch (1/2)
  2003-04-01 17:51 ` David S. Miller
@ 2003-04-01 19:20   ` Stephen Hemminger
  2003-04-03 12:41     ` David S. Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2003-04-01 19:20 UTC (permalink / raw)
  To: David S. Miller; +Cc: linux-net, Linux Kernel Mailing List

On Tue, 2003-04-01 at 09:51, David S. Miller wrote:


> Please fix this stuff.

Here is an update with the correct style.

diff -urN -X dontdiff linux-2.5/include/linux/netdevice.h linux-2.5-netsync/include/linux/netdevice.h
--- linux-2.5/include/linux/netdevice.h	2003-03-31 10:45:58.000000000 -0800
+++ linux-2.5-netsync/include/linux/netdevice.h	2003-03-31 13:42:39.000000000 -0800
@@ -486,6 +486,7 @@
 extern int		dev_queue_xmit(struct sk_buff *skb);
 extern int		register_netdevice(struct net_device *dev);
 extern int		unregister_netdevice(struct net_device *dev);
+extern void		synchronize_net(void);
 extern int 		register_netdevice_notifier(struct notifier_block *nb);
 extern int		unregister_netdevice_notifier(struct notifier_block *nb);
 extern int		call_netdevice_notifiers(unsigned long val, void *v);
diff -urN -X dontdiff linux-2.5/net/core/dev.c linux-2.5-netsync/net/core/dev.c
--- linux-2.5/net/core/dev.c	2003-03-31 10:46:01.000000000 -0800
+++ linux-2.5-netsync/net/core/dev.c	2003-04-01 10:29:35.000000000 -0800
@@ -2646,6 +2646,13 @@
 	return 0;
 }
 
+/* Synchronize with packet receive processing. */
+void synchronize_net(void) 
+{
+	br_write_lock_bh(BR_NETPROTO_LOCK);
+	br_write_unlock_bh(BR_NETPROTO_LOCK);
+}
+
 /**
  *	unregister_netdevice - remove device from the kernel
  *	@dev: device
@@ -2688,10 +2695,7 @@
 		return -ENODEV;
 	}
 
-	/* Synchronize to net_rx_action. */
-	br_write_lock_bh(BR_NETPROTO_LOCK);
-	br_write_unlock_bh(BR_NETPROTO_LOCK);
-
+	synchronize_net();
 
 #ifdef CONFIG_NET_FASTROUTE
 	dev_clear_fastroute(dev);
diff -urN -X dontdiff linux-2.5/net/netsyms.c linux-2.5-netsync/net/netsyms.c
--- linux-2.5/net/netsyms.c	2003-03-31 10:46:00.000000000 -0800
+++ linux-2.5-netsync/net/netsyms.c	2003-03-31 13:42:41.000000000 -0800
@@ -548,6 +548,7 @@
 EXPORT_SYMBOL(loopback_dev);
 EXPORT_SYMBOL(register_netdevice);
 EXPORT_SYMBOL(unregister_netdevice);
+EXPORT_SYMBOL(synchronize_net);
 EXPORT_SYMBOL(netdev_state_change);
 EXPORT_SYMBOL(dev_new_index);
 EXPORT_SYMBOL(dev_get_by_flags);




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2.5.66] sychronize_net patch (1/2)
  2003-04-01 19:20   ` Stephen Hemminger
@ 2003-04-03 12:41     ` David S. Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David S. Miller @ 2003-04-03 12:41 UTC (permalink / raw)
  To: shemminger; +Cc: linux-net, linux-kernel

   From: Stephen Hemminger <shemminger@osdl.org>
   Date: 01 Apr 2003 11:20:53 -0800
   
   Here is an update with the correct style.

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-03 12:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-31 23:12 [PATCH 2.5.66] sychronize_net patch (1/2) Stephen Hemminger
2003-04-01 17:51 ` David S. Miller
2003-04-01 19:20   ` Stephen Hemminger
2003-04-03 12:41     ` David S. Miller

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).