@@ -17,15 +17,15 @@ AstraNIC::AstraNIC(ComponentId_t id, Params ¶ms, int nicID) : SubComponent(i
1717 primaryComponentDoNotEndSim ();
1818
1919 // NIC Params
20- mtu_ = params.find <int >(" mtu" , " 1500" );
20+ mtu_ = params.find <int >(" mtu" , " 1500" ); // bytes
2121
2222 // Link params
2323 networkInterface_ = new AstraNetworkInterface (nicID_, *this );
24- std::string lctype = params.find <std::string>(" linkcontrol" , " merlin.linkcontrol " );
24+ std::string lctype = params.find <std::string>(" linkcontrol" , " merlin.reorderlinkcontrol " );
2525 Params lcparams;
26- lcparams.insert (" link_bw" , params.find <std::string>(" network_bw" , " 80GiB /s" ));
27- lcparams.insert (" in_buf_size" , params.find <std::string>(" network_input_buffer_size" , " 8KiB " ));
28- lcparams.insert (" out_buf_size" , params.find <std::string>(" network_output_buffer_size" , " 8KiB " ));
26+ lcparams.insert (" link_bw" , params.find <std::string>(" network_bw" , " 100Gb /s" ));
27+ lcparams.insert (" in_buf_size" , params.find <std::string>(" network_input_buffer_size" , " 10kB " ));
28+ lcparams.insert (" out_buf_size" , params.find <std::string>(" network_output_buffer_size" , " 10kB " ));
2929
3030 freq_ = params.find <std::string>(" frequency" , " 2.0GHz" );
3131 clockHandler_ = new Clock::Handler<AstraNIC, &AstraNIC::tick>(this );
@@ -72,15 +72,14 @@ void AstraNIC::finish() {
7272bool AstraNIC::tick (SimTime_t cycle) {
7373 bool disableClock = false ;
7474
75-
7675 int recvCount = 0 ;
7776 while (!recvQueue.empty ()) {
7877 SimpleNetwork::Request* req = recvQueue.front (); // TODO - do I need to limit how much can be done per cycle?
7978 recvQueue.pop ();
8079 AstraEvent* ae = static_cast <AstraEvent*>(req->takePayload ());
8180
8281 // Notify AstraSim::Sys that the send has completed
83- if (req-> tail ) {
82+ if (ae-> tail_ ) {
8483 ae->msg_handler_ (ae->fun_arg_ );
8584
8685 MsgKey mk{req->src , req->dest , ae->tag_ };
@@ -97,9 +96,11 @@ bool AstraNIC::tick(SimTime_t cycle) {
9796 }
9897 delete (ae);
9998 delete (req);
99+ recvCount++;
100100
101101 }
102102
103+ dbg_->debug (CALL_INFO , 1 , 0 , " nicID=%d Recv %d requests\n " , nicID_, recvCount);
103104 dbg_->debug (CALL_INFO , 1 , 0 , " nicID=%d Send queue size: %d\n " , nicID_, sendQueue.size ());
104105
105106 // drain send queue
@@ -126,6 +127,7 @@ bool AstraNIC::tick(SimTime_t cycle) {
126127 isClocked_ = false ;
127128 }
128129 return disableClock;
130+ // return false;
129131}
130132
131133void AstraNIC::handleSimSchedule (Event* ev) {
@@ -134,27 +136,22 @@ void AstraNIC::handleSimSchedule(Event* ev) {
134136 ae->msg_handler_ (ae->fun_arg_ );
135137 // The event should be delayed when it is put on the Link. We may call it immediately
136138 if (!isClocked_) {
137- // TODO - is this needed?
139+ // TODO - is this needed? - only need to do this in the send/recv logic
138140 reregisterClock (freq_, clockHandler_);
139141 isClocked_ = true ;
140142 }
141143}
142144
143145// Called when a packet is received
144- // TODO put this in clock handler
145146bool AstraNIC::handleRecv (int ) {
146147 dbg_->debug (CALL_INFO , 1 , 0 , " nicID=%d handleRecv called\n " , nicID_);
147148 SST ::Interfaces::SimpleNetwork::Request* req = linkControl_->recv (0 );
148149 recvQueue.push (req);
149150
151+ reregisterClock (freq_, clockHandler_);
152+ isClocked_ = true ;
150153
151- if (!isClocked_) {
152- // TODO - is this needed? - Answer may depend on if we get a send or a recv and whether we already have the other side
153- reregisterClock (freq_, clockHandler_);
154- isClocked_ = true ;
155- }
156-
157- return true ; // TODO - what is this?
154+ return true ; // Keep this handler registered
158155}
159156
160157/* ********************************************************/
@@ -198,14 +195,16 @@ int AstraNIC::sim_send(void* buffer,
198195 if (i == (num_packets - 1 )) {
199196 ae->msg_handler_ = msg_handler;
200197 ae->fun_arg_ = fun_arg;
198+ ae->tail_ = true ;
201199
202- // req->size_in_bits = msg_size_rem * 8;
203- req->size_in_bits = 1 ;
204- req->tail = true ;
200+ // TODO -restore
201+ req->size_in_bits = msg_size_rem * 8 ;
202+ // req->size_in_bits = 1024;
203+ assert (msg_size_rem > 0 );
205204 } else {
206- // req->size_in_bits = mtu_ * 8 ;
207- req->size_in_bits = 1 ;
208- req->tail = false ;
205+ ae-> tail_ = false ;
206+ req->size_in_bits = mtu_ * 8 ;
207+ // req->size_in_bits = 128 ;
209208 msg_size_rem -= mtu_;
210209 }
211210
@@ -221,6 +220,7 @@ int AstraNIC::sim_send(void* buffer,
221220 return 0 ;
222221}
223222
223+ // TODO put these in postedRecvQueue and process during `tick`
224224int AstraNIC::sim_recv (void * msg,
225225 uint64_t msg_size,
226226 int type,
0 commit comments