Go to the documentation of this file.
44 #include <arpa/inet.h>
45 #include <sys/socket.h>
55 #include "debug/DistEthernet.hh"
56 #include "debug/DistEthernetPkt.hh"
57 #include "debug/EthernetData.hh"
64 #include "params/EtherLink.hh"
72 DPRINTF(DistEthernet,
"DistEtherLink::DistEtherLink() "
73 "link delay:%llu ticksPerByte:%f\n",
p.delay,
p.speed);
80 if (
p.sync_repeat != 0) {
81 if (
p.sync_repeat !=
p.delay)
82 warn(
"DistEtherLink(): sync_repeat is %lu and linkdelay is %lu",
83 p.sync_repeat,
p.delay);
84 sync_repeat =
p.sync_repeat;
86 sync_repeat =
p.delay;
91 p.dist_rank,
p.dist_size,
92 p.sync_start, sync_repeat,
this,
93 p.dist_sync_on_pseudo_op,
p.is_switch,
110 if (if_name ==
"int0")
134 DPRINTF(DistEthernet,
"DistEtherLink::init() called\n");
141 DPRINTF(DistEthernet,
"DistEtherLink::startup() called\n");
163 DPRINTF(DistEthernetPkt,
"DistEtherLink::DistLink::rxDone() "
164 "packet received: len=%d\n", packet->length);
165 DDUMP(EthernetData, packet->data, packet->length);
188 DPRINTF(DistEthernet,
"packet not sent, link busy\n");
193 Tick delay = (
Tick)ceil(((
double)pkt->simLength * ticksPerByte) + 1.0);
202 parent->schedule(doneEvent,
curTick() + delay);
210 bool packet_exists = (packet !=
nullptr);
213 packet->serialize(
"packet",
cp);
215 bool event_scheduled =
event->scheduled();
217 if (event_scheduled) {
218 Tick event_time =
event->when();
229 packet = std::make_shared<EthPacketData>();
230 packet->unserialize(
"packet",
cp);
233 bool event_scheduled;
235 if (event_scheduled) {
238 parent->schedule(*
event, event_time);
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
The interface class to talk to peer gem5 processes.
Model for a receive link.
#define UNSERIALIZE_SCALAR(scalar)
Interface to the local simulated system.
void rxDone()
Receive done callback method.
DistEtherLink(const Params &p)
uint64_t Tick
Tick count type.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
std::enable_if_t< std::is_integral< T >::value, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
void serialize(CheckpointOut &cp) const override
Serialize an object.
LocalIface(const std::string &name, TxLink *tx, RxLink *rx, DistIface *m)
RxLink * rxLink
Receive link.
void init(const Event *e, Tick link_delay)
void txDone()
Send done callback.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
void setLocalInt(LocalIface *i)
void setDistInt(DistIface *m)
Register the dist interface to be used to talk to the peer gem5 processes.
virtual void startup() override
startup() is the final initialization call before simulation.
Ports are used to interface objects to each other.
void setDistInt(DistIface *m)
Register our dist interface to talk to the peer gem5 processes.
void serialize(CheckpointOut &cp) const override
Serialize an object.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
#define SERIALIZE_SCALAR(scalar)
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
bool transmit(EthPacketPtr packet)
Initiate sending of a packet via this link.
virtual const std::string name() const
std::shared_ptr< EthPacketData > EthPacketPtr
TxLink * txLink
Send link.
void dump()
Dump all statistics data to the registered outputs.
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
DistIface * distIface
Interface to talk to the peer gem5 processes.
DistEtherLinkParams Params
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::ostream CheckpointOut
const EventFunctionWrapper * doneEvent() const
Done events will be scheduled by DistIface (so we need the accessor)
bool sendPacket(EthPacketPtr packet)
Tick curTick()
The universal simulation clock.
void packetOut(EthPacketPtr pkt, Tick send_delay)
Send out an Ethernet packet.
EthPacketPtr packetIn()
Fetch the packet scheduled to be received next by the simulated network link.
Abstract superclass for simulation objects.
Generated on Tue Mar 23 2021 19:41:26 for gem5 by doxygen 1.8.17