X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fmac-learning.h;h=666b00f409ca3c3c52accc23a0e4083dc2bab133;hb=8961699e0310fd2b77035dc7bff63eb9538daf67;hp=df8ea90ec791930acad1792e6f36124b2a990bb5;hpb=e764773ccb007e79f44d948a781fae1313ac28fe;p=sliver-openvswitch.git diff --git a/lib/mac-learning.h b/lib/mac-learning.h index df8ea90ec..666b00f40 100644 --- a/lib/mac-learning.h +++ b/lib/mac-learning.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira Networks. + * Copyright (c) 2008, 2009, 2010, 2011, 2012 Nicira, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -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 @@ -48,7 +49,7 @@ struct mac_entry { /* Learned port. */ union { void *p; - int i; + uint16_t ofp_port; } port; }; @@ -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 *,