datapath: Always call dp_process_received_packet() with BHs disabled.
authorBen Pfaff <blp@nicira.com>
Thu, 7 May 2009 00:14:37 +0000 (17:14 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 12 May 2009 23:21:57 +0000 (16:21 -0700)
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
datapath/dp_dev.c

index e3cc7d8c896aa53fb96de2d25306a5f813cca320..252e3e0067ab8a047a0c115b4f9b9bb46188d674 100644 (file)
@@ -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);
index ca878cba7ca6e7e0a9851806102cd647ed96afa0..711ffa403ed80cfb50487d77b3b772982d07da31 100644 (file)
@@ -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);
 }