Skip to content

Commit

Permalink
net: fec: fix fec_enet_get_free_txdesc_num
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Troy Kisky authored and David S. Miller committed Feb 11, 2016
1 parent 095098e commit 93c595f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/freescale/fec_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 93c595f

Please sign in to comment.