

Patch from Stephen Hemminger <shemminger@osdl.org>

Eliminate brlock in bridge code.



 25-akpm/net/bridge/br.c                       |    6 +++---
 25-akpm/net/bridge/br_if.c                    |    7 ++-----
 25-akpm/net/bridge/netfilter/ebtable_broute.c |    7 ++-----
 3 files changed, 7 insertions(+), 13 deletions(-)

diff -puN net/bridge/br.c~brlock-4 net/bridge/br.c
--- 25/net/bridge/br.c~brlock-4	Tue Mar 11 16:58:55 2003
+++ 25-akpm/net/bridge/br.c	Tue Mar 11 16:58:55 2003
@@ -21,7 +21,6 @@
 #include <linux/etherdevice.h>
 #include <linux/init.h>
 #include <linux/if_bridge.h>
-#include <linux/brlock.h>
 #include <asm/uaccess.h>
 #include "br_private.h"
 
@@ -73,14 +72,15 @@ static void __exit br_deinit(void)
 	unregister_netdevice_notifier(&br_device_notifier);
 	br_call_ioctl_atomic(__br_clear_ioctl_hook);
 
-	br_write_lock_bh(BR_NETPROTO_LOCK);
 	br_handle_frame_hook = NULL;
-	br_write_unlock_bh(BR_NETPROTO_LOCK);
 
 #if defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE)
 	br_fdb_get_hook = NULL;
 	br_fdb_put_hook = NULL;
 #endif
+
+	/* netif_receive_skb uses RCU */
+	synchronize_kernel();
 }
 
 EXPORT_SYMBOL(br_should_route_hook);
diff -puN net/bridge/br_if.c~brlock-4 net/bridge/br_if.c
--- 25/net/bridge/br_if.c~brlock-4	Tue Mar 11 16:58:55 2003
+++ 25-akpm/net/bridge/br_if.c	Tue Mar 11 16:58:55 2003
@@ -18,7 +18,6 @@
 #include <linux/if_bridge.h>
 #include <linux/inetdevice.h>
 #include <linux/rtnetlink.h>
-#include <linux/brlock.h>
 #include <asm/uaccess.h>
 #include "br_private.h"
 
@@ -87,12 +86,11 @@ static struct net_bridge **__find_br(cha
 
 static void del_ifs(struct net_bridge *br)
 {
-	br_write_lock_bh(BR_NETPROTO_LOCK);
 	write_lock(&br->lock);
 	while (br->port_list != NULL)
 		__br_del_if(br, br->port_list->dev);
 	write_unlock(&br->lock);
-	br_write_unlock_bh(BR_NETPROTO_LOCK);
+	synchronize_kernel();
 }
 
 static struct net_bridge *new_nb(char *name)
@@ -257,13 +255,12 @@ int br_del_if(struct net_bridge *br, str
 {
 	int retval;
 
-	br_write_lock_bh(BR_NETPROTO_LOCK);
 	write_lock(&br->lock);
 	retval = __br_del_if(br, dev);
 	br_stp_recalculate_bridge_id(br);
 	write_unlock(&br->lock);
-	br_write_unlock_bh(BR_NETPROTO_LOCK);
 
+	synchronize_kernel();
 	return retval;
 }
 
diff -puN net/bridge/netfilter/ebtable_broute.c~brlock-4 net/bridge/netfilter/ebtable_broute.c
--- 25/net/bridge/netfilter/ebtable_broute.c~brlock-4	Tue Mar 11 16:58:55 2003
+++ 25-akpm/net/bridge/netfilter/ebtable_broute.c	Tue Mar 11 16:59:43 2003
@@ -14,7 +14,6 @@
 #include <linux/netfilter_bridge/ebtables.h>
 #include <linux/module.h>
 #include <linux/if_bridge.h>
-#include <linux/brlock.h>
 
 /* EBT_ACCEPT means the frame will be bridged
  * EBT_DROP means the frame will be routed
@@ -69,18 +68,16 @@ static int __init init(void)
 	ret = ebt_register_table(&broute_table);
 	if (ret < 0)
 		return ret;
-	br_write_lock_bh(BR_NETPROTO_LOCK);
 	/* see br_input.c */
 	br_should_route_hook = ebt_broute;
-	br_write_unlock_bh(BR_NETPROTO_LOCK);
+	synchronize_kernel();
 	return ret;
 }
 
 static void __exit fini(void)
 {
-	br_write_lock_bh(BR_NETPROTO_LOCK);
 	br_should_route_hook = NULL;
-	br_write_unlock_bh(BR_NETPROTO_LOCK);
+	synchronize_kernel();
 	ebt_unregister_table(&broute_table);
 }
 

_
