mac-learning: Simplify mac_learning_run() interface.
authorBen Pfaff <blp@nicira.com>
Fri, 2 Jul 2010 21:55:41 +0000 (14:55 -0700)
committerBen Pfaff <blp@nicira.com>
Fri, 2 Jul 2010 21:55:41 +0000 (14:55 -0700)
It's harder to pass around a tag_set than a single tag.  This simplifies
the upcoming commits that begin to restore full ovs-vswitchd functionality
on the "wdp" branch.

lib/learning-switch.c
lib/mac-learning.c
lib/mac-learning.h

index 7eb9e1c..1cb2fb1 100644 (file)
@@ -151,7 +151,7 @@ lswitch_run(struct lswitch *sw, struct rconn *rconn)
     long long int now = time_msec();
 
     if (sw->ml) {
-        mac_learning_run(sw->ml, NULL);
+        mac_learning_run(sw->ml);
     }
 
     /* If we're waiting for more replies, keeping waiting for up to 10 s. */
index 5d64f54..83596bc 100644 (file)
@@ -296,17 +296,18 @@ mac_learning_flush(struct mac_learning *ml)
     }
 }
 
-void
-mac_learning_run(struct mac_learning *ml, struct tag_set *set)
+tag_type
+mac_learning_run(struct mac_learning *ml)
 {
     struct mac_entry *e;
+    tag_type tags = 0;
+
     while (get_lru(ml, &e) && time_now() >= e->expires) {
         COVERAGE_INC(mac_learning_expired);
-        if (set) {
-            tag_set_add(set, e->tag);
-        }
+        tags |= e->tag;
         free_mac_entry(ml, e);
     }
+    return tags;
 }
 
 void
index 89a4e90..31dd3ae 100644 (file)
@@ -82,7 +82,7 @@ int mac_learning_lookup_tag(const struct mac_learning *,
                             uint16_t vlan, tag_type *tag,
                             bool *is_grat_arp_locked);
 void mac_learning_flush(struct mac_learning *);
-void mac_learning_run(struct mac_learning *, struct tag_set *);
+tag_type mac_learning_run(struct mac_learning *);
 void mac_learning_wait(struct mac_learning *);
 
 #endif /* mac-learning.h */