lkml.org 
[lkml]   [2011]   [Feb]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[55/68] p54pci: update receive dma buffers before and after processing
    2.6.32-longterm review patch.  If anyone has any objections, please let us know.

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

    From: Christian Lamparter <chunkeey@googlemail.com>

    commit 0bf719dfdecc5552155cbec78e49fa06e531e35c upstream.

    Documentation/DMA-API-HOWTO.txt states:

    "DMA transfers need to be synced properly in order for
    the cpu and device to see the most uptodate and correct
    copy of the DMA buffer."

    Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
    Signed-off-by: John W. Linville <linville@tuxdriver.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/net/wireless/p54/p54pci.c | 14 +++++++++-----
    1 file changed, 9 insertions(+), 5 deletions(-)

    --- a/drivers/net/wireless/p54/p54pci.c
    +++ b/drivers/net/wireless/p54/p54pci.c
    @@ -198,6 +198,7 @@ static void p54p_check_rx_ring(struct ie
    while (i != idx) {
    u16 len;
    struct sk_buff *skb;
    + dma_addr_t dma_addr;
    desc = &ring[i];
    len = le16_to_cpu(desc->len);
    skb = rx_buf[i];
    @@ -215,17 +216,20 @@ static void p54p_check_rx_ring(struct ie

    len = priv->common.rx_mtu;
    }
    + dma_addr = le32_to_cpu(desc->host_addr);
    + pci_dma_sync_single_for_cpu(priv->pdev, dma_addr,
    + priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
    skb_put(skb, len);

    if (p54_rx(dev, skb)) {
    - pci_unmap_single(priv->pdev,
    - le32_to_cpu(desc->host_addr),
    - priv->common.rx_mtu + 32,
    - PCI_DMA_FROMDEVICE);
    + pci_unmap_single(priv->pdev, dma_addr,
    + priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
    rx_buf[i] = NULL;
    - desc->host_addr = 0;
    + desc->host_addr = cpu_to_le32(0);
    } else {
    skb_trim(skb, 0);
    + pci_dma_sync_single_for_device(priv->pdev, dma_addr,
    + priv->common.rx_mtu + 32, PCI_DMA_FROMDEVICE);
    desc->len = cpu_to_le16(priv->common.rx_mtu + 32);
    }




    \
     
     \ /
      Last update: 2011-02-28 17:45    [W:0.022 / U:0.068 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site