summaryrefslogtreecommitdiff
path: root/src/dev
diff options
context:
space:
mode:
authorAli Saidi <Ali.Saidi@ARM.com>2011-09-13 12:06:13 -0500
committerAli Saidi <Ali.Saidi@ARM.com>2011-09-13 12:06:13 -0500
commit6caea472a9c192e38ad5057dc0053c72786f8584 (patch)
tree886d75f6acc2c0d77e2578e16aa4dceddc7f1c81 /src/dev
parentcbb23a1d3c3df9d6bed34f50a0193b93319477e6 (diff)
downloadgem5-6caea472a9c192e38ad5057dc0053c72786f8584.tar.xz
IGbE: Clean up debug printing and proprly account for copied bytes.
Some DPRINTFs were printing uninitalized values because the DPRINTFs were always being printed even when the features they were printing weren't being used. This change moves the DPRINTFs into the appropriate if blocks and initializes the state variables correctly. There also is a case where the offset into the packet could be calculated incorrectly during a DMA that is fixed.
Diffstat (limited to 'src/dev')
-rw-r--r--src/dev/i8254xGBe.cc34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/dev/i8254xGBe.cc b/src/dev/i8254xGBe.cc
index db03f5778..d26bbf4ba 100644
--- a/src/dev/i8254xGBe.cc
+++ b/src/dev/i8254xGBe.cc
@@ -1534,7 +1534,10 @@ IGbE::RxDescCache::unserialize(Checkpoint *cp, const std::string &section)
IGbE::TxDescCache::TxDescCache(IGbE *i, const std::string n, int s)
: DescCache<TxDesc>(i,n, s), pktDone(false), isTcp(false),
pktWaiting(false), completionAddress(0), completionEnabled(false),
- useTso(false), pktEvent(this), headerEvent(this), nullEvent(this)
+ useTso(false), tsoHeaderLen(0), tsoMss(0), tsoTotalLen(0), tsoUsedLen(0),
+ tsoPrevSeq(0), tsoPktPayloadBytes(0), tsoLoadedHeader(false),
+ tsoPktHasHeader(false), tsoDescBytesUsed(0), tsoCopyBytes(0), tsoPkts(0),
+ pktEvent(this), headerEvent(this), nullEvent(this)
{
annSmFetch = "TX Desc Fetch";
annSmWb = "TX Desc Writeback";
@@ -1582,7 +1585,7 @@ IGbE::TxDescCache::processContextDesc()
tsoPrevSeq = 0;
tsoPktHasHeader = false;
tsoPkts = 0;
-
+ tsoCopyBytes = 0;
}
TxdOp::setDd(desc);
@@ -1666,19 +1669,20 @@ IGbE::TxDescCache::getPacketSize(EthPacketPtr p)
DPRINTF(EthernetDesc, "TSO: use: %d hdrlen: %d mss: %d total: %d "
"used: %d loaded hdr: %d\n", useTso, tsoHeaderLen, tsoMss,
tsoTotalLen, tsoUsedLen, tsoLoadedHeader);
- DPRINTF(EthernetDesc, "TSO: descBytesUsed: %d copyBytes: %d "
- "this descLen: %d\n",
- tsoDescBytesUsed, tsoCopyBytes, TxdOp::getLen(desc));
- DPRINTF(EthernetDesc, "TSO: pktHasHeader: %d\n", tsoPktHasHeader);
-
+
if (tsoPktHasHeader)
tsoCopyBytes = std::min((tsoMss + tsoHeaderLen) - p->length,
- TxdOp::getLen(desc) - tsoDescBytesUsed);
+ TxdOp::getLen(desc) - tsoDescBytesUsed);
else
tsoCopyBytes = std::min(tsoMss,
TxdOp::getLen(desc) - tsoDescBytesUsed);
unsigned pkt_size =
tsoCopyBytes + (tsoPktHasHeader ? 0 : tsoHeaderLen);
+
+ DPRINTF(EthernetDesc, "TSO: descBytesUsed: %d copyBytes: %d "
+ "this descLen: %d\n",
+ tsoDescBytesUsed, tsoCopyBytes, TxdOp::getLen(desc));
+ DPRINTF(EthernetDesc, "TSO: pktHasHeader: %d\n", tsoPktHasHeader);
DPRINTF(EthernetDesc, "TSO: Next packet is %d bytes\n", pkt_size);
return pkt_size;
}
@@ -1720,8 +1724,6 @@ IGbE::TxDescCache::getPacketData(EthPacketPtr p)
}
if (useTso) {
- tsoDescBytesUsed += tsoCopyBytes;
- assert(tsoDescBytesUsed <= TxdOp::getLen(desc));
DPRINTF(EthernetDesc,
"Starting DMA of packet at offset %d length: %d\n",
p->length, tsoCopyBytes);
@@ -1729,6 +1731,8 @@ IGbE::TxDescCache::getPacketData(EthPacketPtr p)
+ tsoDescBytesUsed,
tsoCopyBytes, &pktEvent, p->data + p->length,
igbe->txReadDelay);
+ tsoDescBytesUsed += tsoCopyBytes;
+ assert(tsoDescBytesUsed <= TxdOp::getLen(desc));
} else {
igbe->dmaRead(pciToDma(TxdOp::getBuf(desc)),
TxdOp::getLen(desc), &pktEvent, p->data + p->length,
@@ -1755,19 +1759,19 @@ IGbE::TxDescCache::pktComplete()
DPRINTF(EthernetDesc, "TxDescriptor data d1: %#llx d2: %#llx\n",
desc->d1, desc->d2);
- DPRINTF(EthernetDesc, "TSO: use: %d hdrlen: %d mss: %d total: %d "
- "used: %d loaded hdr: %d\n", useTso, tsoHeaderLen, tsoMss,
- tsoTotalLen, tsoUsedLen, tsoLoadedHeader);
// Set the length of the data in the EtherPacket
if (useTso) {
+ DPRINTF(EthernetDesc, "TSO: use: %d hdrlen: %d mss: %d total: %d "
+ "used: %d loaded hdr: %d\n", useTso, tsoHeaderLen, tsoMss,
+ tsoTotalLen, tsoUsedLen, tsoLoadedHeader);
pktPtr->length += tsoCopyBytes;
tsoUsedLen += tsoCopyBytes;
+ DPRINTF(EthernetDesc, "TSO: descBytesUsed: %d copyBytes: %d\n",
+ tsoDescBytesUsed, tsoCopyBytes);
} else
pktPtr->length += TxdOp::getLen(desc);
- DPRINTF(EthernetDesc, "TSO: descBytesUsed: %d copyBytes: %d\n",
- tsoDescBytesUsed, tsoCopyBytes);
if ((!TxdOp::eop(desc) && !useTso) ||