Commit 87d57c0c authored by Jialin Li's avatar Jialin Li
Browse files

checkpoint

parent 348ef09c
......@@ -79,6 +79,7 @@ DescRing::setSizeLog(size_t size_log)
this->_sizeLog = size_log & 0xFF;
this->_size = 1 << this->_sizeLog;
this->_sizeMask = this->_size - 1;
}
void
......@@ -100,6 +101,22 @@ DescRing::setTailPtr(unsigned ptr)
this->_tailPtr = ptr;
}
TxRing::TxRing()
{
}
TxRing::~TxRing()
{
}
void
TxRing::setHeadPtr(unsigned ptr)
{
DescRing::setHeadPtr(ptr);
unsigned index = (this->_headPtr - 1) & this->_sizeMask;
struct Desc *desc = (struct Desc *)(this->_dmaAddr + index * DESC_SIZE);
}
Port::Port()
: _id(0), _features(0), _mtu(0),
_schedCount(0), _schedOffset(0), _schedStride(0),
......
......@@ -92,6 +92,15 @@ typedef uint64_t addr_t;
namespace corundum {
#define DESC_SIZE 16
struct Desc {
uint16_t rsvd0;
uint16_t tx_csum_cmd;
uint32_t len;
uint64_t addr;
} __attribute__((packed)) ;
class DescRing {
public:
DescRing();
......@@ -107,19 +116,28 @@ public:
void setDMAUpper(uint32_t addr);
void setSizeLog(size_t size_log);
void setIndex(unsigned index);
void setHeadPtr(unsigned ptr);
virtual void setHeadPtr(unsigned ptr);
void setTailPtr(unsigned ptr);
private:
protected:
addr_t _dmaAddr;
size_t _sizeLog;
size_t _size;
size_t _sizeMask;
unsigned _index;
unsigned _headPtr;
unsigned _tailPtr;
bool active;
};
class TxRing : public DescRing {
public:
TxRing();
~TxRing();
virtual void setHeadPtr(unsigned ptr) override;
};
class Port {
public:
Port();
......@@ -170,7 +188,7 @@ public:
private:
DescRing eqRing;
DescRing txRing;
TxRing txRing;
DescRing txCplRing;
DescRing rxRing;
DescRing rxCplRing;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment