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"
75 DPRINTF(DistEthernet,
"DistEtherLink::DistEtherLink() "
76 "link delay:%llu ticksPerByte:%f\n",
p.delay,
p.speed);
83 if (
p.sync_repeat != 0) {
84 if (
p.sync_repeat !=
p.delay)
85 warn(
"DistEtherLink(): sync_repeat is %lu and linkdelay is %lu",
86 p.sync_repeat,
p.delay);
87 sync_repeat =
p.sync_repeat;
89 sync_repeat =
p.delay;
94 p.dist_rank,
p.dist_size,
95 p.sync_start, sync_repeat,
this,
96 p.dist_sync_on_pseudo_op,
p.is_switch,
113 if (if_name ==
"int0")
137 DPRINTF(DistEthernet,
"DistEtherLink::init() called\n");
144 DPRINTF(DistEthernet,
"DistEtherLink::startup() called\n");
166 DPRINTF(DistEthernetPkt,
"DistEtherLink::DistLink::rxDone() "
167 "packet received: len=%d\n", packet->length);
168 DDUMP(EthernetData, packet->data, packet->length);
191 DPRINTF(DistEthernet,
"packet not sent, link busy\n");
196 Tick delay = (
Tick)ceil(((
double)pkt->simLength * ticksPerByte) + 1.0);
205 parent->schedule(doneEvent,
curTick() + delay);
213 bool packet_exists = (packet !=
nullptr);
216 packet->serialize(
"packet", cp);
218 bool event_scheduled =
event->scheduled();
220 if (event_scheduled) {
221 Tick event_time =
event->when();
232 packet = std::make_shared<EthPacketData>();
233 packet->unserialize(
"packet", cp);
236 bool event_scheduled;
238 if (event_scheduled) {
241 parent->schedule(*
event, event_time);
Tick curTick()
The universal simulation clock.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
Model for a receive link.
void rxDone()
Receive done callback method.
void serialize(CheckpointOut &cp) const override
Serialize an object.
#define UNSERIALIZE_SCALAR(scalar)
DistEtherLink(const Params &p)
void txDone()
Send done callback.
DistIface * distIface
Interface to talk to the peer gem5 processes.
RxLink * rxLink
Receive link.
EthPacketPtr packetIn()
Fetch the packet scheduled to be received next by the simulated network link.
void serializeSection(CheckpointOut &cp, const char *name) const
Serialize an object into a new section.
bool sendPacket(EthPacketPtr packet)
void packetOut(EthPacketPtr pkt, Tick send_delay)
Send out an Ethernet packet.
Interface to the local simulated system.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const EventFunctionWrapper * doneEvent() const
Done events will be scheduled by DistIface (so we need the accessor)
LocalIface(const std::string &name, TxLink *tx, RxLink *rx, DistIface *m)
std::enable_if_t< std::is_integral_v< T >, T > random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
TxLink * txLink
Send link.
virtual std::string name() const
void unserializeSection(CheckpointIn &cp, const char *name)
Unserialize an a child object.
std::shared_ptr< EthPacketData > EthPacketPtr
uint64_t Tick
Tick count type.
void dump()
Dump all statistics data to the registered outputs.
void init(const Event *e, Tick link_delay)
Abstract superclass for simulation objects.
#define SERIALIZE_SCALAR(scalar)
#define DDUMP(x, data, count)
DPRINTF is a debugging trace facility that allows one to selectively enable tracing statements.
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void setDistInt(DistIface *m)
Register our dist interface to talk to the peer gem5 processes.
void setDistInt(DistIface *m)
Register the dist interface to be used to talk to the peer gem5 processes.
The interface class to talk to peer gem5 processes.
Ports are used to interface objects to each other.
void serialize(CheckpointOut &cp) const override
Serialize an object.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
DistEtherLinkParams Params
std::ostream CheckpointOut
bool transmit(EthPacketPtr packet)
Initiate sending of a packet via this link.
void setLocalInt(LocalIface *i)
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
virtual void startup() override
startup() is the final initialization call before simulation.
Generated on Sun Jul 30 2023 01:56:55 for gem5 by doxygen 1.8.17