X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fmac-learning.c;h=7872e2b97e6cfa3a205b2ff92c13d57ff5a62bb4;hb=153e54814d81cafa89bae451dbfa92a31910e5a6;hp=bb84cfcc0b1ecba84db378c96041ea97ce3d84e0;hpb=16a5d1e4727db5c27a03d57d477512e07abe4988;p=openvswitch diff --git a/lib/mac-learning.c b/lib/mac-learning.c index bb84cfcc..7872e2b9 100644 --- a/lib/mac-learning.c +++ b/lib/mac-learning.c @@ -149,7 +149,7 @@ mac_learning_set_flood_vlans(struct mac_learning *ml, static bool is_learning_vlan(const struct mac_learning *ml, uint16_t vlan) { - return vlan_bitmap_contains(ml->flood_vlans, vlan); + return !ml->flood_vlans || !bitmap_is_set(ml->flood_vlans, vlan); } /* Returns true if 'src_mac' may be learned on 'vlan' for 'ml'. @@ -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);