Commit cc5db315 authored by Hemanth Puranik's avatar Hemanth Puranik Committed by David S. Miller

net: qcom/emac: Use proper free methods during TX

This patch fixes the warning messages/call traces seen if DMA debug is
enabled, In case of fragmented skb's memory was allocated using
dma_map_page but freed using dma_unmap_single. This patch modifies buffer
allocations in TX path to use dma_map_page in all the places and
dma_unmap_page while freeing the buffers.
Signed-off-by: default avatarHemanth Puranik <hpuranik@codeaurora.org>
Acked-by: default avatarTimur Tabi <timur@codeaurora.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9de506a5
...@@ -1194,9 +1194,9 @@ void emac_mac_tx_process(struct emac_adapter *adpt, struct emac_tx_queue *tx_q) ...@@ -1194,9 +1194,9 @@ void emac_mac_tx_process(struct emac_adapter *adpt, struct emac_tx_queue *tx_q)
while (tx_q->tpd.consume_idx != hw_consume_idx) { while (tx_q->tpd.consume_idx != hw_consume_idx) {
tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.consume_idx); tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.consume_idx);
if (tpbuf->dma_addr) { if (tpbuf->dma_addr) {
dma_unmap_single(adpt->netdev->dev.parent, dma_unmap_page(adpt->netdev->dev.parent,
tpbuf->dma_addr, tpbuf->length, tpbuf->dma_addr, tpbuf->length,
DMA_TO_DEVICE); DMA_TO_DEVICE);
tpbuf->dma_addr = 0; tpbuf->dma_addr = 0;
} }
...@@ -1353,9 +1353,11 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt, ...@@ -1353,9 +1353,11 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt,
tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx);
tpbuf->length = mapped_len; tpbuf->length = mapped_len;
tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent, tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent,
skb->data, tpbuf->length, virt_to_page(skb->data),
DMA_TO_DEVICE); offset_in_page(skb->data),
tpbuf->length,
DMA_TO_DEVICE);
ret = dma_mapping_error(adpt->netdev->dev.parent, ret = dma_mapping_error(adpt->netdev->dev.parent,
tpbuf->dma_addr); tpbuf->dma_addr);
if (ret) if (ret)
...@@ -1371,9 +1373,12 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt, ...@@ -1371,9 +1373,12 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt,
if (mapped_len < len) { if (mapped_len < len) {
tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx); tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx);
tpbuf->length = len - mapped_len; tpbuf->length = len - mapped_len;
tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent, tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent,
skb->data + mapped_len, virt_to_page(skb->data +
tpbuf->length, DMA_TO_DEVICE); mapped_len),
offset_in_page(skb->data +
mapped_len),
tpbuf->length, DMA_TO_DEVICE);
ret = dma_mapping_error(adpt->netdev->dev.parent, ret = dma_mapping_error(adpt->netdev->dev.parent,
tpbuf->dma_addr); tpbuf->dma_addr);
if (ret) if (ret)
......
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