From a29ed74916dd6ec09471edd62f7292600217b355 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 2 Jul 2010 14:55:41 -0700 Subject: [PATCH] mac-learning: Simplify mac_learning_run() interface. 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 | 2 +- lib/mac-learning.c | 11 ++++++----- lib/mac-learning.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/learning-switch.c b/lib/learning-switch.c index 7eb9e1c29..1cb2fb1ab 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -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. */ diff --git a/lib/mac-learning.c b/lib/mac-learning.c index 5d64f5437..83596bc87 100644 --- a/lib/mac-learning.c +++ b/lib/mac-learning.c @@ -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 diff --git a/lib/mac-learning.h b/lib/mac-learning.h index 89a4e9095..31dd3aea9 100644 --- a/lib/mac-learning.h +++ b/lib/mac-learning.h @@ -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 */ -- 2.47.0