42 #include <unordered_map> 45 #include "debug/QOS.hh" 46 #include "enums/QoSQPolicy.hh" 54 switch (p->qos_q_policy) {
55 case Enums::QoSQPolicy::fifo:
57 case Enums::QoSQPolicy::lrg:
59 case Enums::QoSQPolicy::lifo:
65 QueuePolicy::PacketQueue::iterator
68 QueuePolicy::PacketQueue::iterator ret = q->end();
71 std::unordered_map<MasterID, QueuePolicy::PacketQueue::iterator> track;
74 for (
auto pkt_it = q->begin(); pkt_it != q->end(); ++pkt_it) {
76 const auto& pkt = *pkt_it;
79 "QoSQPolicy::lrg detected packet without request");
82 MasterID m_id = pkt->req->masterId();
83 DPRINTF(QOS,
"QoSQPolicy::lrg checking packet " 84 "from queue with id %d\n", m_id);
88 "%s: Unrecognized Master\n", __func__);
91 "%s: toServe list is empty\n", __func__);
93 if (toServe.front() == m_id) {
94 DPRINTF(QOS,
"QoSQPolicy::lrg matched to served " 95 "master id %d\n", m_id);
98 toServe.push_back(m_id);
109 if (track.find(m_id) == track.end()) {
110 track[m_id] = pkt_it;
111 DPRINTF(QOS,
"QoSQPolicy::lrg tracking a packet for " 112 "master id %d\n", m_id);
118 for (
const auto& masterId : toServe) {
119 DPRINTF(QOS,
"QoSQPolicy::lrg evaluating alternative " 120 "master id %d\n", masterId);
122 if (track.find(masterId) != track.end()) {
123 ret = track[masterId];
124 DPRINTF(QOS,
"QoSQPolicy::lrg master id " 125 "%d selected for service\n", masterId);
131 DPRINTF(QOS,
"QoSQPolicy::lrg no packet was serviced\n");
143 toServe.push_back(m_id);
MemCtrl * memCtrl
Pointer to parent memory controller implementing the policy.
Least Recently Granted Queue Policy It selects packets from the queue with a round robin-like policy:...
static QueuePolicy * create(const QoSMemCtrlParams *p)
This factory method is used for generating the queue policy.
PacketQueue::iterator selectPacket(PacketQueue *queue) override
Implements LRG packet select policy.
First In First Out Queue Policy.
Last In First Out Queue Policy.
MasterID masterId() const
bool hasMaster(MasterID m_id) const
hasMaster returns true if the selected master(ID) has been registered in the memory controller...
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void enqueuePacket(PacketPtr pkt) override
This method is called by the memory controller after it enqueues a packet.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...