Fresh pull from upstream 17.01 branch
[librecmc/librecmc.git] / target / linux / generic / patches-4.4 / 071-v4.7-0001-net-bgmac-Fix-SOF-bit-checking.patch
1 From d2b13233879ca1268a1c027d4573109e5a777811 Mon Sep 17 00:00:00 2001
2 From: Florian Fainelli <f.fainelli@gmail.com>
3 Date: Thu, 23 Jun 2016 14:23:12 -0700
4 Subject: [PATCH 1/3] net: bgmac: Fix SOF bit checking
5
6 We are checking for the Start of Frame bit in the ctl1 word, while this
7 bit is set in the ctl0 word instead. Read the ctl0 word and update the
8 check to verify that.
9
10 Fixes: 9cde94506eac ("bgmac: implement scatter/gather support")
11 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14  drivers/net/ethernet/broadcom/bgmac.c | 5 +++--
15  1 file changed, 3 insertions(+), 2 deletions(-)
16
17 --- a/drivers/net/ethernet/broadcom/bgmac.c
18 +++ b/drivers/net/ethernet/broadcom/bgmac.c
19 @@ -269,15 +269,16 @@ static void bgmac_dma_tx_free(struct bgm
20         while (ring->start != ring->end) {
21                 int slot_idx = ring->start % BGMAC_TX_RING_SLOTS;
22                 struct bgmac_slot_info *slot = &ring->slots[slot_idx];
23 -               u32 ctl1;
24 +               u32 ctl0, ctl1;
25                 int len;
26  
27                 if (slot_idx == empty_slot)
28                         break;
29  
30 +               ctl0 = le32_to_cpu(ring->cpu_base[slot_idx].ctl0);
31                 ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1);
32                 len = ctl1 & BGMAC_DESC_CTL1_LEN;
33 -               if (ctl1 & BGMAC_DESC_CTL0_SOF)
34 +               if (ctl0 & BGMAC_DESC_CTL0_SOF)
35                         /* Unmap no longer used buffer */
36                         dma_unmap_single(dma_dev, slot->dma_addr, len,
37                                          DMA_TO_DEVICE);