6 #include <satcat5/eth_sw_cache.h>
23 , m_cache(array, size)
30 if (pkt.
hdr.
src == satcat5::eth::MACADDR_NONE)
return 0;
34 if (pkt.
hdr.
dst == satcat5::eth::MACADDR_NONE)
return 0;
40 return dst ? (1u << dst->
m_port) : m_miss_mask;
57 satcat5::util::set_mask_if(m_miss_mask, mask, enable);
61 if (tbl_idx >= m_size)
return false;
62 port_idx = m_array[tbl_idx].
m_port;
69 if (mac_addr == satcat5::eth::MACADDR_NONE)
return false;
70 if (mac_addr == satcat5::eth::MACADDR_BROADCAST)
return false;
Ethernet switch plugin API.
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_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 query(satcat5::eth::PluginPacket &pkt) override
Implement the required SwitchPlugin API.
A shared-memory Ethernet switch based on the MultiBuffer class.
Diagnostic logging system for the Ethernet switch.
#define SATCAT5_PMASK_TYPE
Set the integer type used to identify source and destination ports.
constexpr SATCAT5_PMASK_TYPE idx2mask(unsigned idx)
Macro converting port-index to a bit-mask.
constexpr SATCAT5_PMASK_TYPE PMASK_ALL(-1)
Global port-mask indicating every port (i.e., broadcast).
An Ethernet MAC address (with serializable interface).
static constexpr satcat5::eth::MacAddr from_u64(u64 x)
Convert from u64 to MacAddr.
bool is_swcontrol() const
Link-local control (01:80:C2:00:00:*)
bool is_multicast() const
Broadcast, L2 multicast, or L3 multicast.
bool is_unicast() const
Any normal single-destination address.
constexpr u64 to_u64() const
Convert from MacAddr to u64.
Ephemeral data structure provided to plugin callbacks.
void drop(u8 reason)
Drop this frame, indicating why.
unsigned src_port() const
Accessors and shortcuts for packet metadata.
SATCAT5_PMASK_TYPE dst_mask
Destination mask for which port(s) receive this packet.
satcat5::eth::Header hdr
Copy of Ethernet header fields.
Data structure for the internal cache.
unsigned m_port
Associated port index.
A single 24-byte packet-log message.
static constexpr u8 DROP_NO_ROUTE
No destination or null route.
Miscellaneous mathematical utility functions.