X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fdev%2Fi8254xGBe.hh;h=f7f7d9a2adaa03acb9bc7e5eda60912bb0bbd53f;hb=da3c3bfa98e7cf81010a476b0b6ceba4c936f417;hp=8020b7091c0cf39c4d24a957ccbe2085c5517b66;hpb=e7fa4f2f8e256d537f330e6b84d8b3438e3d7395;p=gem5.git diff --git a/src/dev/i8254xGBe.hh b/src/dev/i8254xGBe.hh index 8020b7091..f7f7d9a2a 100644 --- a/src/dev/i8254xGBe.hh +++ b/src/dev/i8254xGBe.hh @@ -86,7 +86,7 @@ class IGbE : public EtherDevice bool rxDmaPacket; // Number of bytes copied from current RX packet - int pktOffset; + unsigned pktOffset; // Delays in managaging descriptors Tick fetchDelay, wbDelay; @@ -224,8 +224,9 @@ class IGbE : public EtherDevice virtual void actionAfterWb() {} virtual void fetchAfterWb() = 0; - std::deque usedCache; - std::deque unusedCache; + typedef std::deque CacheType; + CacheType usedCache; + CacheType unusedCache; T *fetchBuf; T *wbBuf; @@ -301,10 +302,11 @@ class IGbE : public EtherDevice /* Return the number of descriptors left in the ring, so the device has * a way to figure out if it needs to interrupt. */ - int descLeft() const + unsigned + descLeft() const { - int left = unusedCache.size(); - if (cachePnt >= descTail()) + unsigned left = unusedCache.size(); + if (cachePnt > descTail()) left += (descLen() - cachePnt + descTail()); else left += (descTail() - cachePnt); @@ -314,10 +316,10 @@ class IGbE : public EtherDevice /* Return the number of descriptors used and not written back. */ - int descUsed() const { return usedCache.size(); } + unsigned descUsed() const { return usedCache.size(); } /* Return the number of cache unused descriptors we have. */ - int descUnused() const {return unusedCache.size(); } + unsigned descUnused() const { return unusedCache.size(); } /* Get into a state where the descriptor address/head/etc colud be * changed */ @@ -354,7 +356,7 @@ class IGbE : public EtherDevice /** Bytes of packet that have been copied, so we know when to set EOP */ - int bytesCopied; + unsigned bytesCopied; public: RxDescCache(IGbE *i, std::string n, int s); @@ -442,15 +444,19 @@ class IGbE : public EtherDevice * return the size the of the packet to reserve space in tx fifo. * @return size of the packet */ - int getPacketSize(EthPacketPtr p); + unsigned getPacketSize(EthPacketPtr p); void getPacketData(EthPacketPtr p); void processContextDesc(); /** Return the number of dsecriptors in a cache block for threshold * operations. */ - int descInBlock(int num_desc) { return num_desc / - igbe->cacheBlockSize() / sizeof(iGbReg::TxDesc); } + unsigned + descInBlock(unsigned num_desc) + { + return num_desc / igbe->cacheBlockSize() / sizeof(iGbReg::TxDesc); + } + /** Ask if the packet has been transfered so the state machine can give * it to the fifo. * @return packet available in descriptor cache @@ -548,9 +554,4 @@ class IGbEInt : public EtherInt virtual void sendDone() { dev->ethTxDone(); } }; - - - - #endif //__DEV_I8254XGBE_HH__ -