Skip to content

Commit f0534c0

Browse files
Andy Gospodarekgregkh
authored andcommitted
bnxt_en: do not map packet buffers twice
[ Upstream commit 23c93c3 ] Remove double-mapping of DMA buffers as it can prevent page pool entries from being freed. Mapping is managed by page pool infrastructure and was previously managed by the driver in __bnxt_alloc_rx_page before allowing the page pool infrastructure to manage it. Fixes: 578fcfd ("bnxt_en: Let the page pool manage the DMA mapping") Reviewed-by: Somnath Kotur <[email protected]> Signed-off-by: Andy Gospodarek <[email protected]> Signed-off-by: Michael Chan <[email protected]> Reviewed-by: David Wei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent a07a95b commit f0534c0

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp,
5959
for (i = 0; i < num_frags ; i++) {
6060
skb_frag_t *frag = &sinfo->frags[i];
6161
struct bnxt_sw_tx_bd *frag_tx_buf;
62-
struct pci_dev *pdev = bp->pdev;
6362
dma_addr_t frag_mapping;
6463
int frag_len;
6564

@@ -73,16 +72,10 @@ struct bnxt_sw_tx_bd *bnxt_xmit_bd(struct bnxt *bp,
7372
txbd = &txr->tx_desc_ring[TX_RING(prod)][TX_IDX(prod)];
7473

7574
frag_len = skb_frag_size(frag);
76-
frag_mapping = skb_frag_dma_map(&pdev->dev, frag, 0,
77-
frag_len, DMA_TO_DEVICE);
78-
79-
if (unlikely(dma_mapping_error(&pdev->dev, frag_mapping)))
80-
return NULL;
81-
82-
dma_unmap_addr_set(frag_tx_buf, mapping, frag_mapping);
83-
8475
flags = frag_len << TX_BD_LEN_SHIFT;
8576
txbd->tx_bd_len_flags_type = cpu_to_le32(flags);
77+
frag_mapping = page_pool_get_dma_addr(skb_frag_page(frag)) +
78+
skb_frag_off(frag);
8679
txbd->tx_bd_haddr = cpu_to_le64(frag_mapping);
8780

8881
len = frag_len;

0 commit comments

Comments
 (0)