gem5  v20.1.0.0
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
EtherSwitch::Interface Class Reference

Model for an Ethernet switch port. More...

#include <etherswitch.hh>

Inheritance diagram for EtherSwitch::Interface:
EtherInt Serializable Port


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 ()
InterfacelookupDestPort (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)
EtherIntgetPeer ()
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...
PortgetPeer ()
 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
void reportUnbound () const
 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
- 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...
 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

Additional Inherited Members

- Static Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Gets the fully-qualified name of the active section. More...
static void serializeAll (const std::string &cpt_dir)
 Serializes all the SimObjects. More...
static void unserializeGlobals (CheckpointIn &cp)

Detailed Description

Model for an Ethernet switch port.

Definition at line 68 of file etherswitch.hh.

Constructor & Destructor Documentation

◆ Interface()

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

Definition at line 124 of file

References transmit().

Member Function Documentation

◆ enqueue()

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

enqueue packet to the outputFifo

Definition at line 163 of file

References curTick().

Referenced by recvPacket().

◆ learnSenderAddr()

void EtherSwitch::Interface::learnSenderAddr ( Net::EthAddr  srcMacAddr,
Interface sender 

◆ lookupDestPort()

EtherSwitch::Interface * EtherSwitch::Interface::lookupDestPort ( Net::EthAddr  destAddr)

Definition at line 211 of file

References curTick(), and DPRINTF.

◆ recvPacket()

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

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

Implements EtherInt.

Definition at line 136 of file

References Net::EthAddr::broadcast(), DPRINTF, enqueue(), Net::EthAddr::multicast(), EtherInt::name(), and SimObject::name().

◆ sendDone()

void EtherSwitch::Interface::sendDone ( )

Implements EtherInt.

Definition at line 83 of file etherswitch.hh.

◆ serialize()

void EtherSwitch::Interface::serialize ( CheckpointOut cp) const

Serialize an object.

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

cpCheckpoint state

Implements Serializable.

Definition at line 274 of file


◆ switchingDelay()

Tick EtherSwitch::Interface::switchingDelay ( )

Definition at line 200 of file

References Random::random(), and random_mt.

◆ transmit()

void EtherSwitch::Interface::transmit ( )

Definition at line 179 of file

References curTick(), DPRINTF, and SimClock::Int::ns.

Referenced by Interface().

◆ unserialize()

void EtherSwitch::Interface::unserialize ( CheckpointIn cp)

Unserialize an object.

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

cpCheckpoint state

Implements Serializable.

Definition at line 287 of file


Member Data Documentation

◆ delayVar

const Tick EtherSwitch::Interface::delayVar

Definition at line 95 of file etherswitch.hh.

◆ interfaceId

const unsigned EtherSwitch::Interface::interfaceId

Definition at line 96 of file etherswitch.hh.

◆ outputFifo

PortFifo EtherSwitch::Interface::outputFifo

output fifo at each interface

Definition at line 171 of file etherswitch.hh.

◆ parent

EtherSwitch* EtherSwitch::Interface::parent

Definition at line 98 of file etherswitch.hh.

◆ switchDelay

const Tick EtherSwitch::Interface::switchDelay

Definition at line 94 of file etherswitch.hh.

◆ ticksPerByte

const double EtherSwitch::Interface::ticksPerByte

Definition at line 93 of file etherswitch.hh.

◆ txEvent

EventFunctionWrapper EtherSwitch::Interface::txEvent

Definition at line 173 of file etherswitch.hh.

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

Generated on Wed Sep 30 2020 14:02:24 for gem5 by doxygen 1.8.17