gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::EtherSwitch::Interface Class Reference

Model for an Ethernet switch port. More...

#include <etherswitch.hh>

Inheritance diagram for gem5::EtherSwitch::Interface:
gem5::EtherInt gem5::Serializable gem5::Port

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)
 
void enqueue (EthPacketPtr packet, unsigned senderId)
 enqueue packet to the outputFifo
 
void sendDone ()
 
Tick switchingDelay ()
 
InterfacelookupDestPort (networking::EthAddr destAddr)
 
void learnSenderAddr (networking::EthAddr srcMacAddr, Interface *sender)
 
void serialize (CheckpointOut &cp) const
 Serialize an object.
 
void unserialize (CheckpointIn &cp)
 Unserialize an object.
 
- Public Member Functions inherited from gem5::EtherInt
 EtherInt (const std::string &name, int idx=InvalidPortID)
 
virtual ~EtherInt ()
 
const std::string & name () const
 Return port name (for DPRINTF).
 
void bind (Port &peer) override
 Attach to a peer port.
 
void unbind () override
 Dettach from a peer port.
 
void setPeer (EtherInt *p)
 
EtherIntgetPeer ()
 
void recvDone ()
 
bool sendPacket (EthPacketPtr packet)
 
bool askBusy ()
 
virtual bool isBusy ()
 
- Public Member Functions inherited from gem5::Port
virtual ~Port ()
 Virtual destructor due to inheritance.
 
PortgetPeer ()
 Return a reference to this port's peer.
 
const std::string name () const
 Return port name (for DPRINTF).
 
PortID getId () const
 Get the port id.
 
bool isConnected () const
 Is this port currently connected to a peer?
 
void takeOverFrom (Port *old)
 A utility function to make it easier to swap out ports.
 
- Public Member Functions inherited from gem5::Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section.
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object.
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 

Protected Member Functions

void transmit ()
 
- Protected Member Functions inherited from gem5::Port
void reportUnbound () const
 
 Port (const std::string &_name, PortID _id)
 Abstract base class for ports.
 

Protected Attributes

PortFifo outputFifo
 output fifo at each interface
 
EventFunctionWrapper txEvent
 
- Protected Attributes inherited from gem5::EtherInt
std::string portName
 
EtherIntpeer
 
- Protected Attributes inherited from gem5::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.
 
Port_peer
 A pointer to this port's peer.
 
bool _connected
 Whether this port is currently connected to a peer port.
 

Private Attributes

const double ticksPerByte
 
const Tick switchDelay
 
const Tick delayVar
 
const unsigned interfaceId
 
EtherSwitchparent
 

Additional Inherited Members

- Static Public Member Functions inherited from gem5::Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section.
 
static void generateCheckpointOut (const std::string &cpt_dir, std::ofstream &outstream)
 Generate a checkpoint file so that the serialization can be routed to it.
 

Detailed Description

Model for an Ethernet switch port.

Definition at line 69 of file etherswitch.hh.

Constructor & Destructor Documentation

◆ Interface()

gem5::EtherSwitch::Interface::Interface ( const std::string & name,
EtherSwitch * _etherSwitch,
uint64_t outputBufferSize,
Tick delay,
Tick delay_var,
double rate,
unsigned id )

Definition at line 126 of file etherswitch.cc.

References transmit().

Member Function Documentation

◆ enqueue()

void gem5::EtherSwitch::Interface::enqueue ( EthPacketPtr packet,
unsigned senderId )

enqueue packet to the outputFifo

Definition at line 165 of file etherswitch.cc.

References gem5::curTick().

Referenced by recvPacket().

◆ learnSenderAddr()

void gem5::EtherSwitch::Interface::learnSenderAddr ( networking::EthAddr srcMacAddr,
Interface * sender )

◆ lookupDestPort()

EtherSwitch::Interface * gem5::EtherSwitch::Interface::lookupDestPort ( networking::EthAddr destAddr)

Definition at line 213 of file etherswitch.cc.

References gem5::curTick(), and DPRINTF.

◆ recvPacket()

bool gem5::EtherSwitch::Interface::recvPacket ( EthPacketPtr packet)
virtual

When a packet is received from a device, route it through an (several) output queue(s)

Implements gem5::EtherInt.

Definition at line 138 of file etherswitch.cc.

References gem5::networking::EthAddr::broadcast(), DPRINTF, enqueue(), gem5::networking::EthAddr::multicast(), gem5::EtherInt::name(), and gem5::Named::name().

◆ sendDone()

void gem5::EtherSwitch::Interface::sendDone ( )
inlinevirtual

Implements gem5::EtherInt.

Definition at line 84 of file etherswitch.hh.

◆ serialize()

void gem5::EtherSwitch::Interface::serialize ( CheckpointOut & cp) const
virtual

Serialize an object.

Output an object's state into the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 276 of file etherswitch.cc.

References SERIALIZE_SCALAR.

◆ switchingDelay()

Tick gem5::EtherSwitch::Interface::switchingDelay ( )

Definition at line 202 of file etherswitch.cc.

References gem5::Random::random(), and gem5::random_mt.

◆ transmit()

void gem5::EtherSwitch::Interface::transmit ( )
protected

Definition at line 181 of file etherswitch.cc.

References gem5::curTick(), DPRINTF, and gem5::sim_clock::as_int::ns.

Referenced by Interface().

◆ unserialize()

void gem5::EtherSwitch::Interface::unserialize ( CheckpointIn & cp)
virtual

Unserialize an object.

Read an object's state from the current checkpoint section.

Parameters
cpCheckpoint state

Implements gem5::Serializable.

Definition at line 289 of file etherswitch.cc.

References UNSERIALIZE_SCALAR.

Member Data Documentation

◆ delayVar

const Tick gem5::EtherSwitch::Interface::delayVar
private

Definition at line 96 of file etherswitch.hh.

◆ interfaceId

const unsigned gem5::EtherSwitch::Interface::interfaceId
private

Definition at line 97 of file etherswitch.hh.

◆ outputFifo

PortFifo gem5::EtherSwitch::Interface::outputFifo
protected

output fifo at each interface

Definition at line 173 of file etherswitch.hh.

◆ parent

EtherSwitch* gem5::EtherSwitch::Interface::parent
private

Definition at line 99 of file etherswitch.hh.

◆ switchDelay

const Tick gem5::EtherSwitch::Interface::switchDelay
private

Definition at line 95 of file etherswitch.hh.

◆ ticksPerByte

const double gem5::EtherSwitch::Interface::ticksPerByte
private

Definition at line 94 of file etherswitch.hh.

◆ txEvent

EventFunctionWrapper gem5::EtherSwitch::Interface::txEvent
protected

Definition at line 175 of file etherswitch.hh.


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:11 for gem5 by doxygen 1.11.0