summaryrefslogtreecommitdiff
path: root/lib/mac-learning.h
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2012-12-08 12:32:33 -0800
committerBen Pfaff <blp@nicira.com>2012-12-08 12:33:30 -0800
commitc4069512603ea753576911da052b3f233026886d (patch)
tree17d6c910dc43a956dc0063d1ce9980719144e7cf /lib/mac-learning.h
parent93161ce9491e5399ceaf0e47e47a3eedf1b9be4c (diff)
downloadopenvswitch-c4069512603ea753576911da052b3f233026886d.tar.gz
vswitchd: Make the maximum size of MAC learning tables user-configurable.
We've had a couple of requests for this over the years. It's easy to do, so let's implement it. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Kyle Mestery <kmestery@cisco.com>
Diffstat (limited to 'lib/mac-learning.h')
-rw-r--r--lib/mac-learning.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/mac-learning.h b/lib/mac-learning.h
index 8f8fd4587..284e7f636 100644
--- a/lib/mac-learning.h
+++ b/lib/mac-learning.h
@@ -26,7 +26,8 @@
struct mac_learning;
-#define MAC_MAX 2048
+/* Default maximum size of a MAC learning table, in entries. */
+#define MAC_DEFAULT_MAX 2048
/* Time, in seconds, before expiring a mac_entry due to inactivity. */
#define MAC_ENTRY_DEFAULT_IDLE_TIME 300
@@ -83,6 +84,7 @@ struct mac_learning {
uint32_t secret; /* Secret for randomizing hash table. */
unsigned long *flood_vlans; /* Bitmap of learning disabled VLANs. */
unsigned int idle_time; /* Max age before deleting an entry. */
+ size_t max_entries; /* Max number of learned MACs. */
};
/* Basics. */
@@ -96,6 +98,7 @@ void mac_learning_wait(struct mac_learning *);
bool mac_learning_set_flood_vlans(struct mac_learning *,
const unsigned long *bitmap);
void mac_learning_set_idle_time(struct mac_learning *, unsigned int idle_time);
+void mac_learning_set_max_entries(struct mac_learning *, size_t max_entries);
/* Learning. */
bool mac_learning_may_learn(const struct mac_learning *,