1
0
mirror of https://github.com/corundum/corundum.git synced 2025-01-30 08:32:52 +08:00

modules/mqnic: Use DMA_TO/FROM_DEVICE macros instead of the PCI versions

Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
Alex Forencich 2022-08-06 01:27:19 -07:00
parent d0ce01de7f
commit 693809ab97
2 changed files with 8 additions and 8 deletions

View File

@ -223,7 +223,7 @@ void mqnic_free_rx_desc(struct mqnic_ring *ring, int index)
struct page *page = rx_info->page;
dma_unmap_page(ring->dev, dma_unmap_addr(rx_info, dma_addr),
dma_unmap_len(rx_info, len), PCI_DMA_FROMDEVICE);
dma_unmap_len(rx_info, len), DMA_FROM_DEVICE);
rx_info->dma_addr = 0;
__free_pages(page, rx_info->page_order);
rx_info->page = NULL;
@ -271,7 +271,7 @@ int mqnic_prepare_rx_desc(struct mqnic_ring *ring, int index)
}
// map page
dma_addr = dma_map_page(ring->dev, page, 0, len, PCI_DMA_FROMDEVICE);
dma_addr = dma_map_page(ring->dev, page, 0, len, DMA_FROM_DEVICE);
if (unlikely(dma_mapping_error(ring->dev, dma_addr))) {
dev_err(ring->dev, "%s: DMA mapping failed on interface %d",
@ -377,13 +377,13 @@ int mqnic_process_rx_cq(struct mqnic_cq_ring *cq_ring, int napi_budget)
// unmap
dma_unmap_page(dev, dma_unmap_addr(rx_info, dma_addr),
dma_unmap_len(rx_info, len), PCI_DMA_FROMDEVICE);
dma_unmap_len(rx_info, len), DMA_FROM_DEVICE);
rx_info->dma_addr = 0;
len = min_t(u32, le16_to_cpu(cpl->len), rx_info->len);
dma_sync_single_range_for_cpu(dev, rx_info->dma_addr, rx_info->page_offset,
rx_info->len, PCI_DMA_FROMDEVICE);
rx_info->len, DMA_FROM_DEVICE);
__skb_fill_page_desc(skb, 0, page, rx_info->page_offset, len);
rx_info->page = NULL;

View File

@ -226,13 +226,13 @@ void mqnic_free_tx_desc(struct mqnic_ring *ring, int index, int napi_budget)
prefetchw(&skb->users);
dma_unmap_single(ring->dev, dma_unmap_addr(tx_info, dma_addr),
dma_unmap_len(tx_info, len), PCI_DMA_TODEVICE);
dma_unmap_len(tx_info, len), DMA_TO_DEVICE);
dma_unmap_addr_set(tx_info, dma_addr, 0);
// unmap frags
for (i = 0; i < tx_info->frag_count; i++)
dma_unmap_page(ring->dev, tx_info->frags[i].dma_addr,
tx_info->frags[i].len, PCI_DMA_TODEVICE);
tx_info->frags[i].len, DMA_TO_DEVICE);
napi_consume_skb(skb, napi_budget);
tx_info->skb = NULL;
@ -404,7 +404,7 @@ static bool mqnic_map_skb(struct mqnic_ring *ring, struct mqnic_tx_info *tx_info
// map skb
len = skb_headlen(skb);
dma_addr = dma_map_single(ring->dev, skb->data, len, PCI_DMA_TODEVICE);
dma_addr = dma_map_single(ring->dev, skb->data, len, DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(ring->dev, dma_addr)))
// mapping failed
@ -426,7 +426,7 @@ map_error:
// unmap frags
for (i = 0; i < tx_info->frag_count; i++)
dma_unmap_page(ring->dev, tx_info->frags[i].dma_addr,
tx_info->frags[i].len, PCI_DMA_TODEVICE);
tx_info->frags[i].len, DMA_TO_DEVICE);
// update tx_info
tx_info->skb = NULL;