lkml.org 
[lkml]   [2018]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.14 228/496] net: qcom/emac: Use proper free methods during TX
    Date
    4.14-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Hemanth Puranik <hpuranik@codeaurora.org>

    [ Upstream commit cc5db3150e87fe7f7e947bf333b6c1c97f848ecb ]

    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>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/net/ethernet/qualcomm/emac/emac-mac.c | 23 ++++++++++++++---------
    1 file changed, 14 insertions(+), 9 deletions(-)

    --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c
    +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c
    @@ -1204,9 +1204,9 @@ void emac_mac_tx_process(struct emac_ada
    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;
    }

    @@ -1363,9 +1363,11 @@ static void emac_tx_fill_tpd(struct emac

    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)
    @@ -1381,9 +1383,12 @@ static void emac_tx_fill_tpd(struct emac
    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)

    \
     
     \ /
      Last update: 2018-05-28 12:52    [W:4.093 / U:1.208 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site