Commit f9eeb643 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

i40e: count pending fetches against descriptor limit

parent cc4b0d1c
...@@ -74,6 +74,7 @@ class queue_base { ...@@ -74,6 +74,7 @@ class queue_base {
bool enabled; bool enabled;
size_t desc_len; size_t desc_len;
uint32_t pending_fetches;
void trigger_fetch(); void trigger_fetch();
void data_fetch(const void *desc, uint32_t idx, uint64_t addr, size_t len); void data_fetch(const void *desc, uint32_t idx, uint64_t addr, size_t len);
......
...@@ -13,7 +13,7 @@ extern nicbm::Runner *runner; ...@@ -13,7 +13,7 @@ extern nicbm::Runner *runner;
queue_base::queue_base(uint32_t &reg_head_, uint32_t &reg_tail_) queue_base::queue_base(uint32_t &reg_head_, uint32_t &reg_tail_)
: base(0), len(0), fetch_head(0), reg_head(reg_head_), reg_tail(reg_tail_), : base(0), len(0), fetch_head(0), reg_head(reg_head_), reg_tail(reg_tail_),
enabled(false), desc_len(0) enabled(false), desc_len(0), pending_fetches(0)
{ {
} }
...@@ -22,7 +22,7 @@ void queue_base::trigger_fetch() ...@@ -22,7 +22,7 @@ void queue_base::trigger_fetch()
if (!enabled || fetch_head == reg_tail) if (!enabled || fetch_head == reg_tail)
return; return;
if (max_fetch_capacity() == 0) if (max_fetch_capacity() < pending_fetches + 1)
return; return;
dma_fetch *dma = new dma_fetch(*this, desc_len); dma_fetch *dma = new dma_fetch(*this, desc_len);
...@@ -30,6 +30,8 @@ void queue_base::trigger_fetch() ...@@ -30,6 +30,8 @@ void queue_base::trigger_fetch()
dma->dma_addr = base + fetch_head * desc_len; dma->dma_addr = base + fetch_head * desc_len;
dma->index = fetch_head; dma->index = fetch_head;
pending_fetches++;
std::cerr << "fetching " << (reg_tail - fetch_head) % len << std::cerr << "fetching " << (reg_tail - fetch_head) % len <<
" descriptors from " << dma->dma_addr << std::endl; " descriptors from " << dma->dma_addr << std::endl;
...@@ -136,6 +138,7 @@ queue_base::dma_fetch::~dma_fetch() ...@@ -136,6 +138,7 @@ queue_base::dma_fetch::~dma_fetch()
void queue_base::dma_fetch::done() void queue_base::dma_fetch::done()
{ {
queue.pending_fetches--;
queue.desc_fetched(data, index); queue.desc_fetched(data, index);
delete this; delete this;
} }
......
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