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: c61fb99cae
("bnxt_en: Add RX page mode support.")
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
23e12c8934
commit
3ed3a83e3f
|
@ -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 =
|
||||||
|
|
Loading…
Reference in New Issue