Commit d2b13233 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

net: bgmac: Fix SOF bit checking

We are checking for the Start of Frame bit in the ctl1 word, while this
bit is set in the ctl0 word instead. Read the ctl0 word and update the
check to verify that.

Fixes: 9cde9450 ("bgmac: implement scatter/gather support")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0622cab0
...@@ -267,15 +267,16 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring) ...@@ -267,15 +267,16 @@ static void bgmac_dma_tx_free(struct bgmac *bgmac, struct bgmac_dma_ring *ring)
while (ring->start != ring->end) { while (ring->start != ring->end) {
int slot_idx = ring->start % BGMAC_TX_RING_SLOTS; int slot_idx = ring->start % BGMAC_TX_RING_SLOTS;
struct bgmac_slot_info *slot = &ring->slots[slot_idx]; struct bgmac_slot_info *slot = &ring->slots[slot_idx];
u32 ctl1; u32 ctl0, ctl1;
int len; int len;
if (slot_idx == empty_slot) if (slot_idx == empty_slot)
break; break;
ctl0 = le32_to_cpu(ring->cpu_base[slot_idx].ctl0);
ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1); ctl1 = le32_to_cpu(ring->cpu_base[slot_idx].ctl1);
len = ctl1 & BGMAC_DESC_CTL1_LEN; len = ctl1 & BGMAC_DESC_CTL1_LEN;
if (ctl1 & BGMAC_DESC_CTL0_SOF) if (ctl0 & BGMAC_DESC_CTL0_SOF)
/* Unmap no longer used buffer */ /* Unmap no longer used buffer */
dma_unmap_single(dma_dev, slot->dma_addr, len, dma_unmap_single(dma_dev, slot->dma_addr, len,
DMA_TO_DEVICE); DMA_TO_DEVICE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment