10 #include <satcat5/lru_cache.h>
41 { m_miss_mask = mask; }
46 {
return m_miss_mask; }
62 { m_cache.clear();
return true; }
64 { m_learn = enable;
return true; }
98 const unsigned m_size;
104 template <
unsigned SIZE = 64>
Ethernet switch plugin API.
Wrapper for SwitchCacheInner with the required working memory.
SwitchCache(satcat5::eth::SwitchCore *sw)
Link this cache to the designated SwitchCore.
MAC-address cache plugin for the software-defined Ethernet switch.
void set_miss_bcast(unsigned port_idx, bool enable)
Enable or disable "miss-as-broadcast" flag for a specific port.
bool mactbl_clear()
Read or manipulate the contents of the MAC-address table.
unsigned mactbl_size() const
Read or manipulate the contents of the MAC-address table.
bool mactbl_learn(bool enable)
Read or manipulate the contents of the MAC-address table.
SATCAT5_PMASK_TYPE get_miss_mask() const
Identify which ports are currently in "miss-as-broadcast" mode.
SwitchCacheInner(satcat5::eth::SwitchCore *sw, CacheEntry *array, unsigned size)
Constructor accepts a child-allocated array for the cache.
bool mactbl_read(unsigned tbl_idx, unsigned &port_idx, satcat5::eth::MacAddr &mac_addr)
Read or manipulate the contents of the MAC-address table.
SATCAT5_PMASK_TYPE destination_mask(const PluginPacket &pkt)
Destination MAC-address lookup.
bool mactbl_write(unsigned port_idx, const satcat5::eth::MacAddr &mac_addr)
Read or manipulate the contents of the MAC-address table.
void set_miss_mask(SATCAT5_PMASK_TYPE mask)
Enable or disable "miss-as-broadcast" flag for all ports.
void query(satcat5::eth::PluginPacket &pkt) override
Implement the required SwitchPlugin API.
bool mactbl_learn() const
Read or manipulate the contents of the MAC-address table.
A shared-memory Ethernet switch based on the MultiBuffer class.
Template class implementing a least-recently-used (LRU) cache.
Plugins for the software-defined Ethernet switch and IPv4 router.
#define SATCAT5_PMASK_TYPE
Set the integer type used to identify source and destination ports.
An Ethernet MAC address (with serializable interface).
Ephemeral data structure provided to plugin callbacks.
Data structure for the internal cache.
u64 m_key
MAC address as u64.
CacheEntry * m_next
Linked list of cache entries.
unsigned m_port
Associated port index.