33 #ifndef __DEV_ETHERSWITCH_HH__ 34 #define __DEV_ETHERSWITCH_HH__ 44 #include "params/EtherSwitch.hh" 58 return dynamic_cast<const Params*
>(
_params);
72 uint64_t outputBufferSize,
Tick delay,
Tick delay_var,
73 double rate,
unsigned id);
132 std::set<PortFifoEntry, EntryOrder>
fifo;
140 :objName(name), _maxsize(max), _size(0) {}
143 const std::string
name() {
return objName; }
149 int avail()
const {
return _maxsize - _size; }
152 bool empty()
const {
return _size == 0; }
153 unsigned size()
const {
return _size; }
193 #endif // __DEV_ETHERSWITCH_HH__
PortFifoEntry(EthPacketPtr pkt, Tick recv_tick, unsigned id)
const std::string & name() const
Return port name (for DPRINTF).
Ports are used to interface objects to each other.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
bool recvPacket(EthPacketPtr packet)
When a packet is received from a device, route it through an (several) output queue(s) ...
const PortID InvalidPortID
Interface(const std::string &name, EtherSwitch *_etherSwitch, uint64_t outputBufferSize, Tick delay, Tick delay_var, double rate, unsigned id)
Model for an Ethernet switch port.
const std::string objName
std::vector< Interface * > interfaces
std::map< uint64_t, SwitchTableEntry > forwardingTable
EventFunctionWrapper txEvent
PortFifo(const std::string &name, int max)
PortFifo outputFifo
output fifo at each interface
void learnSenderAddr(Net::EthAddr srcMacAddr, Interface *sender)
Interface * lookupDestPort(Net::EthAddr destAddr)
std::set< PortFifoEntry, EntryOrder > fifo
uint64_t Tick
Tick count type.
void serialize(CheckpointOut &cp) const
Serialize an object.
std::shared_ptr< EthPacketData > EthPacketPtr
Basic support for object serialization.
const unsigned interfaceId
EtherSwitch(const Params *p)
const double ticksPerByte
const Params * params() const
std::ostream CheckpointOut
void unserialize(CheckpointIn &cp)
Unserialize an object.
void enqueue(EthPacketPtr packet, unsigned senderId)
enqueue packet to the outputFifo
const SimObjectParams * _params
Cached copy of the object parameters.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void serialize(CheckpointOut &cp) const
Serialize an object.
Abstract superclass for simulation objects.
void unserialize(CheckpointIn &cp)
Unserialize an object.