+#include "timeval.h"
+
+struct mac_learning;
+
+#define MAC_MAX 2048
+
+/* Time, in seconds, before expiring a mac_entry due to inactivity. */
+#define MAC_ENTRY_DEFAULT_IDLE_TIME 300
+
+/* Time, in seconds, to lock an entry updated by a gratuitous ARP to avoid
+ * relearning based on a reflection from a bond slave. */
+#define MAC_GRAT_ARP_LOCK_TIME 5
+
+/* 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' 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. */
+ uint16_t vlan; /* VLAN tag. */
+ tag_type tag; /* Tag for this learning entry. */
+
+ /* Learned port. */
+ union {
+ void *p;
+ int i;
+ } port;
+};
+
+int mac_entry_age(const struct mac_learning *, const struct mac_entry *);
+
+/* Returns true if mac_learning_insert() just created 'mac' and the caller has
+ * not yet properly initialized it. */
+static inline bool mac_entry_is_new(const struct mac_entry *mac)
+{
+ return !mac->tag;
+}