packet_queue.cc (12823:ba630bc7a36d) packet_queue.cc (13564:9bbd53a77887)
1/*
1/*
2 * Copyright (c) 2012,2015 ARM Limited
2 * Copyright (c) 2012,2015,2018 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 33 unchanged lines hidden (view full) ---

44#include "mem/packet_queue.hh"
45
46#include "base/trace.hh"
47#include "debug/Drain.hh"
48#include "debug/PacketQueue.hh"
49
50PacketQueue::PacketQueue(EventManager& _em, const std::string& _label,
51 const std::string& _sendEventName,
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 33 unchanged lines hidden (view full) ---

44#include "mem/packet_queue.hh"
45
46#include "base/trace.hh"
47#include "debug/Drain.hh"
48#include "debug/PacketQueue.hh"
49
50PacketQueue::PacketQueue(EventManager& _em, const std::string& _label,
51 const std::string& _sendEventName,
52 bool force_order,
52 bool disable_sanity_check)
53 : em(_em), sendEvent([this]{ processSendEvent(); }, _sendEventName),
54 _disableSanityCheck(disable_sanity_check),
53 bool disable_sanity_check)
54 : em(_em), sendEvent([this]{ processSendEvent(); }, _sendEventName),
55 _disableSanityCheck(disable_sanity_check),
56 forceOrder(force_order),
55 label(_label), waitingOnRetry(false)
56{
57}
58
59PacketQueue::~PacketQueue()
60{
61}
62

--- 34 unchanged lines hidden (view full) ---

97 }
98
99 pkt->popLabel();
100
101 return found;
102}
103
104void
57 label(_label), waitingOnRetry(false)
58{
59}
60
61PacketQueue::~PacketQueue()
62{
63}
64

--- 34 unchanged lines hidden (view full) ---

99 }
100
101 pkt->popLabel();
102
103 return found;
104}
105
106void
105PacketQueue::schedSendTiming(PacketPtr pkt, Tick when, bool force_order)
107PacketQueue::schedSendTiming(PacketPtr pkt, Tick when)
106{
107 DPRINTF(PacketQueue, "%s for %s address %x size %d when %lu ord: %i\n",
108 __func__, pkt->cmdString(), pkt->getAddr(), pkt->getSize(), when,
108{
109 DPRINTF(PacketQueue, "%s for %s address %x size %d when %lu ord: %i\n",
110 __func__, pkt->cmdString(), pkt->getAddr(), pkt->getSize(), when,
109 force_order);
111 forceOrder);
110
111 // we can still send a packet before the end of this tick
112 assert(when >= curTick());
113
114 // express snoops should never be queued
115 assert(!pkt->isExpressSnoop());
116
117 // add a very basic sanity check on the port to ensure the

--- 14 unchanged lines hidden (view full) ---

132 // scheduled, but there is an unfortunate corner case where the
133 // x86 page-table walker and timing CPU send out a new request as
134 // part of the receiving of a response (called by
135 // PacketQueue::sendDeferredPacket), in which we end up calling
136 // ourselves again before we had a chance to update waitingOnRetry
137 // assert(waitingOnRetry || sendEvent.scheduled());
138
139 // this belongs in the middle somewhere, so search from the end to
112
113 // we can still send a packet before the end of this tick
114 assert(when >= curTick());
115
116 // express snoops should never be queued
117 assert(!pkt->isExpressSnoop());
118
119 // add a very basic sanity check on the port to ensure the

--- 14 unchanged lines hidden (view full) ---

134 // scheduled, but there is an unfortunate corner case where the
135 // x86 page-table walker and timing CPU send out a new request as
136 // part of the receiving of a response (called by
137 // PacketQueue::sendDeferredPacket), in which we end up calling
138 // ourselves again before we had a chance to update waitingOnRetry
139 // assert(waitingOnRetry || sendEvent.scheduled());
140
141 // this belongs in the middle somewhere, so search from the end to
140 // order by tick; however, if force_order is set, also make sure
142 // order by tick; however, if forceOrder is set, also make sure
141 // not to re-order in front of some existing packet with the same
142 // address
143 auto i = transmitList.end();
144 --i;
145 while (i != transmitList.begin() && when < i->tick &&
143 // not to re-order in front of some existing packet with the same
144 // address
145 auto i = transmitList.end();
146 --i;
147 while (i != transmitList.begin() && when < i->tick &&
146 !(force_order && i->pkt->getAddr() == pkt->getAddr()))
148 !(forceOrder && i->pkt->getAddr() == pkt->getAddr()))
147 --i;
148
149 // emplace inserts the element before the position pointed to by
150 // the iterator, so advance it one step
151 transmitList.emplace(++i, when, pkt);
152}
153
154void

--- 90 unchanged lines hidden (view full) ---

245bool
246ReqPacketQueue::sendTiming(PacketPtr pkt)
247{
248 return masterPort.sendTimingReq(pkt);
249}
250
251SnoopRespPacketQueue::SnoopRespPacketQueue(EventManager& _em,
252 MasterPort& _masterPort,
149 --i;
150
151 // emplace inserts the element before the position pointed to by
152 // the iterator, so advance it one step
153 transmitList.emplace(++i, when, pkt);
154}
155
156void

--- 90 unchanged lines hidden (view full) ---

247bool
248ReqPacketQueue::sendTiming(PacketPtr pkt)
249{
250 return masterPort.sendTimingReq(pkt);
251}
252
253SnoopRespPacketQueue::SnoopRespPacketQueue(EventManager& _em,
254 MasterPort& _masterPort,
255 bool force_order,
253 const std::string _label)
256 const std::string _label)
254 : PacketQueue(_em, _label, name(_masterPort, _label)),
257 : PacketQueue(_em, _label, name(_masterPort, _label), force_order),
255 masterPort(_masterPort)
256{
257}
258
259bool
260SnoopRespPacketQueue::sendTiming(PacketPtr pkt)
261{
262 return masterPort.sendTimingSnoopResp(pkt);
263}
264
265RespPacketQueue::RespPacketQueue(EventManager& _em, SlavePort& _slavePort,
258 masterPort(_masterPort)
259{
260}
261
262bool
263SnoopRespPacketQueue::sendTiming(PacketPtr pkt)
264{
265 return masterPort.sendTimingSnoopResp(pkt);
266}
267
268RespPacketQueue::RespPacketQueue(EventManager& _em, SlavePort& _slavePort,
269 bool force_order,
266 const std::string _label)
270 const std::string _label)
267 : PacketQueue(_em, _label, name(_slavePort, _label)),
271 : PacketQueue(_em, _label, name(_slavePort, _label), force_order),
268 slavePort(_slavePort)
269{
270}
271
272bool
273RespPacketQueue::sendTiming(PacketPtr pkt)
274{
275 return slavePort.sendTimingResp(pkt);
276}
272 slavePort(_slavePort)
273{
274}
275
276bool
277RespPacketQueue::sendTiming(PacketPtr pkt)
278{
279 return slavePort.sendTimingResp(pkt);
280}