summaryrefslogtreecommitdiff
path: root/src/dev/i8254xGBe.hh
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2008-02-10 19:32:12 -0500
committerAli Saidi <saidi@eecs.umich.edu>2008-02-10 19:32:12 -0500
commitd167e2bb971327f030f1a7a71a45b7588a1dd3dc (patch)
treeb2a45f5914d81bc073428cffc14639b772f5fb52 /src/dev/i8254xGBe.hh
parent9d7a69c582e87a2d461298fb32345686efe4113f (diff)
downloadgem5-d167e2bb971327f030f1a7a71a45b7588a1dd3dc.tar.xz
IGbE: Fix a couple of bugs.
--HG-- extra : convert_revision : a1f16bd82b6fbd5b6b5dc0f08b9e69858bea86ca
Diffstat (limited to 'src/dev/i8254xGBe.hh')
-rw-r--r--src/dev/i8254xGBe.hh30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/dev/i8254xGBe.hh b/src/dev/i8254xGBe.hh
index 30aa6430e..9403c87b6 100644
--- a/src/dev/i8254xGBe.hh
+++ b/src/dev/i8254xGBe.hh
@@ -282,8 +282,12 @@ class IGbE : public EtherDevice
wbOut = max_to_wb;
- for (int x = 0; x < wbOut; x++)
- memcpy(&wbBuf[x], usedCache[x], sizeof(T));
+ for (int x = 0; x < wbOut; x++) {
+ assert(usedCache.size());
+ memcpy(&wbBuf[x], usedCache[0], sizeof(T));
+ delete usedCache[0];
+ usedCache.pop_front();
+ }
assert(wbOut);
@@ -298,13 +302,17 @@ class IGbE : public EtherDevice
{
size_t max_to_fetch;
+ if (curFetching)
+ return;
+
if (descTail() >= cachePnt)
max_to_fetch = descTail() - cachePnt;
else
max_to_fetch = descLen() - cachePnt;
- max_to_fetch = std::min(max_to_fetch, (size - usedCache.size() -
- unusedCache.size()));
+ size_t free_cache = size - usedCache.size() - unusedCache.size();
+
+ max_to_fetch = std::min(max_to_fetch, free_cache);
DPRINTF(EthernetDesc, "Fetching descriptors head: %d tail: "
"%d len: %d cachePnt: %d max_to_fetch: %d descleft: %d\n",
@@ -312,7 +320,7 @@ class IGbE : public EtherDevice
max_to_fetch, descLeft());
// Nothing to do
- if (max_to_fetch == 0 || curFetching)
+ if (max_to_fetch == 0)
return;
// So we don't have two descriptor fetches going on at once
@@ -322,7 +330,6 @@ class IGbE : public EtherDevice
descBase() + cachePnt * sizeof(T),
igbe->platform->pciToDma(descBase() + cachePnt * sizeof(T)),
curFetching * sizeof(T));
-
assert(curFetching);
igbe->dmaRead(igbe->platform->pciToDma(descBase() + cachePnt * sizeof(T)),
curFetching * sizeof(T), &fetchEvent, (uint8_t*)fetchBuf);
@@ -369,11 +376,6 @@ class IGbE : public EtherDevice
#ifndef NDEBUG
long oldHead = curHead;
#endif
- for (int x = 0; x < wbOut; x++) {
- assert(usedCache.size());
- delete usedCache[0];
- usedCache.pop_front();
- };
curHead += wbOut;
wbOut = 0;
@@ -523,7 +525,7 @@ class IGbE : public EtherDevice
* @param packet ethernet packet to write
* @return if the packet could be written (there was a free descriptor)
*/
- bool writePacket(EthPacketPtr packet);
+ void writePacket(EthPacketPtr packet);
/** Called by event when dma to write packet is completed
*/
void pktComplete();
@@ -553,9 +555,7 @@ class IGbE : public EtherDevice
virtual long descLen() const { return igbe->regs.tdlen() >> 4; }
virtual void updateHead(long h) { igbe->regs.tdh(h); }
virtual void enableSm();
- virtual void intAfterWb() const {
- igbe->postInterrupt(iGbReg::IT_TXDW);
- }
+ virtual void intAfterWb() const { igbe->postInterrupt(iGbReg::IT_TXDW); }
virtual void fetchAfterWb() {
if (!igbe->txTick && igbe->getState() == SimObject::Running)
fetchDescriptors();