diff options
author | Ethan Jackson <ethan@nicira.com> | 2011-07-22 12:00:46 -0700 |
---|---|---|
committer | Ethan Jackson <ethan@nicira.com> | 2011-07-22 19:04:14 -0700 |
commit | 16a5d1e4727db5c27a03d57d477512e07abe4988 (patch) | |
tree | 481609138500bee2eb205914eb2645388ecfa529 /lib/mac-learning.h | |
parent | 8e8d5966947dfc2153b60a6b7d2326db49838024 (diff) | |
download | openvswitch-16a5d1e4727db5c27a03d57d477512e07abe4988.tar.gz |
mac-learning: Simplify memory management.
The mac-learning implementation used a free list to keep track of
statically allocated table entries. This made the code slightly
more difficult to understand than the more straightforward heap
based strategy implemented by this patch.
Diffstat (limited to 'lib/mac-learning.h')
-rw-r--r-- | lib/mac-learning.h | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/mac-learning.h b/lib/mac-learning.h index d2f28744f..0263e4987 100644 --- a/lib/mac-learning.h +++ b/lib/mac-learning.h @@ -36,7 +36,7 @@ /* A MAC learning table entry. */ struct mac_entry { struct hmap_node hmap_node; /* Node in a mac_learning hmap. */ - struct list lru_node; /* Element in 'lrus' or 'free' list. */ + struct list lru_node; /* Element in 'lrus' list. */ time_t expires; /* Expiration time. */ time_t grat_arp_lock; /* Gratuitous ARP lock expiration time. */ uint8_t mac[ETH_ADDR_LEN]; /* Known MAC address. */ @@ -76,10 +76,8 @@ static inline bool mac_entry_is_grat_arp_locked(const struct mac_entry *mac) /* MAC learning table. */ struct mac_learning { struct hmap table; /* Learning table. */ - struct list free; /* Not-in-use entries. */ struct list lrus; /* In-use entries, least recently used at the front, most recently used at the back. */ - struct mac_entry entries[MAC_MAX]; /* All entries. */ uint32_t secret; /* Secret for randomizing hash table. */ unsigned long *flood_vlans; /* Bitmap of learning disabled VLANs. */ }; |