summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorTroy Kisky <troy.kisky@boundarydevices.com>2016-02-05 22:52:45 +0100
committerDavid S. Miller <davem@davemloft.net>2016-02-11 12:14:51 +0100
commit93c595f7b8c5fe98bd78bab5270a49c40a69f221 (patch)
tree52f52fa5faa7d1d99c6a2501e52d8c29c01ced18 /drivers/net
parentnet: fec: fix rx error counts (diff)
downloadlinux-93c595f7b8c5fe98bd78bab5270a49c40a69f221.tar.xz
linux-93c595f7b8c5fe98bd78bab5270a49c40a69f221.zip
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/net')
-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 162fa59e3eae..adbddfdb5474 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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)