From 9735b6d11357f5fb535d5fb650d025cbf0f80593 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 6 May 2009 17:14:37 -0700 Subject: [PATCH] datapath: Always call dp_process_received_packet() with BHs disabled. dp_process_received_packet() was assuming that bottom-halves were disabled, but this was not true where it was called from dp_dev_do_xmit(). Allow, add comments documenting synchronization. --- datapath/datapath.c | 5 ++++- datapath/dp_dev.c | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index e3cc7d8c..252e3e00 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -532,6 +532,7 @@ static int dp_maint_func(void *data) } #endif +/* Must be called with rcu_read_lock. */ static void do_port_input(struct net_bridge_port *p, struct sk_buff *skb) { @@ -555,6 +556,7 @@ do_port_input(struct net_bridge_port *p, struct sk_buff *skb) dp_process_received_packet(skb, p); } +/* Must be called with rcu_read_lock and with bottom-halves disabled. */ void dp_process_received_packet(struct sk_buff *skb, struct net_bridge_port *p) { struct datapath *dp = p->dp; @@ -594,7 +596,7 @@ void dp_process_received_packet(struct sk_buff *skb, struct net_bridge_port *p) * different set of devices!) */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,22) -/* Called with rcu_read_lock. */ +/* Called with rcu_read_lock and bottom-halves disabled. */ static struct sk_buff *dp_frame_hook(struct net_bridge_port *p, struct sk_buff *skb) { @@ -602,6 +604,7 @@ static struct sk_buff *dp_frame_hook(struct net_bridge_port *p, return NULL; } #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) +/* Called with rcu_read_lock and bottom-halves disabled. */ static int dp_frame_hook(struct net_bridge_port *p, struct sk_buff **pskb) { do_port_input(p, *pskb); diff --git a/datapath/dp_dev.c b/datapath/dp_dev.c index ca878cba..711ffa40 100644 --- a/datapath/dp_dev.c +++ b/datapath/dp_dev.c @@ -100,9 +100,9 @@ static void dp_dev_do_xmit(struct work_struct *work) while ((skb = skb_dequeue(&dp_dev->xmit_queue)) != NULL) { skb_reset_mac_header(skb); - rcu_read_lock(); + rcu_read_lock_bh(); dp_process_received_packet(skb, dp->ports[ODPP_LOCAL]); - rcu_read_unlock(); + rcu_read_unlock_bh(); } netif_wake_queue(dp->netdev); } -- 2.30.2