gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | List of all members
PacketQueue Class Referenceabstract

A packet queue is a class that holds deferred packets and later sends them using the associated slave port or master port. More...

#include <packet_queue.hh>

Inheritance diagram for PacketQueue:
Drainable ReqPacketQueue RespPacketQueue SnoopRespPacketQueue Cache::CacheReqPacketQueue

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 hasAddr (Addr addr) const
 Check if a packets address exists in the queue. More...
 
bool checkFunctional (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, bool force_order=false)
 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
 Notify an object that it needs to drain its state. 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 (reuest, response or snoop response). More...
 
 PacketQueue (EventManager &_em, const std::string &_label, 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< DeferredPacketDeferredPacketList
 

Private Member Functions

void processSendEvent ()
 Used to schedule sending of deferred packets. More...
 

Private Attributes

DeferredPacketList transmitList
 A list of outgoing packets. More...
 
EventManagerem
 The manager which is used for the event queue. More...
 
EventWrapper< PacketQueue,&PacketQueue::processSendEventsendEvent
 Event used to call processSendEvent. More...
 
bool _disableSanityCheck
 

Detailed Description

A packet queue is a class that holds deferred packets and later sends them using the associated slave port or master port.

Definition at line 65 of file packet_queue.hh.

Member Typedef Documentation

Definition at line 78 of file packet_queue.hh.

Constructor & Destructor Documentation

PacketQueue::PacketQueue ( EventManager _em,
const std::string &  _label,
bool  disable_sanity_check = false 
)
protected

Create a packet queue, linked to an event manager, and a label that will be used for functional print request packets.

Parameters
_emEvent manager used for scheduling this queue
_labelLabel to push on the label stack for print request packets
disable_sanity_checkFlag used to disable the sanity check on the size of the transmitList. The check is enabled by default.

Definition at line 52 of file packet_queue.cc.

PacketQueue::~PacketQueue ( )
protectedvirtual

Virtual desctructor since the class may be used as a base class.

Definition at line 59 of file packet_queue.cc.

Member Function Documentation

bool PacketQueue::checkFunctional ( PacketPtr  pkt)

Check the list of buffered packets against the supplied functional request.

Definition at line 85 of file packet_queue.cc.

References Packet::checkFunctional(), ArmISA::i, label, Packet::popLabel(), Packet::pushLabel(), and transmitList.

Referenced by QueuedSlavePort::checkFunctional(), QueuedMasterPort::checkFunctional(), and SimpleTimingPort::recvFunctional().

bool PacketQueue::deferredPacketReady ( ) const
inlineprotected

Check whether we have a packet ready to go on the transmit list.

Definition at line 108 of file packet_queue.hh.

References curTick(), and transmitList.

Referenced by sendDeferredPacket().

Tick PacketQueue::deferredPacketReadyTime ( ) const
inline

Get the next packet ready time.

Definition at line 161 of file packet_queue.hh.

References MaxTick, and transmitList.

Referenced by Cache::CacheReqPacketQueue::checkConflictingSnoop(), and sendDeferredPacket().

void PacketQueue::disableSanityCheck ( )
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 206 of file packet_queue.hh.

References _disableSanityCheck.

DrainState PacketQueue::drain ( )
overridevirtual

Notify 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.

Note
An object that has entered the Drained state can be disturbed by other objects in the system and consequently stop being drained. These perturbations are not visible in the drain state. The simulator therefore repeats the draining process until all objects return DrainState::Drained on the first call to drain().
Returns
DrainState::Drained if the object is drained at this point in time, DrainState::Draining if it needs further simulation.

Implements Drainable.

Definition at line 228 of file packet_queue.cc.

References DPRINTF, Drained, Draining, and transmitList.

bool PacketQueue::hasAddr ( Addr  addr) const

Check if a packets address exists in the queue.

Definition at line 73 of file packet_queue.cc.

References addr, MipsISA::p, and transmitList.

Referenced by Cache::CacheReqPacketQueue::checkConflictingSnoop().

virtual const std::string PacketQueue::name ( ) const
pure virtual

Provide a name to simplify debugging.

Returns
A complete name, appended to module and port

Implemented in RespPacketQueue, SnoopRespPacketQueue, and ReqPacketQueue.

Referenced by retry(), and schedSendTiming().

void PacketQueue::processSendEvent ( )
private

Used to schedule sending of deferred packets.

Definition at line 221 of file packet_queue.cc.

References sendDeferredPacket(), and waitingOnRetry.

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 64 of file packet_queue.cc.

References DPRINTF, name(), sendDeferredPacket(), and waitingOnRetry.

Referenced by QueuedMasterPort::recvReqRetry(), QueuedSlavePort::recvRespRetry(), and QueuedMasterPort::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.

Parameters
whentime to schedule an event

Definition at line 155 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 Cache::CacheReqPacketQueue::checkConflictingSnoop(), BaseCache::CacheMasterPort::schedSendEvent(), schedSendTiming(), and sendDeferredPacket().

void PacketQueue::schedSendTiming ( PacketPtr  pkt,
Tick  when,
bool  force_order = false 
)

Add a packet to the transmit list, and schedule a send event.

Parameters
pktPacket to send
whenAbsolute time (in ticks) to send packet
force_orderForce insertion order for packets with same address

Definition at line 105 of file packet_queue.cc.

References _disableSanityCheck, Packet::cmdString(), curTick(), DPRINTF, Packet::getAddr(), Packet::getSize(), ArmISA::i, Packet::isExpressSnoop(), name(), panic, schedSendEvent(), and transmitList.

Referenced by QueuedMasterPort::schedTimingReq(), QueuedSlavePort::schedTimingResp(), and QueuedMasterPort::schedTimingSnoopResp().

void PacketQueue::sendDeferredPacket ( )
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 Cache::CacheReqPacketQueue.

Definition at line 191 of file packet_queue.cc.

References deferredPacketReady(), deferredPacketReadyTime(), PacketQueue::DeferredPacket::pkt, schedSendEvent(), sendTiming(), transmitList, and waitingOnRetry.

Referenced by processSendEvent(), and retry().

virtual bool PacketQueue::sendTiming ( PacketPtr  pkt)
protectedpure virtual

Send a packet using the appropriate method for the specific subclass (reuest, response or snoop response).

Implemented in RespPacketQueue, SnoopRespPacketQueue, and ReqPacketQueue.

Referenced by sendDeferredPacket().

size_t PacketQueue::size ( ) const
inline

Get the size of the queue.

Definition at line 156 of file packet_queue.hh.

References transmitList.

Member Data Documentation

bool PacketQueue::_disableSanityCheck
private

Definition at line 97 of file packet_queue.hh.

Referenced by disableSanityCheck(), and schedSendTiming().

EventManager& PacketQueue::em
private

The manager which is used for the event queue.

Definition at line 84 of file packet_queue.hh.

Referenced by schedSendEvent().

const std::string PacketQueue::label
protected

Label to use for print request packets label stack.

Definition at line 102 of file packet_queue.hh.

Referenced by checkFunctional(), ReqPacketQueue::name(), SnoopRespPacketQueue::name(), and RespPacketQueue::name().

EventWrapper<PacketQueue, &PacketQueue::processSendEvent> PacketQueue::sendEvent
private

Event used to call processSendEvent.

Definition at line 90 of file packet_queue.hh.

Referenced by schedSendEvent().

DeferredPacketList PacketQueue::transmitList
private
bool PacketQueue::waitingOnRetry
protected

Remember whether we're awaiting a retry.

Definition at line 105 of file packet_queue.hh.

Referenced by processSendEvent(), retry(), schedSendEvent(), and sendDeferredPacket().


The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:16 for gem5 by doxygen 1.8.6