45#include <sys/socket.h>
54#include "debug/DistEthernet.hh"
55#include "debug/DistEthernetPkt.hh"
56#include "debug/EthernetData.hh"
63#include "params/EtherLink.hh"
74 DPRINTF(DistEthernet,
"DistEtherLink::DistEtherLink() "
75 "link delay:%llu ticksPerByte:%f\n",
p.delay,
p.speed);
82 if (
p.sync_repeat != 0) {
83 if (
p.sync_repeat !=
p.delay)
84 warn(
"DistEtherLink(): sync_repeat is %lu and linkdelay is %lu",
85 p.sync_repeat,
p.delay);
86 sync_repeat =
p.sync_repeat;
88 sync_repeat =
p.delay;
93 p.dist_rank,
p.dist_size,
94 p.sync_start, sync_repeat,
this,
95 p.dist_sync_on_pseudo_op,
p.is_switch,
112 if (if_name ==
"int0")
121 txLink->serializeSection(
cp,
"txLink");
122 rxLink->serializeSection(
cp,
"rxLink");
129 txLink->unserializeSection(
cp,
"txLink");
130 rxLink->unserializeSection(
cp,
"rxLink");
136 DPRINTF(DistEthernet,
"DistEtherLink::init() called\n");
143 DPRINTF(DistEthernet,
"DistEtherLink::startup() called\n");
165 DPRINTF(DistEthernetPkt,
"DistEtherLink::DistLink::rxDone() "
166 "packet received: len=%d\n",
packet->length);
190 DPRINTF(DistEthernet,
"packet not sent, link busy\n");
212 bool packet_exists = (
packet !=
nullptr);
217 bool event_scheduled =
event->scheduled();
219 if (event_scheduled) {
220 Tick event_time =
event->when();
231 packet = std::make_shared<EthPacketData>();
235 bool event_scheduled;
237 if (event_scheduled) {
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
void setLocalInt(LocalIface *i)
void unserialize(CheckpointIn &cp) override
Unserialize an object.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Interface to the local simulated system.
LocalIface(const std::string &name, TxLink *tx, RxLink *rx, DistIface *m)
Model for a receive link.
void setDistInt(DistIface *m)
Register our dist interface to talk to the peer gem5 processes.
void rxDone()
Receive done callback method.
Tick delayVar
Random component of the send delay.
void txDone()
Send done callback.
double ticksPerByte
Per byte send delay.
EventFunctionWrapper doneEvent
void setDistInt(DistIface *m)
Register the dist interface to be used to talk to the peer gem5 processes.
bool transmit(EthPacketPtr packet)
Initiate sending of a packet via this link.
DistEtherLinkParams Params
DistEtherLink(const Params &p)
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.
TxLink * txLink
Send link.
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual void startup() override
startup() is the final initialization call before simulation.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
RxLink * rxLink
Receive link.
The interface class to talk to peer gem5 processes.
const std::string & name() const
Return port name (for DPRINTF).
EtherInt(const std::string &name, int idx=InvalidPortID)
virtual std::string name() const
Ports are used to interface objects to each other.
SimObject(const Params &p)
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Copyright (c) 2024 Arm Limited All rights reserved.
Tick curTick()
The universal simulation clock.
std::ostream CheckpointOut
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
uint64_t Tick
Tick count type.
std::shared_ptr< EthPacketData > EthPacketPtr
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_SCALAR(scalar)