Thanks for the review.  Here's an incremental.

---
 lib/mac-learning.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/mac-learning.c b/lib/mac-learning.c
index d66f331..f9b3171 100644
--- a/lib/mac-learning.c
+++ b/lib/mac-learning.c
@@ -246,7 +246,10 @@ mac_learning_insert(struct mac_learning *ml,
     return e;
 }
 
-/* Changes 'e''s tag to a new, randomly selected one.
+/* Changes 'e''s tag to a new, randomly selected one.  Causes
+ * mac_learning_run() to flag for revalidation the tag that would have been
+ * previously used for this entry's MAC and VLAN (either before 'e' was
+ * inserted, if it is new, or otherwise before its port was updated.)
  *
  * The client should call this function after obtaining a MAC learning entry
  * from mac_learning_insert(), if the entry is either new or if its learned
@@ -322,7 +325,9 @@ mac_learning_run(struct mac_learning *ml, struct tag_set 
*set)
 {
     struct mac_entry *e;
 
-    tag_set_union(set, &ml->tags);
+    if (set) {
+        tag_set_union(set, &ml->tags);
+    }
     tag_set_init(&ml->tags);
 
     while (get_lru(ml, &e)
@@ -339,7 +344,8 @@ mac_learning_run(struct mac_learning *ml, struct tag_set 
*set)
 void
 mac_learning_wait(struct mac_learning *ml)
 {
-    if (hmap_count(&ml->table) > ml->max_entries) {
+    if (hmap_count(&ml->table) > ml->max_entries
+        || !tag_set_is_empty(&ml->tags)) {
         poll_immediate_wake();
     } else if (!list_is_empty(&ml->lrus)) {
         struct mac_entry *e = mac_entry_from_lru_node(ml->lrus.next);
-- 
1.7.9.5

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to