b6f32fc451af536df4d20927658307eeef4dd2ca
[librecmc/librecmc.git] / target / linux / mediatek / patches-4.4 / 0090-net-next-mediatek-fix-off-by-one-in-the-TX-ring-allo.patch
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
7 The TX ring setup has an off by one error causing it to not utilise all
8 descriptors. This has the side effect that we need to reset the next
9 pointer at runtime to make it work. Fix the off by one and remove the
10 code fixing the ring at runtime.
11
12 Signed-off-by: Sean Wang <keyhaede@gmail.com>
13 Signed-off-by: John Crispin <john@phrozen.org>
14 ---
15  drivers/net/ethernet/mediatek/mtk_eth_soc.c |    3 +--
16  1 file changed, 1 insertion(+), 2 deletions(-)
17
18 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
20 @@ -934,7 +934,6 @@ static int mtk_poll_tx(struct mtk_eth *e
21                 }
22                 mtk_tx_unmap(eth->dev, tx_buf);
23  
24 -               ring->last_free->txd2 = next_cpu;
25                 ring->last_free = desc;
26                 atomic_inc(&ring->free_count);
27  
28 @@ -1042,7 +1041,7 @@ static int mtk_tx_alloc(struct mtk_eth *
29  
30         atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
31         ring->next_free = &ring->dma[0];
32 -       ring->last_free = &ring->dma[MTK_DMA_SIZE - 2];
33 +       ring->last_free = &ring->dma[MTK_DMA_SIZE - 1];
34         ring->thresh = MAX_SKB_FRAGS;
35  
36         /* make sure that all changes to the dma ring are flushed before we