aboutsummaryrefslogtreecommitdiff
path: root/lib/mac-learning.c
diff options
context:
space:
mode:
authorEthan Jackson <ethan@nicira.com>2012-01-25 11:44:30 -0800
committerEthan Jackson <ethan@nicira.com>2012-01-25 13:11:07 -0800
commitd0040604727e1582abbc28fa62903a822453c99f (patch)
tree7f8574ca15fc3b9b9f0b54520930b7a72f033f02 /lib/mac-learning.c
parent9dc114749e795044c027a2706132b591847e49de (diff)
mac-learning: Only revalidate relevant flows upon flush.
Most callers of mac_learning_flush() need to revalidate all flows anyway, but this update forces new callers of mac_learning_flush() to think about whether or not they need to explicitly handle revalidation. Also, it's theoretically more efficient when there are lots of flows but the learning table is empty, (e.g. bridges that don't use the NORMAL action). Signed-off-by: Ethan Jackson <ethan@nicira.com>
Diffstat (limited to 'lib/mac-learning.c')
-rw-r--r--lib/mac-learning.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/mac-learning.c b/lib/mac-learning.c
index efd1dd4b..7872e2b9 100644
--- a/lib/mac-learning.c
+++ b/lib/mac-learning.c
@@ -260,14 +260,18 @@ mac_learning_expire(struct mac_learning *ml, struct mac_entry *e)
free(e);
}
-/* Expires all the mac-learning entries in 'ml'. The tags in 'ml' are
- * discarded, so the client is responsible for revalidating any flows that
- * depend on 'ml', if necessary. */
+/* Expires all the mac-learning entries in 'ml'. If not NULL, the tags in 'ml'
+ * are added to 'tags'. Otherwise the tags in 'ml' are discarded. The client
+ * is responsible for revalidating any flows that depend on 'ml', if
+ * necessary. */
void
-mac_learning_flush(struct mac_learning *ml)
+mac_learning_flush(struct mac_learning *ml, struct tag_set *tags)
{
struct mac_entry *e;
while (get_lru(ml, &e)){
+ if (tags) {
+ tag_set_add(tags, e->tag);
+ }
mac_learning_expire(ml, e);
}
hmap_shrink(&ml->table);