[PATCH 2.4.21-pre6] synchronize_net patch (1/2)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Several places are all doing the same thing to synchronize with network
receive BH. 
By putting it in one place, it gets the brlock semantics out of several
places. 

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



-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux