Skip to content

Commit

Permalink
net: mediatek: fix threshold value
Browse files Browse the repository at this point in the history
The logic to calculate the threshold value for stopping the TX queue is
bad. Currently it will always use 1/2 of the rings size, which is way too
much. Set the threshold to MAX_SKB_FRAGS. This makes sure that the queue
is stopped when there is not enough room to accept an additional segment. 

Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
John Crispin authored and David S. Miller committed Jun 11, 2016
1 parent 2ff0bb6 commit 04698cc
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/net/ethernet/mediatek/mtk_eth_soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,7 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
ring->next_free = &ring->dma[0];
ring->last_free = &ring->dma[MTK_DMA_SIZE - 2];
ring->thresh = max((unsigned long)MTK_DMA_SIZE >> 2,
MAX_SKB_FRAGS);
ring->thresh = MAX_SKB_FRAGS;

/* make sure that all changes to the dma ring are flushed before we
* continue
Expand Down

0 comments on commit 04698cc

Please sign in to comment.