From: Larry Finger <Larry.Finger@lwfinger.net>
To: Christian Lamparter <chunkeey@googlemail.com>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com
Subject: Re: [PATCH for-2.6.38] p54pci: update receive dma buffers before and after processing
Date: Thu, 10 Feb 2011 19:37:00 -0600 [thread overview]
Message-ID: <4D5492BC.4030104@lwfinger.net> (raw)
In-Reply-To: <201102110148.43155.chunkeey@googlemail.com>
On 02/10/2011 06:48 PM, Christian Lamparter wrote:
> 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."
>
> Cc: <stable@kernel.org>
> Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
> ---
> Embarrassingly, this bug is unique to p54 and has been around
> since 2.6.25. This tells us something interesting about our
> userbase.
I do use it on a LE system that probably has coherent DMA. Did someone run into
this bug?
> ---
> diff --git a/drivers/net/wireless/p54/p54pci.c b/drivers/net/wireless/p54/p54pci.c
> index 1eacba4..0494d7b 100644
> --- a/drivers/net/wireless/p54/p54pci.c
> +++ b/drivers/net/wireless/p54/p54pci.c
> @@ -199,6 +199,7 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index,
> 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];
> @@ -216,17 +217,20 @@ static void p54p_check_rx_ring(struct ieee80211_hw *dev, u32 *index,
>
> 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);
How does a BE zero differ from a LE zero? Using it this way emphasizes that it
needs to be translated - I'm not objecting, just curious.
Larry
next prev parent reply other threads:[~2011-02-11 1:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-11 0:48 [PATCH for-2.6.38] p54pci: update receive dma buffers before and after processing Christian Lamparter
2011-02-11 0:52 ` John W. Linville
2011-02-11 1:37 ` Larry Finger [this message]
2011-02-11 12:05 ` Christian Lamparter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D5492BC.4030104@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=chunkeey@googlemail.com \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.