Commit 3ed3a83e authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Fix DMA unmapping of the RX buffers in XDP mode during shutdown.

In bnxt_free_rx_skbs(), which is called to free up all RX buffers during
shutdown, we need to unmap the page if we are running in XDP mode.

Fixes: c61fb99c ("bnxt_en: Add RX page mode support.")
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 23e12c89
...@@ -1983,21 +1983,26 @@ static void bnxt_free_rx_skbs(struct bnxt *bp) ...@@ -1983,21 +1983,26 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
for (j = 0; j < max_idx; j++) { for (j = 0; j < max_idx; j++) {
struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[j]; struct bnxt_sw_rx_bd *rx_buf = &rxr->rx_buf_ring[j];
dma_addr_t mapping = rx_buf->mapping;
void *data = rx_buf->data; void *data = rx_buf->data;
if (!data) if (!data)
continue; continue;
dma_unmap_single(&pdev->dev, rx_buf->mapping,
bp->rx_buf_use_size, bp->rx_dir);
rx_buf->data = NULL; rx_buf->data = NULL;
if (BNXT_RX_PAGE_MODE(bp)) if (BNXT_RX_PAGE_MODE(bp)) {
mapping -= bp->rx_dma_offset;
dma_unmap_page(&pdev->dev, mapping,
PAGE_SIZE, bp->rx_dir);
__free_page(data); __free_page(data);
else } else {
dma_unmap_single(&pdev->dev, mapping,
bp->rx_buf_use_size,
bp->rx_dir);
kfree(data); kfree(data);
} }
}
for (j = 0; j < max_agg_idx; j++) { for (j = 0; j < max_agg_idx; j++) {
struct bnxt_sw_rx_agg_bd *rx_agg_buf = struct bnxt_sw_rx_agg_bd *rx_agg_buf =
......
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