Commit 11cd119d authored by Michael Chan's avatar Michael Chan Committed by David S. Miller

bnxt_en: Don't use DEFINE_DMA_UNMAP_ADDR to store DMA address in RX path.

To support XDP_TX, we need the RX buffer's DMA address to transmit the
packet.  Convert the DMA address field to a permanent field in
bnxt_sw_rx_bd.
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6bb19474
...@@ -608,7 +608,7 @@ static inline int bnxt_alloc_rx_data(struct bnxt *bp, ...@@ -608,7 +608,7 @@ static inline int bnxt_alloc_rx_data(struct bnxt *bp,
rx_buf->data = data; rx_buf->data = data;
rx_buf->data_ptr = data + BNXT_RX_OFFSET; rx_buf->data_ptr = data + BNXT_RX_OFFSET;
dma_unmap_addr_set(rx_buf, mapping, mapping); rx_buf->mapping = mapping;
rxbd->rx_bd_haddr = cpu_to_le64(mapping); rxbd->rx_bd_haddr = cpu_to_le64(mapping);
...@@ -628,8 +628,7 @@ static void bnxt_reuse_rx_data(struct bnxt_rx_ring_info *rxr, u16 cons, ...@@ -628,8 +628,7 @@ static void bnxt_reuse_rx_data(struct bnxt_rx_ring_info *rxr, u16 cons,
prod_rx_buf->data = data; prod_rx_buf->data = data;
prod_rx_buf->data_ptr = cons_rx_buf->data_ptr; prod_rx_buf->data_ptr = cons_rx_buf->data_ptr;
dma_unmap_addr_set(prod_rx_buf, mapping, prod_rx_buf->mapping = cons_rx_buf->mapping;
dma_unmap_addr(cons_rx_buf, mapping));
prod_bd = &rxr->rx_desc_ring[RX_RING(prod)][RX_IDX(prod)]; prod_bd = &rxr->rx_desc_ring[RX_RING(prod)][RX_IDX(prod)];
cons_bd = &rxr->rx_desc_ring[RX_RING(cons)][RX_IDX(cons)]; cons_bd = &rxr->rx_desc_ring[RX_RING(cons)][RX_IDX(cons)];
...@@ -816,7 +815,7 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi, ...@@ -816,7 +815,7 @@ static struct sk_buff *bnxt_rx_pages(struct bnxt *bp, struct bnxt_napi *bnapi,
* a sw_prod index that equals the cons index, so we * a sw_prod index that equals the cons index, so we
* need to clear the cons entry now. * need to clear the cons entry now.
*/ */
mapping = dma_unmap_addr(cons_rx_buf, mapping); mapping = cons_rx_buf->mapping;
page = cons_rx_buf->page; page = cons_rx_buf->page;
cons_rx_buf->page = NULL; cons_rx_buf->page = NULL;
...@@ -959,7 +958,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, ...@@ -959,7 +958,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
prod_rx_buf->data_ptr = tpa_info->data_ptr; prod_rx_buf->data_ptr = tpa_info->data_ptr;
mapping = tpa_info->mapping; mapping = tpa_info->mapping;
dma_unmap_addr_set(prod_rx_buf, mapping, mapping); prod_rx_buf->mapping = mapping;
prod_bd = &rxr->rx_desc_ring[RX_RING(prod)][RX_IDX(prod)]; prod_bd = &rxr->rx_desc_ring[RX_RING(prod)][RX_IDX(prod)];
...@@ -968,7 +967,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, ...@@ -968,7 +967,7 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr,
tpa_info->data = cons_rx_buf->data; tpa_info->data = cons_rx_buf->data;
tpa_info->data_ptr = cons_rx_buf->data_ptr; tpa_info->data_ptr = cons_rx_buf->data_ptr;
cons_rx_buf->data = NULL; cons_rx_buf->data = NULL;
tpa_info->mapping = dma_unmap_addr(cons_rx_buf, mapping); tpa_info->mapping = cons_rx_buf->mapping;
tpa_info->len = tpa_info->len =
le32_to_cpu(tpa_start->rx_tpa_start_cmp_len_flags_type) >> le32_to_cpu(tpa_start->rx_tpa_start_cmp_len_flags_type) >>
...@@ -1405,7 +1404,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons, ...@@ -1405,7 +1404,7 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons,
} }
len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT; len = le32_to_cpu(rxcmp->rx_cmp_len_flags_type) >> RX_CMP_LEN_SHIFT;
dma_addr = dma_unmap_addr(rx_buf, mapping); dma_addr = rx_buf->mapping;
if (len <= bp->rx_copy_thresh) { if (len <= bp->rx_copy_thresh) {
skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr); skb = bnxt_copy_skb(bnapi, data_ptr, len, dma_addr);
...@@ -1881,7 +1880,7 @@ static void bnxt_free_rx_skbs(struct bnxt *bp) ...@@ -1881,7 +1880,7 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
dma_unmap_single( dma_unmap_single(
&pdev->dev, &pdev->dev,
dma_unmap_addr(tpa_info, mapping), tpa_info->mapping,
bp->rx_buf_use_size, bp->rx_buf_use_size,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
...@@ -1898,8 +1897,7 @@ static void bnxt_free_rx_skbs(struct bnxt *bp) ...@@ -1898,8 +1897,7 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
if (!data) if (!data)
continue; continue;
dma_unmap_single(&pdev->dev, dma_unmap_single(&pdev->dev, rx_buf->mapping,
dma_unmap_addr(rx_buf, mapping),
bp->rx_buf_use_size, bp->rx_buf_use_size,
PCI_DMA_FROMDEVICE); PCI_DMA_FROMDEVICE);
...@@ -1916,8 +1914,7 @@ static void bnxt_free_rx_skbs(struct bnxt *bp) ...@@ -1916,8 +1914,7 @@ static void bnxt_free_rx_skbs(struct bnxt *bp)
if (!page) if (!page)
continue; continue;
dma_unmap_page(&pdev->dev, dma_unmap_page(&pdev->dev, rx_agg_buf->mapping,
dma_unmap_addr(rx_agg_buf, mapping),
BNXT_RX_PAGE_SIZE, PCI_DMA_FROMDEVICE); BNXT_RX_PAGE_SIZE, PCI_DMA_FROMDEVICE);
rx_agg_buf->page = NULL; rx_agg_buf->page = NULL;
......
...@@ -518,7 +518,7 @@ struct bnxt_sw_tx_bd { ...@@ -518,7 +518,7 @@ struct bnxt_sw_tx_bd {
struct bnxt_sw_rx_bd { struct bnxt_sw_rx_bd {
void *data; void *data;
u8 *data_ptr; u8 *data_ptr;
DEFINE_DMA_UNMAP_ADDR(mapping); dma_addr_t mapping;
}; };
struct bnxt_sw_rx_agg_bd { struct bnxt_sw_rx_agg_bd {
......
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