gem5
v20.1.0.0
|
#include <tcp_iface.hh>
Classes | |
struct | NodeInfo |
Compute node info and storage for the very first connection from each node (used by the switch) More... | |
Public Member Functions | |
TCPIface (std::string server_name, unsigned server_port, unsigned dist_rank, unsigned dist_size, Tick sync_start, Tick sync_repeat, EventManager *em, bool use_pseudo_op, bool is_switch, int num_nodes) | |
The ctor creates and connects the stream socket to the server. More... | |
~TCPIface () override | |
Public Member Functions inherited from DistIface | |
DistIface (unsigned dist_rank, unsigned dist_size, Tick sync_start, Tick sync_repeat, EventManager *em, bool use_pseudo_op, bool is_switch, int num_nodes) | |
ctor More... | |
virtual | ~DistIface () |
void | packetOut (EthPacketPtr pkt, Tick send_delay) |
Send out an Ethernet packet. More... | |
EthPacketPtr | packetIn () |
Fetch the packet scheduled to be received next by the simulated network link. More... | |
DrainState | drain () override |
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight. More... | |
void | drainResume () override |
Resume execution after a successful drain. More... | |
void | init (const Event *e, Tick link_delay) |
void | startup () |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Public Member Functions inherited from Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. 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 | sendPacket (const Header &header, const EthPacketPtr &packet) override |
Send out a data packet to the remote end. More... | |
void | sendCmd (const Header &header) override |
Send out a control command to the remote end. More... | |
bool | recvHeader (Header &header) override |
Receive a header (i.e. More... | |
void | recvPacket (const Header &header, EthPacketPtr &packet) override |
Receive a packet from the remote end. More... | |
void | initTransport () override |
Init hook for the underlaying transport. More... | |
Protected Member Functions inherited from Drainable | |
Drainable () | |
virtual | ~Drainable () |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
Private Member Functions | |
void | sendTCP (int sock, const void *buf, unsigned length) |
Send out a message through a TCP stream socket. More... | |
bool | recvTCP (int sock, void *buf, unsigned length) |
Receive the next incoming message through a TCP stream socket. More... | |
bool | listen (int port) |
void | accept () |
void | connect () |
int | getfdStatic () const |
bool | islistening () const |
bool | anyislistening () const |
void | establishConnection () |
Private Attributes | |
int | sock |
The stream socket to connect to the server. More... | |
std::string | serverName |
int | serverPort |
bool | isSwitch |
bool | listening |
Static Private Attributes | |
static bool | anyListening = false |
static int | fdStatic = -1 |
static std::vector< std::pair< NodeInfo, int > > | nodes |
static std::vector< int > | sockRegistry |
Storage for all opened sockets. More... | |
Additional Inherited Members | |
Public Types inherited from DistIface | |
typedef DistHeaderPkt::Header | Header |
Static Public Member Functions inherited from DistIface | |
static bool | readyToExit (Tick delay) |
Initiate the exit from the simulation. More... | |
static bool | readyToCkpt (Tick delay, Tick period) |
Initiate taking a checkpoint. More... | |
static uint64_t | rankParam () |
Getter for the dist rank param. More... | |
static uint64_t | sizeParam () |
Getter for the dist size param. More... | |
static void | toggleSync (ThreadContext *tc) |
Trigger the primary to start/stop synchronization. More... | |
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) |
Protected Types inherited from DistIface | |
typedef DistHeaderPkt::MsgType | MsgType |
typedef DistHeaderPkt::ReqType | ReqType |
Protected Attributes inherited from DistIface | |
unsigned | rank |
The rank of this process among the gem5 peers. More... | |
unsigned | size |
The number of gem5 processes comprising this dist simulation. More... | |
unsigned | distIfaceId |
Unique id for the dist link. More... | |
bool | isPrimary |
Static Protected Attributes inherited from DistIface | |
static unsigned | distIfaceNum = 0 |
Number of DistIface objects (i.e. More... | |
Definition at line 59 of file tcp_iface.hh.
TCPIface::TCPIface | ( | std::string | server_name, |
unsigned | server_port, | ||
unsigned | dist_rank, | ||
unsigned | dist_size, | ||
Tick | sync_start, | ||
Tick | sync_repeat, | ||
EventManager * | em, | ||
bool | use_pseudo_op, | ||
bool | is_switch, | ||
int | num_nodes | ||
) |
The ctor creates and connects the stream socket to the server.
server_name | The name (or IP address) of the host running the server process. |
server_port | The port number the server listening for new connections. |
sync_start | The tick for the first dist synchronisation. |
sync_repeat | The frequency of dist synchronisation. |
em | The EventManager object associated with the simulated Ethernet link. |
Definition at line 81 of file tcp_iface.cc.
References accept(), DPRINTF, ArmISA::i, inform, DistIface::isPrimary, listen(), PowerISA::ni, nodes, panic, recvTCP(), serverPort, DistIface::size, and sock.
|
override |
Definition at line 254 of file tcp_iface.cc.
References sock.
|
private |
Definition at line 207 of file tcp_iface.cc.
References fdStatic, ArmISA::i, sock, and warn.
Referenced by establishConnection(), and TCPIface().
|
inlineprivate |
Definition at line 117 of file tcp_iface.hh.
References anyListening.
|
private |
Definition at line 221 of file tcp_iface.cc.
References DPRINTF, panic_if, serverName, serverPort, sock, sc_dt::to_string(), and warn.
Referenced by establishConnection().
|
private |
Definition at line 151 of file tcp_iface.cc.
References accept(), connect(), DistIface::distIfaceId, DistIface::distIfaceNum, DPRINTF, inform, isSwitch, PowerISA::ni, nodes, panic, DistIface::rank, recvTCP(), sendTCP(), sock, and sockRegistry.
Referenced by initTransport().
|
inlineprivate |
Definition at line 115 of file tcp_iface.hh.
References fdStatic.
|
overrideprotectedvirtual |
Init hook for the underlaying transport.
Implements DistIface.
Definition at line 337 of file tcp_iface.cc.
References establishConnection().
|
inlineprivate |
Definition at line 116 of file tcp_iface.hh.
References listening.
|
private |
Definition at line 114 of file tcp_iface.cc.
References anyListening, fdStatic, listening, panic, and panic_if.
Referenced by TCPIface().
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
private |
Receive the next incoming message through a TCP stream socket.
sock | TCP stream socket. |
buf | Start address of buffer to store the message. |
length | Exact size of the expected message in bytes. |
Definition at line 280 of file tcp_iface.cc.
References inform, length, panic, and sock.
Referenced by establishConnection(), recvHeader(), recvPacket(), and TCPIface().
|
overrideprotectedvirtual |
Send out a control command to the remote end.
header | Meta info describing the command (e.g. sync request) |
Implements DistIface.
Definition at line 306 of file tcp_iface.cc.
References DPRINTF, header, ArmISA::s, sendTCP(), and sockRegistry.
|
overrideprotectedvirtual |
Send out a data packet to the remote end.
header | Meta info about the packet (which needs to be transferred to the destination alongside the packet). |
packet | Pointer to the packet to send. |
Implements DistIface.
Definition at line 299 of file tcp_iface.cc.
|
private |
Send out a message through a TCP stream socket.
sock | TCP stream socket. |
buf | Start address of the message. |
length | Size of the message in bytes. |
Definition at line 263 of file tcp_iface.cc.
References exitSimLoop(), length, panic, panic_if, and sock.
Referenced by establishConnection(), sendCmd(), and sendPacket().
|
staticprivate |
Definition at line 73 of file tcp_iface.hh.
Referenced by anyislistening(), and listen().
|
staticprivate |
Definition at line 74 of file tcp_iface.hh.
Referenced by accept(), getfdStatic(), and listen().
|
private |
Definition at line 70 of file tcp_iface.hh.
Referenced by establishConnection().
|
private |
Definition at line 72 of file tcp_iface.hh.
Referenced by islistening(), and listen().
|
staticprivate |
Definition at line 86 of file tcp_iface.hh.
Referenced by establishConnection(), and TCPIface().
|
private |
Definition at line 67 of file tcp_iface.hh.
Referenced by connect().
|
private |
Definition at line 68 of file tcp_iface.hh.
Referenced by connect(), and TCPIface().
|
private |
The stream socket to connect to the server.
Definition at line 65 of file tcp_iface.hh.
Referenced by accept(), connect(), establishConnection(), recvHeader(), recvPacket(), recvTCP(), sendPacket(), sendTCP(), TCPIface(), and ~TCPIface().
|
staticprivate |
Storage for all opened sockets.
Definition at line 90 of file tcp_iface.hh.
Referenced by establishConnection(), and sendCmd().