}
}
-/* 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)
}
}
+/* 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. */
{
struct mac_entry *e;
while (get_lru(ml, &e)){
- free_mac_entry(ml, e);
+ mac_learning_expire(ml, e);
}
}
if (set) {
tag_set_add(set, e->tag);
}
- free_mac_entry(ml, e);
+ mac_learning_expire(ml, e);
}
}
uint16_t vlan, tag_type *);
/* Flushing. */
+void mac_learning_expire(struct mac_learning *, struct mac_entry *);
void mac_learning_flush(struct mac_learning *);
#endif /* mac-learning.h */