0090-net-next-mediatek-fix-off-by-one-in-the-TX-ring-allo.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. From 94425de9ede5ef0eafbfced65140c30e7c0b6c0d Mon Sep 17 00:00:00 2001
  2. From: John Crispin <john@phrozen.org>
  3. Date: Tue, 3 May 2016 03:01:13 +0200
  4. Subject: [PATCH 090/102] net-next: mediatek: fix off by one in the TX ring
  5. allocation
  6. The TX ring setup has an off by one error causing it to not utilise all
  7. descriptors. This has the side effect that we need to reset the next
  8. pointer at runtime to make it work. Fix the off by one and remove the
  9. code fixing the ring at runtime.
  10. Signed-off-by: Sean Wang <keyhaede@gmail.com>
  11. Signed-off-by: John Crispin <john@phrozen.org>
  12. ---
  13. drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 +--
  14. 1 file changed, 1 insertion(+), 2 deletions(-)
  15. --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  16. +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
  17. @@ -934,7 +934,6 @@ static int mtk_poll_tx(struct mtk_eth *e
  18. }
  19. mtk_tx_unmap(eth->dev, tx_buf);
  20. - ring->last_free->txd2 = next_cpu;
  21. ring->last_free = desc;
  22. atomic_inc(&ring->free_count);
  23. @@ -1042,7 +1041,7 @@ static int mtk_tx_alloc(struct mtk_eth *
  24. atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
  25. ring->next_free = &ring->dma[0];
  26. - ring->last_free = &ring->dma[MTK_DMA_SIZE - 2];
  27. + ring->last_free = &ring->dma[MTK_DMA_SIZE - 1];
  28. ring->thresh = MAX_SKB_FRAGS;
  29. /* make sure that all changes to the dma ring are flushed before we