gem5
v20.1.0.0
|
A packet queue is a class that holds deferred packets and later sends them using the associated CPU-side port or memory-side port. More...
#include <packet_queue.hh>
Classes | |
class | DeferredPacket |
A deferred packet, buffered to transmit later. More... | |
Public Member Functions | |
virtual const std::string | name () const =0 |
Provide a name to simplify debugging. More... | |
size_t | size () const |
Get the size of the queue. More... | |
Tick | deferredPacketReadyTime () const |
Get the next packet ready time. More... | |
bool | checkConflict (const PacketPtr pkt, const int blk_size) const |
Check if a packet corresponding to the same address exists in the queue. More... | |
bool | trySatisfyFunctional (PacketPtr pkt) |
Check the list of buffered packets against the supplied functional request. More... | |
void | schedSendEvent (Tick when) |
Schedule a send event if we are not already waiting for a retry. More... | |
void | schedSendTiming (PacketPtr pkt, Tick when) |
Add a packet to the transmit list, and schedule a send event. More... | |
void | retry () |
Retry sending a packet from the queue. More... | |
void | disableSanityCheck () |
This allows a user to explicitly disable the sanity check on the size of the transmitList, which is enabled by default. More... | |
DrainState | drain () override |
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight. More... | |
Public Member Functions inherited from Drainable | |
DrainState | drainState () const |
Return the current drain state of an object. More... | |
virtual void | notifyFork () |
Notify a child process of a fork. More... | |
Protected Member Functions | |
bool | deferredPacketReady () const |
Check whether we have a packet ready to go on the transmit list. More... | |
virtual void | sendDeferredPacket () |
Attempt to send a packet. More... | |
virtual bool | sendTiming (PacketPtr pkt)=0 |
Send a packet using the appropriate method for the specific subclass (request, response or snoop response). More... | |
PacketQueue (EventManager &_em, const std::string &_label, const std::string &_sendEventName, bool force_order=false, bool disable_sanity_check=false) | |
Create a packet queue, linked to an event manager, and a label that will be used for functional print request packets. More... | |
virtual | ~PacketQueue () |
Virtual desctructor since the class may be used as a base class. More... | |
Protected Member Functions inherited from Drainable | |
Drainable () | |
virtual | ~Drainable () |
virtual void | drainResume () |
Resume execution after a successful drain. More... | |
void | signalDrainDone () const |
Signal that an object is drained. More... | |
Protected Attributes | |
const std::string | label |
Label to use for print request packets label stack. More... | |
bool | waitingOnRetry |
Remember whether we're awaiting a retry. More... | |
Private Types | |
typedef std::list< DeferredPacket > | DeferredPacketList |
Private Member Functions | |
void | processSendEvent () |
Used to schedule sending of deferred packets. More... | |
Private Attributes | |
DeferredPacketList | transmitList |
A list of outgoing packets. More... | |
EventManager & | em |
The manager which is used for the event queue. More... | |
EventFunctionWrapper | sendEvent |
Event used to call processSendEvent. More... | |
bool | _disableSanityCheck |
bool | forceOrder |
if true, inserted packets have to be unconditionally scheduled after the last packet in the queue that references the same address More... | |
A packet queue is a class that holds deferred packets and later sends them using the associated CPU-side port or memory-side port.
Definition at line 62 of file packet_queue.hh.
|
private |
Definition at line 75 of file packet_queue.hh.
|
protected |
Create a packet queue, linked to an event manager, and a label that will be used for functional print request packets.
_em | Event manager used for scheduling this queue |
_label | Label to push on the label stack for print request packets |
force_order | Force insertion order for packets with same address |
disable_sanity_check | Flag used to disable the sanity check on the size of the transmitList. The check is enabled by default. |
Definition at line 47 of file packet_queue.cc.
References processSendEvent().
|
protectedvirtual |
Virtual desctructor since the class may be used as a base class.
Definition at line 58 of file packet_queue.cc.
bool PacketQueue::checkConflict | ( | const PacketPtr | pkt, |
const int | blk_size | ||
) | const |
Check if a packet corresponding to the same address exists in the queue.
pkt | The packet to compare against. |
blk_size | Block size in bytes. |
Definition at line 72 of file packet_queue.cc.
References MipsISA::p, and transmitList.
Referenced by BaseCache::CacheReqPacketQueue::checkConflictingSnoop().
|
inlineprotected |
Check whether we have a packet ready to go on the transmit list.
Definition at line 112 of file packet_queue.hh.
References curTick(), and transmitList.
Referenced by sendDeferredPacket().
|
inline |
Get the next packet ready time.
Definition at line 168 of file packet_queue.hh.
References MaxTick, and transmitList.
Referenced by BaseCache::CacheReqPacketQueue::checkConflictingSnoop(), and sendDeferredPacket().
|
inline |
This allows a user to explicitly disable the sanity check on the size of the transmitList, which is enabled by default.
Users must use this function to explicitly disable the sanity check.
Definition at line 217 of file packet_queue.hh.
References _disableSanityCheck.
|
overridevirtual |
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are partially executed or are partially in flight.
Draining is mostly used before forking and creating a check point.
This function notifies an object that it needs to drain its state.
If the object does not need further simulation to drain internal buffers, it returns DrainState::Drained and automatically switches to the Drained state. If the object needs more simulation, it returns DrainState::Draining and automatically enters the Draining state. Other return values are invalid.
Implements Drainable.
Definition at line 225 of file packet_queue.cc.
References DPRINTF, Drained, Draining, and transmitList.
|
pure virtual |
Provide a name to simplify debugging.
Implemented in RespPacketQueue, SnoopRespPacketQueue, and ReqPacketQueue.
Referenced by retry(), and schedSendTiming().
|
private |
Used to schedule sending of deferred packets.
Definition at line 218 of file packet_queue.cc.
References sendDeferredPacket(), and waitingOnRetry.
Referenced by PacketQueue().
void PacketQueue::retry | ( | ) |
Retry sending a packet from the queue.
Note that this is not necessarily the same packet if something has been added with an earlier time stamp.
Definition at line 63 of file packet_queue.cc.
References DPRINTF, name(), sendDeferredPacket(), and waitingOnRetry.
Referenced by QueuedRequestPort::recvReqRetry(), QueuedResponsePort::recvRespRetry(), and QueuedRequestPort::recvRetrySnoopResp().
void PacketQueue::schedSendEvent | ( | Tick | when | ) |
Schedule a send event if we are not already waiting for a retry.
If the requested time is before an already scheduled send event, the event will be rescheduled. If MaxTick is passed, no event is scheduled. Instead, if we are idle and asked to drain then check and signal drained.
when | time to schedule an event |
Definition at line 152 of file packet_queue.cc.
References curTick(), DPRINTF, Draining, Drainable::drainState(), em, MaxTick, EventManager::reschedule(), EventManager::schedule(), Event::scheduled(), sendEvent, Drainable::signalDrainDone(), transmitList, waitingOnRetry, and Event::when().
Referenced by BaseCache::CacheReqPacketQueue::checkConflictingSnoop(), BaseCache::CacheRequestPort::schedSendEvent(), schedSendTiming(), and sendDeferredPacket().
Add a packet to the transmit list, and schedule a send event.
pkt | Packet to send |
when | Absolute time (in ticks) to send packet |
Definition at line 104 of file packet_queue.cc.
References _disableSanityCheck, Packet::cmdString(), curTick(), DPRINTF, forceOrder, Packet::getAddr(), Packet::getSize(), Packet::isExpressSnoop(), name(), panic, schedSendEvent(), and transmitList.
Referenced by QueuedRequestPort::schedTimingReq(), QueuedResponsePort::schedTimingResp(), and QueuedRequestPort::schedTimingSnoopResp().
|
protectedvirtual |
Attempt to send a packet.
Note that a subclass of the PacketQueue can override this method and thus change the behaviour (as done by the cache for the request queue). The default implementation sends the head of the transmit list. The caller must guarantee that the list is non-empty and that the head packet is scheduled for curTick() (or earlier).
Reimplemented in BaseCache::CacheReqPacketQueue.
Definition at line 188 of file packet_queue.cc.
References deferredPacketReady(), deferredPacketReadyTime(), ArmISA::dp, schedSendEvent(), sendTiming(), transmitList, and waitingOnRetry.
Referenced by processSendEvent(), and retry().
|
protectedpure virtual |
Send a packet using the appropriate method for the specific subclass (request, response or snoop response).
Implemented in RespPacketQueue, SnoopRespPacketQueue, and ReqPacketQueue.
Referenced by sendDeferredPacket().
|
inline |
bool PacketQueue::trySatisfyFunctional | ( | PacketPtr | pkt | ) |
Check the list of buffered packets against the supplied functional request.
Definition at line 84 of file packet_queue.cc.
References ArmISA::i, label, Packet::popLabel(), Packet::pushLabel(), transmitList, and Packet::trySatisfyFunctional().
Referenced by SimpleTimingPort::recvFunctional(), SMMUDevicePort::recvFunctional(), QueuedResponsePort::trySatisfyFunctional(), and QueuedRequestPort::trySatisfyFunctional().
|
private |
Definition at line 94 of file packet_queue.hh.
Referenced by disableSanityCheck(), and schedSendTiming().
|
private |
The manager which is used for the event queue.
Definition at line 81 of file packet_queue.hh.
Referenced by schedSendEvent().
|
private |
if true, inserted packets have to be unconditionally scheduled after the last packet in the queue that references the same address
Definition at line 101 of file packet_queue.hh.
Referenced by schedSendTiming().
|
protected |
Label to use for print request packets label stack.
Definition at line 106 of file packet_queue.hh.
Referenced by ReqPacketQueue::name(), SnoopRespPacketQueue::name(), RespPacketQueue::name(), and trySatisfyFunctional().
|
private |
Event used to call processSendEvent.
Definition at line 87 of file packet_queue.hh.
Referenced by schedSendEvent().
|
private |
A list of outgoing packets.
Definition at line 78 of file packet_queue.hh.
Referenced by checkConflict(), deferredPacketReady(), deferredPacketReadyTime(), drain(), schedSendEvent(), schedSendTiming(), sendDeferredPacket(), size(), and trySatisfyFunctional().
|
protected |
Remember whether we're awaiting a retry.
Definition at line 109 of file packet_queue.hh.
Referenced by processSendEvent(), retry(), schedSendEvent(), and sendDeferredPacket().