Skip to content

Commit eee5772

Browse files
edumazetdavem330
authored andcommitted
net: bcmgenet: fix dma api length mismatch
When un-mapping skb->data in __bcmgenet_tx_reclaim(), we must use the length that was used in original dma_map_single(), instead of skb->len that might be bigger (includes the frags) We simply can store skb_len into tx_cb_ptr->dma_len and use it at unmap time. Fixes: 1c1008c ("net: bcmgenet: add main driver file") Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 76e39cc commit eee5772

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ static unsigned int __bcmgenet_tx_reclaim(struct net_device *dev,
11971197
dev->stats.tx_bytes += tx_cb_ptr->skb->len;
11981198
dma_unmap_single(&dev->dev,
11991199
dma_unmap_addr(tx_cb_ptr, dma_addr),
1200-
tx_cb_ptr->skb->len,
1200+
dma_unmap_len(tx_cb_ptr, dma_len),
12011201
DMA_TO_DEVICE);
12021202
bcmgenet_free_cb(tx_cb_ptr);
12031203
} else if (dma_unmap_addr(tx_cb_ptr, dma_addr)) {
@@ -1308,7 +1308,7 @@ static int bcmgenet_xmit_single(struct net_device *dev,
13081308
}
13091309

13101310
dma_unmap_addr_set(tx_cb_ptr, dma_addr, mapping);
1311-
dma_unmap_len_set(tx_cb_ptr, dma_len, skb->len);
1311+
dma_unmap_len_set(tx_cb_ptr, dma_len, skb_len);
13121312
length_status = (skb_len << DMA_BUFLENGTH_SHIFT) | dma_desc_flags |
13131313
(priv->hw_params->qtag_mask << DMA_TX_QTAG_SHIFT) |
13141314
DMA_TX_APPEND_CRC;

0 commit comments

Comments
 (0)