summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2016-02-05 14:52:45 -0700
committerFugang Duan <b38611@freescale.com>2016-02-19 18:02:04 +0800
commit2f82c287304b6e9e765c7084498aa20d05c5cf0e (patch)
tree4d0b57b7ba808a6921de16bcaacfaed74130602a /drivers
parentd55878688a2bb9950fd2a9186aff01c3b7fb3291 (diff)
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: Troy Kisky <troy.kisky@boundarydevices.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 04df423c0c94..2b1604113257 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -305,7 +305,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)