File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -203,11 +203,11 @@ int AstraNIC::sim_recv(void* msg,
203203
204204 auto it = msgMap_.find (mk);
205205 if (it != msgMap_.end ()) {
206- // Send already completed
206+ // Match Send already completed. Notify AstraSim that the recieve has completed.
207207 msg_handler (fun_arg);
208208 msgMap_.erase (it);
209209 } else {
210- // Send not yet completed
210+ // Matching send not yet completed. Record that this recive has posted.
211211 msgMap_[mk] = CallbackHolder{msg_handler, fun_arg};
212212 }
213213 return 0 ;
@@ -226,8 +226,6 @@ void AstraNIC::sim_schedule(AstraSim::timespec_t delta,
226226}
227227
228228void AstraNIC::sim_notify_finished () {
229- // TODO - can we be sure that all sends and recieves are done when this is called? Need to investigate why ns3 frontend has that tracker
230- assert (msgMap_.size () == 0 );
231229 if (msgMap_.size () != 0 ) {
232230 out_->output (CALL_INFO , " WARNING: sim_notify_finished called with non-empty msgMap\n " );
233231 }
Original file line number Diff line number Diff line change 44#include < functional>
55#include < string>
66
7+ using nid_t = int64_t ;
8+
79class MsgKey {
810public:
9- int src;
10- int dst;
11+ nid_t src;
12+ nid_t dst;
1113 int tag;
1214
1315 MsgKey () = default ;
1416
15- MsgKey (int src_, int dst_, int tag_)
17+ MsgKey (nid_t src_, nid_t dst_, nid_t tag_)
1618 : src(src_), dst(dst_), tag(tag_) {}
1719
18- std::string to_string () const {
19- return " (" + std::to_string (src) + " , " +
20- std::to_string (dst) + " , " +
21- std::to_string (tag) + " )" ;
22- }
23-
2420 bool operator ==(const MsgKey& other) const noexcept {
2521 return src == other.src && dst == other.dst && tag == other.tag ;
2622 }
2723};
2824
2925struct MsgKeyHash {
3026 std::size_t operator ()(const MsgKey& t) const noexcept {
31- std::size_t h1 = std::hash<int >{}(t.src );
32- std::size_t h2 = std::hash<int >{}(t.dst );
27+ std::size_t h1 = std::hash<nid_t >{}(t.src );
28+ std::size_t h2 = std::hash<nid_t >{}(t.dst );
3329 std::size_t h3 = std::hash<int >{}(t.tag );
3430 return h1 ^ (h2 << 1 ) ^ (h3 << 2 );
3531 }
You can’t perform that action at this time.
0 commit comments