diff options
author | Ben Pfaff <blp@nicira.com> | 2011-03-18 15:28:21 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2011-03-22 09:57:25 -0700 |
commit | 356180a825c94314f3d1667003e64526d1b69da5 (patch) | |
tree | cdd1fbe7cf889c382bf3237fa147ef8fcc01e9d9 /lib/mac-learning.c | |
parent | 1648ddd7c18dab974efae3a007591b6479e3c053 (diff) |
mac-learning: Expose function for expiring a single MAC learning entry.
The bridge will soon use this for expiring only the MAC learning entries
associated with a given port at port deletion time.
Diffstat (limited to 'lib/mac-learning.c')
-rw-r--r-- | lib/mac-learning.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/mac-learning.c b/lib/mac-learning.c index 0bee1523..42864ce0 100644 --- a/lib/mac-learning.c +++ b/lib/mac-learning.c @@ -105,16 +105,6 @@ get_lru(struct mac_learning *ml, struct mac_entry **e) } } -/* Removes 'e' from the 'ml' hash table. 'e' must not already be on the free - * list. */ -static void -free_mac_entry(struct mac_learning *ml, struct mac_entry *e) -{ - list_remove(&e->hash_node); - list_remove(&e->lru_node); - list_push_front(&ml->free, &e->lru_node); -} - /* Creates and returns a new MAC learning table. */ struct mac_learning * mac_learning_create(void) @@ -268,6 +258,16 @@ mac_learning_lookup(const struct mac_learning *ml, } } +/* Expires 'e' from the 'ml' hash table. 'e' must not already be on the free + * list. */ +void +mac_learning_expire(struct mac_learning *ml, struct mac_entry *e) +{ + list_remove(&e->hash_node); + list_remove(&e->lru_node); + list_push_front(&ml->free, &e->lru_node); +} + /* 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. */ @@ -276,7 +276,7 @@ mac_learning_flush(struct mac_learning *ml) { struct mac_entry *e; while (get_lru(ml, &e)){ - free_mac_entry(ml, e); + mac_learning_expire(ml, e); } } @@ -289,7 +289,7 @@ mac_learning_run(struct mac_learning *ml, struct tag_set *set) if (set) { tag_set_add(set, e->tag); } - free_mac_entry(ml, e); + mac_learning_expire(ml, e); } } |