* [PATCH] net: qcom/emac: Use proper free methods during TX
@ 2018-03-06 2:48 Hemanth Puranik
2018-03-06 3:06 ` Timur Tabi
2018-03-07 17:23 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Hemanth Puranik @ 2018-03-06 2:48 UTC (permalink / raw)
To: netdev, linux-kernel; +Cc: Timur Tabi, Hemanth Puranik
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: Hemanth Puranik <hpuranik@codeaurora.org>
---
drivers/net/ethernet/qualcomm/emac/emac-mac.c | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
index 9cbb2726..d5a32b7 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
@@ -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) {
tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.consume_idx);
if (tpbuf->dma_addr) {
- dma_unmap_single(adpt->netdev->dev.parent,
- tpbuf->dma_addr, tpbuf->length,
- DMA_TO_DEVICE);
+ dma_unmap_page(adpt->netdev->dev.parent,
+ tpbuf->dma_addr, tpbuf->length,
+ DMA_TO_DEVICE);
tpbuf->dma_addr = 0;
}
@@ -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->length = mapped_len;
- tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent,
- skb->data, tpbuf->length,
- DMA_TO_DEVICE);
+ tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent,
+ virt_to_page(skb->data),
+ offset_in_page(skb->data),
+ tpbuf->length,
+ DMA_TO_DEVICE);
ret = dma_mapping_error(adpt->netdev->dev.parent,
tpbuf->dma_addr);
if (ret)
@@ -1371,9 +1373,12 @@ static void emac_tx_fill_tpd(struct emac_adapter *adpt,
if (mapped_len < len) {
tpbuf = GET_TPD_BUFFER(tx_q, tx_q->tpd.produce_idx);
tpbuf->length = len - mapped_len;
- tpbuf->dma_addr = dma_map_single(adpt->netdev->dev.parent,
- skb->data + mapped_len,
- tpbuf->length, DMA_TO_DEVICE);
+ tpbuf->dma_addr = dma_map_page(adpt->netdev->dev.parent,
+ virt_to_page(skb->data +
+ mapped_len),
+ offset_in_page(skb->data +
+ mapped_len),
+ tpbuf->length, DMA_TO_DEVICE);
ret = dma_mapping_error(adpt->netdev->dev.parent,
tpbuf->dma_addr);
if (ret)
--
Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: qcom/emac: Use proper free methods during TX
2018-03-06 2:48 [PATCH] net: qcom/emac: Use proper free methods during TX Hemanth Puranik
@ 2018-03-06 3:06 ` Timur Tabi
2018-03-07 17:23 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Timur Tabi @ 2018-03-06 3:06 UTC (permalink / raw)
To: Hemanth Puranik, netdev, linux-kernel
On 3/5/18 8:48 PM, Hemanth Puranik wrote:
> 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: Hemanth Puranik<hpuranik@codeaurora.org>
Acked-by: Timur Tabi <timur@codeaurora.org>
--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: qcom/emac: Use proper free methods during TX
2018-03-06 2:48 [PATCH] net: qcom/emac: Use proper free methods during TX Hemanth Puranik
2018-03-06 3:06 ` Timur Tabi
@ 2018-03-07 17:23 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-03-07 17:23 UTC (permalink / raw)
To: hpuranik; +Cc: netdev, linux-kernel, timur
From: Hemanth Puranik <hpuranik@codeaurora.org>
Date: Tue, 6 Mar 2018 08:18:06 +0530
> 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: Hemanth Puranik <hpuranik@codeaurora.org>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-03-07 17:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-06 2:48 [PATCH] net: qcom/emac: Use proper free methods during TX Hemanth Puranik
2018-03-06 3:06 ` Timur Tabi
2018-03-07 17:23 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).