Fix "waiting for of0 to become free" message on deldp.
authorBen Pfaff <blp@nicira.com>
Thu, 5 Jun 2008 20:38:03 +0000 (13:38 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 5 Jun 2008 20:38:09 +0000 (13:38 -0700)
Thanks to Murphy for help debugging this.

datapath/datapath.c
datapath/forward.c
datapath/forward.h

index ed9c557..20d41cf 100644 (file)
@@ -415,6 +415,11 @@ static void del_dp(struct datapath *dp)
                del_switch_port(p);
        rcu_assign_pointer(dps[dp->dp_idx], NULL);
 
+       /* Kill off local_port dev references from buffered packets that have
+        * associated dst entries. */
+       synchronize_rcu();
+       fwd_discard_all();
+
        /* Destroy dp->netdev.  (Must follow deleting switch ports since
         * dp->local_port has a reference to it.) */
        dp_dev_destroy(dp);
index 2c5410e..4496720 100644 (file)
@@ -556,6 +556,19 @@ static struct sk_buff *retrieve_skb(uint32_t id)
        return skb;
 }
 
+void fwd_discard_all(void) 
+{
+       unsigned long int flags;
+       int i;
+
+       spin_lock_irqsave(&buffer_lock, flags);
+       for (i = 0; i < N_PKT_BUFFERS; i++) {
+               kfree_skb(buffers[i].skb);
+               buffers[i].skb = NULL;
+       }
+       spin_unlock_irqrestore(&buffer_lock, flags);
+}
+
 static void discard_skb(uint32_t id)
 {
        unsigned long int flags;
@@ -572,10 +585,7 @@ static void discard_skb(uint32_t id)
 
 void fwd_exit(void)
 {
-       int i;
-
-       for (i = 0; i < N_PKT_BUFFERS; i++)
-               kfree_skb(buffers[i].skb);
+       fwd_discard_all();
 }
 
 /* Utility functions. */
index ce4d3b1..05e5ac9 100644 (file)
@@ -27,6 +27,7 @@ int fwd_control_input(struct sw_chain *, const struct sender *,
                      const void *, size_t);
 
 uint32_t fwd_save_skb(struct sk_buff *skb);
+void fwd_discard_all(void);
 
 void fwd_exit(void);