Commit 93c595f7 authored by Troy Kisky's avatar Troy Kisky Committed by David S. Miller

net: fec: fix fec_enet_get_free_txdesc_num

When first initialized, cur_tx points to the 1st
entry in the queue, and dirty_tx points to the last.
At this point, fec_enet_get_free_txdesc_num will
return tx_ring_size -2. If tx_ring_size -2 entries
are now queued, then fec_enet_get_free_txdesc_num
should return 0, but it returns tx_ring_size instead.
Signed-off-by: default avatarTroy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 095098e1
......@@ -296,7 +296,7 @@ static int fec_enet_get_free_txdesc_num(struct fec_enet_private *fep,
entries = ((const char *)txq->dirty_tx -
(const char *)txq->cur_tx) / fep->bufdesc_size - 1;
return entries > 0 ? entries : entries + txq->tx_ring_size;
return entries >= 0 ? entries : entries + txq->tx_ring_size;
}
static void swap_buffer(void *bufaddr, int len)
......
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