summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/MessageBuffer.hh
diff options
context:
space:
mode:
authorMatthew Poremba <matthew.poremba@amd.com>2017-01-19 11:59:10 -0500
committerMatthew Poremba <matthew.poremba@amd.com>2017-01-19 11:59:10 -0500
commit42044645b9e3a60bd77a84de6c356033d6133004 (patch)
tree0afd45ce0d71b4dc8cefe21f3ec188cb21a9774e /src/mem/ruby/network/MessageBuffer.hh
parenta4b546c3a139aeb33f087422637ac06fc4477d11 (diff)
downloadgem5-42044645b9e3a60bd77a84de6c356033d6133004.tar.xz
ruby: Check MessageBuffer space in garnet NetworkInterface
Garnet's NetworkInterface does not consider the size of MessageBuffers when ejecting a Message from the network. Add a size check for the MessageBuffer and only enqueue if space is available. If space is not available, the message if placed in a queue and the credit is held. A callback from the MessageBuffer is implemented to wake the NetworkInterface. If there are messages in the stalled queue, they are processed first, in a FIFO manner and if succesfully ejected, the credit is finally sent back upstream. The maximum size of the stall queue is equal to the number of valid VNETs with MessageBuffers attached.
Diffstat (limited to 'src/mem/ruby/network/MessageBuffer.hh')
-rw-r--r--src/mem/ruby/network/MessageBuffer.hh5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mem/ruby/network/MessageBuffer.hh b/src/mem/ruby/network/MessageBuffer.hh
index fc8feb03e..e6ec5ac4b 100644
--- a/src/mem/ruby/network/MessageBuffer.hh
+++ b/src/mem/ruby/network/MessageBuffer.hh
@@ -102,6 +102,9 @@ class MessageBuffer : public SimObject
//! removes it from the queue and returns its total delay.
Tick dequeue(Tick current_time, bool decrement_messages = true);
+ void registerDequeueCallback(std::function<void()> callback);
+ void unregisterDequeueCallback();
+
void recycle(Tick current_time, Tick recycle_latency);
bool isEmpty() const { return m_prio_heap.size() == 0; }
bool isStallMapEmpty() { return m_stall_msg_map.size() == 0; }
@@ -133,6 +136,8 @@ class MessageBuffer : public SimObject
Consumer* m_consumer;
std::vector<MsgPtr> m_prio_heap;
+ std::function<void()> m_dequeue_callback;
+
// use a std::map for the stalled messages as this container is
// sorted and ensures a well-defined iteration order
typedef std::map<Addr, std::list<MsgPtr> > StallMsgMapType;