Skip to content

Commit 93c595f

Browse files
tkiskydavem330
authored andcommitted
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 095098e commit 93c595f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static int fec_enet_get_free_txdesc_num(struct fec_enet_private *fep,
296296
entries = ((const char *)txq->dirty_tx -
297297
(const char *)txq->cur_tx) / fep->bufdesc_size - 1;
298298

299-
return entries > 0 ? entries : entries + txq->tx_ring_size;
299+
return entries >= 0 ? entries : entries + txq->tx_ring_size;
300300
}
301301

302302
static void swap_buffer(void *bufaddr, int len)

0 commit comments

Comments
 (0)