mediatek: update patches
[openwrt/openwrt.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 diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
19 index 52cdb3a..87b48c0 100644
20 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
21 +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
22 @@ -934,7 +934,6 @@ static int mtk_poll_tx(struct mtk_eth *eth, int budget, bool *tx_again)
23 }
24 mtk_tx_unmap(eth->dev, tx_buf);
25
26 - ring->last_free->txd2 = next_cpu;
27 ring->last_free = desc;
28 atomic_inc(&ring->free_count);
29
30 @@ -1042,7 +1041,7 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
31
32 atomic_set(&ring->free_count, MTK_DMA_SIZE - 2);
33 ring->next_free = &ring->dma[0];
34 - ring->last_free = &ring->dma[MTK_DMA_SIZE - 2];
35 + ring->last_free = &ring->dma[MTK_DMA_SIZE - 1];
36 ring->thresh = MAX_SKB_FRAGS;
37
38 /* make sure that all changes to the dma ring are flushed before we
39 --
40 1.7.10.4
41