|
gem5
v19.0.0.0
|
Model for an Ethernet switch port. More...
#include <etherswitch.hh>
Classes | |
| class | PortFifo |
| struct | PortFifoEntry |
Public Member Functions | |
| Interface (const std::string &name, EtherSwitch *_etherSwitch, uint64_t outputBufferSize, Tick delay, Tick delay_var, double rate, unsigned id) | |
| bool | recvPacket (EthPacketPtr packet) |
| When a packet is received from a device, route it through an (several) output queue(s) More... | |
| void | enqueue (EthPacketPtr packet, unsigned senderId) |
| enqueue packet to the outputFifo More... | |
| void | sendDone () |
| Tick | switchingDelay () |
| Interface * | lookupDestPort (Net::EthAddr destAddr) |
| void | learnSenderAddr (Net::EthAddr srcMacAddr, Interface *sender) |
| void | serialize (CheckpointOut &cp) const |
| Serialize an object. More... | |
| void | unserialize (CheckpointIn &cp) |
| Unserialize an object. More... | |
Public Member Functions inherited from EtherInt | |
| EtherInt (const std::string &name, int idx=InvalidPortID) | |
| virtual | ~EtherInt () |
| const std::string & | name () const |
| Return port name (for DPRINTF). More... | |
| void | bind (Port &peer) override |
| Attach to a peer port. More... | |
| void | unbind () override |
| Dettach from a peer port. More... | |
| void | setPeer (EtherInt *p) |
| EtherInt * | getPeer () |
| void | recvDone () |
| bool | sendPacket (EthPacketPtr packet) |
| bool | askBusy () |
| virtual bool | isBusy () |
Public Member Functions inherited from Port | |
| virtual | ~Port () |
| Virtual destructor due to inheritance. More... | |
| Port & | getPeer () |
| Return a reference to this port's peer. More... | |
| const std::string | name () const |
| Return port name (for DPRINTF). More... | |
| PortID | getId () const |
| Get the port id. More... | |
| bool | isConnected () const |
| Is this port currently connected to a peer? More... | |
| void | takeOverFrom (Port *old) |
| A utility function to make it easier to swap out ports. More... | |
Public Member Functions inherited from Serializable | |
| Serializable () | |
| virtual | ~Serializable () |
| void | serializeSection (CheckpointOut &cp, const char *name) const |
| Serialize an object into a new section. More... | |
| void | serializeSection (CheckpointOut &cp, const std::string &name) const |
| void | unserializeSection (CheckpointIn &cp, const char *name) |
| Unserialize an a child object. More... | |
| void | unserializeSection (CheckpointIn &cp, const std::string &name) |
Protected Member Functions | |
| void | transmit () |
Protected Member Functions inherited from Port | |
| Port (const std::string &_name, PortID _id) | |
| Abstract base class for ports. More... | |
Protected Attributes | |
| PortFifo | outputFifo |
| output fifo at each interface More... | |
| EventFunctionWrapper | txEvent |
Protected Attributes inherited from EtherInt | |
| std::string | portName |
| EtherInt * | peer |
Protected Attributes inherited from Port | |
| const PortID | id |
| A numeric identifier to distinguish ports in a vector, and set to InvalidPortID in case this port is not part of a vector. More... | |
| Port * | _peer |
| A pointer to this port's peer. More... | |
| bool | _connected |
| Whether this port is currently connected to a peer port. More... | |
Private Attributes | |
| const double | ticksPerByte |
| const Tick | switchDelay |
| const Tick | delayVar |
| const unsigned | interfaceId |
| EtherSwitch * | parent |
Additional Inherited Members | |
Static Public Member Functions inherited from Serializable | |
| static const std::string & | currentSection () |
| Get the fully-qualified name of the active section. More... | |
| static void | serializeAll (const std::string &cpt_dir) |
| static void | unserializeGlobals (CheckpointIn &cp) |
Static Public Attributes inherited from Serializable | |
| static int | ckptCount = 0 |
| static int | ckptMaxCount = 0 |
| static int | ckptPrevCount = -1 |
Model for an Ethernet switch port.
Definition at line 71 of file etherswitch.hh.
| EtherSwitch::Interface::Interface | ( | const std::string & | name, |
| EtherSwitch * | _etherSwitch, | ||
| uint64_t | outputBufferSize, | ||
| Tick | delay, | ||
| Tick | delay_var, | ||
| double | rate, | ||
| unsigned | id | ||
| ) |
Definition at line 127 of file etherswitch.cc.
References EtherInt::name(), and transmit().
| void EtherSwitch::Interface::enqueue | ( | EthPacketPtr | packet, |
| unsigned | senderId | ||
| ) |
enqueue packet to the outputFifo
Definition at line 166 of file etherswitch.cc.
References curTick(), outputFifo, parent, EtherSwitch::Interface::PortFifo::push(), EventManager::reschedule(), switchingDelay(), and txEvent.
Referenced by recvPacket().
| void EtherSwitch::Interface::learnSenderAddr | ( | Net::EthAddr | srcMacAddr, |
| Interface * | sender | ||
| ) |
Definition at line 238 of file etherswitch.cc.
References curTick(), DPRINTF, EtherSwitch::forwardingTable, EtherSwitch::SwitchTableEntry::interface, EtherInt::name(), and parent.
Referenced by recvPacket(), and sendDone().
| EtherSwitch::Interface * EtherSwitch::Interface::lookupDestPort | ( | Net::EthAddr | destAddr | ) |
Definition at line 214 of file etherswitch.cc.
References curTick(), DPRINTF, EtherSwitch::forwardingTable, parent, and EtherSwitch::ttl.
Referenced by recvPacket(), and sendDone().
|
virtual |
When a packet is received from a device, route it through an (several) output queue(s)
Implements EtherInt.
Definition at line 139 of file etherswitch.cc.
References Net::EthAddr::broadcast(), DPRINTF, enqueue(), interfaceId, EtherSwitch::interfaces, learnSenderAddr(), lookupDestPort(), Net::EthAddr::multicast(), EtherInt::name(), and parent.
|
inlinevirtual |
Implements EtherInt.
Definition at line 86 of file etherswitch.hh.
References learnSenderAddr(), lookupDestPort(), serialize(), switchingDelay(), and unserialize().
|
virtual |
Serialize an object.
Output an object's state into the current checkpoint section.
| cp | Checkpoint state |
Implements Serializable.
Definition at line 277 of file etherswitch.cc.
References outputFifo, Event::scheduled(), SERIALIZE_SCALAR, Serializable::serializeSection(), txEvent, and Event::when().
Referenced by sendDone().
| Tick EtherSwitch::Interface::switchingDelay | ( | ) |
Definition at line 203 of file etherswitch.cc.
References delayVar, EtherSwitch::Interface::PortFifo::front(), outputFifo, Random::random(), random_mt, switchDelay, and ticksPerByte.
Referenced by enqueue(), sendDone(), and transmit().
|
protected |
Definition at line 182 of file etherswitch.cc.
References curTick(), DPRINTF, EtherSwitch::Interface::PortFifo::empty(), EtherSwitch::Interface::PortFifo::front(), outputFifo, parent, EtherSwitch::Interface::PortFifo::pop(), retryTime, EventManager::schedule(), Event::scheduled(), EtherInt::sendPacket(), switchingDelay(), and txEvent.
Referenced by Interface().
|
virtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
| cp | Checkpoint state |
Implements Serializable.
Definition at line 290 of file etherswitch.cc.
References outputFifo, parent, EventManager::schedule(), txEvent, UNSERIALIZE_SCALAR, and Serializable::unserializeSection().
Referenced by sendDone().
|
private |
Definition at line 98 of file etherswitch.hh.
Referenced by switchingDelay().
|
private |
Definition at line 99 of file etherswitch.hh.
Referenced by recvPacket().
|
protected |
output fifo at each interface
Definition at line 174 of file etherswitch.hh.
Referenced by enqueue(), serialize(), switchingDelay(), transmit(), and unserialize().
|
private |
Definition at line 101 of file etherswitch.hh.
Referenced by enqueue(), learnSenderAddr(), lookupDestPort(), recvPacket(), transmit(), and unserialize().
|
private |
Definition at line 97 of file etherswitch.hh.
Referenced by switchingDelay().
|
private |
Definition at line 96 of file etherswitch.hh.
Referenced by switchingDelay().
|
protected |
Definition at line 176 of file etherswitch.hh.
Referenced by enqueue(), serialize(), transmit(), and unserialize().