37a38
> * Mohammad Alian
41c42
< * TCP stream socket based interface class for multi gem5 runs.
---
> * TCP stream socket based interface class for dist-gem5 runs.
43,44c44,45
< * For a high level description about multi gem5 see comments in
< * header file multi_iface.hh.
---
> * For a high level description about dist-gem5 see comments in
> * header file dist_iface.hh.
46,48c47,48
< * The TCP subclass of MultiIface uses a separate server process
< * (see tcp_server.[hh,cc] under directory gem5/util/multi). Each gem5
< * process connects to the server via a stream socket. The server process
---
> * Each gem5 process connects to the server (another gem5 process which
> * simulates a switch box) via a stream socket. The server process
58c58
< #include "dev/net/multi_iface.hh"
---
> #include "dev/net/dist_iface.hh"
62c62
< class TCPIface : public MultiIface
---
> class TCPIface : public DistIface
69a70,78
> std::string serverName;
> int serverPort;
>
> bool isSwitch;
>
> bool listening;
> static bool anyListening;
> static int fdStatic;
>
71c80,81
< * Registry for all sockets to the server opened by this gem5 process.
---
> * Compute node info and storage for the very first connection from each
> * node (used by the switch)
72a83,92
> struct NodeInfo
> {
> unsigned rank;
> unsigned distIfaceId;
> unsigned distIfaceNum;
> };
> static std::vector<std::pair<NodeInfo, int> > nodes;
> /**
> * Storage for all opened sockets
> */
85c105
< sendTCP(int sock, void *buf, unsigned length);
---
> sendTCP(int sock, const void *buf, unsigned length);
94a115,121
> bool listen(int port);
> void accept();
> void connect();
> int getfdStatic() const { return fdStatic; }
> bool islistening() const { return listening; }
> bool anyislistening() const { return anyListening; }
> void establishConnection();
96d122
<
99,104c125,126
< virtual void
< sendRaw(void *buf, unsigned length,
< const MultiHeaderPkt::AddressType dest_addr=nullptr) override
< {
< sendTCP(sock, buf, length);
< }
---
> void sendPacket(const Header &header,
> const EthPacketPtr &packet) override;
106,109c128
< virtual bool recvRaw(void *buf, unsigned length) override
< {
< return recvTCP(sock, buf, length);
< }
---
> void sendCmd(const Header &header) override;
111,112c130
< virtual void syncRaw(MultiHeaderPkt::MsgType sync_req,
< Tick sync_tick) override;
---
> bool recvHeader(Header &header) override;
113a132,135
> void recvPacket(const Header &header, EthPacketPtr &packet) override;
>
> void initTransport() override;
>
121,122c143,144
< * @param sync_start The tick for the first multi synchronisation.
< * @param sync_repeat The frequency of multi synchronisation.
---
> * @param sync_start The tick for the first dist synchronisation.
> * @param sync_repeat The frequency of dist synchronisation.
127,128c149,151
< unsigned multi_rank, Tick sync_start, Tick sync_repeat,
< EventManager *em);
---
> unsigned dist_rank, unsigned dist_size,
> Tick sync_start, Tick sync_repeat, EventManager *em,
> bool is_switch, int num_nodes);