50c50,51
< outstandingResponses(0), queueLimit(_queueLimit), sendEvent(this)
---
> outstandingResponses(0), queuedRequests(0),
> queueLimit(_queueLimit), sendEvent(this)
94a96,102
> bool
> Bridge::BridgePort::queueFull()
> {
> // use >= here because sendQueue could get larger because of
> // nacks getting inserted
> return queuedRequests + outstandingResponses >= queueLimit;
> }
101,102c109,113
< if (pkt->flags & SNOOP_COMMIT) {
< DPRINTF(BusBridge, "recvTiming: src %d dest %d addr 0x%x\n",
---
> if (!(pkt->flags & SNOOP_COMMIT))
> return true;
>
>
> DPRINTF(BusBridge, "recvTiming: src %d dest %d addr 0x%x\n",
105c116,119
< return otherPort->queueForSendTiming(pkt);
---
> if (pkt->isRequest() && otherPort->queueFull()) {
> DPRINTF(BusBridge, "Remote queue full, nacking\n");
> nackRequest(pkt);
> return true;
107,109c121,150
< else {
< // Else it's just a snoop, properly return if we are blocking
< return !queueFull();
---
>
> if (pkt->needsResponse() && pkt->result != Packet::Nacked)
> if (queueFull()) {
> DPRINTF(BusBridge, "Local queue full, no space for response, nacking\n");
> DPRINTF(BusBridge, "queue size: %d outreq: %d outstanding resp: %d\n",
> sendQueue.size(), queuedRequests, outstandingResponses);
> nackRequest(pkt);
> return true;
> } else {
> DPRINTF(BusBridge, "Request Needs response, reserving space\n");
> ++outstandingResponses;
> }
>
> otherPort->queueForSendTiming(pkt);
>
> return true;
> }
>
> void
> Bridge::BridgePort::nackRequest(PacketPtr pkt)
> {
> // Nack the packet
> pkt->result = Packet::Nacked;
> pkt->setDest(pkt->getSrc());
>
> //put it on the list to send
> Tick readyTime = curTick + delay;
> PacketBuffer *buf = new PacketBuffer(pkt, readyTime, true);
> if (sendQueue.empty()) {
> sendEvent.schedule(readyTime);
110a152
> sendQueue.push_back(buf);
114c156
< bool
---
> void
117,122c159
< if (queueFull()) {
< DPRINTF(BusBridge, "Queue full, returning false\n");
< return false;
< }
<
< if (pkt->isResponse()) {
---
> if (pkt->isResponse() || pkt->result == Packet::Nacked) {
130a168,174
>
> // Check if this packet was expecting a response (this is either it or
> // its a nacked packet and we won't be seeing that response)
> if (buf->expectResponse)
> --outstandingResponses;
>
>
149c193
<
---
> ++queuedRequests;
151,152d194
<
< return true;
172c214,215
< pkt->getOffset(pbs) && pkt->getSize() != pbs) {
---
> pkt->result != Packet::Nacked && pkt->getOffset(pbs) &&
> pkt->getSize() != pbs) {
187,190c230
< // Must wait for response. We just need to count outstanding
< // responses (in case we want to cap them); PacketBuffer
< // pointer will be recovered on response.
< ++outstandingResponses;
---
> // Must wait for response
198a239,241
> if (!buf->nacked)
> --queuedRequests;
>
201a245
> DPRINTF(BusBridge, "Scheduling next send\n");
205c249
< if (was_full) {
---
> if (was_full && !queueFull()) {
213a258,259
> DPRINTF(BusBridge, "trySend: queue size: %d outreq: %d outstanding resp: %d\n",
> sendQueue.size(), queuedRequests, outstandingResponses);
292a339
>