All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <rob.herring@calxeda.com>
To: Kyle McMartin <kyle@redhat.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] xgmac: use bufsz not dma_buf_sz in rx_refill
Date: Thu, 29 Aug 2013 15:24:30 -0500	[thread overview]
Message-ID: <521FADFE.7040908@calxeda.com> (raw)
In-Reply-To: <20130829201151.GJ8764@redacted.bos.redhat.com>

On 08/29/2013 03:11 PM, Kyle McMartin wrote:
> Noticed while debugging another issue that DMA debug turned up, looks
> like commit ef468d23 missed a case when switching to bufsz instead of
> priv->dma_buf_sz? (tbf, the whole handling of DMA buffers seems slightly
> suspect since we're not tracking the size, but trusting the hardware
> between map and unmap...)

Please see my patch series of fixes:

http://www.spinics.net/lists/netdev/msg248076.html

> Signed-off-by: Kyle McMartin <kyle@redhat.com>
> 
> --- a/drivers/net/ethernet/calxeda/xgmac.c
> +++ b/drivers/net/ethernet/calxeda/xgmac.c
> @@ -686,7 +686,7 @@ static void xgmac_rx_refill(struct xgmac_priv *priv)
>  			priv->rx_skbuff[entry] = skb;
>  			paddr = dma_map_single(priv->device, skb->data,
>  					       bufsz, DMA_FROM_DEVICE);
> -			desc_set_buf_addr(p, paddr, priv->dma_buf_sz);
> +			desc_set_buf_addr(p, paddr, bufsz);

This is not right because the h/w wants the size to include the 2 bytes
skipped at the beginning for NET_IP_ALIGN. The h/w may also corrupt 1-7
bytes of data at the head or tail if the frame is not 8 byte aligned and
padded. We are relying that skb allocations are aligned.

Rob

  reply	other threads:[~2013-08-29 20:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29 20:11 [PATCH] xgmac: use bufsz not dma_buf_sz in rx_refill Kyle McMartin
2013-08-29 20:24 ` Rob Herring [this message]
2013-08-29 20:26   ` Kyle McMartin
2013-08-29 20:38   ` David Miller
2013-08-29 20:31 ` Sergei Shtylyov
2013-08-29 20:34 ` David Miller
2013-08-29 20:35   ` Kyle McMartin
2013-08-29 20:38     ` David Miller
2013-08-30  3:17       ` Rob Herring

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=521FADFE.7040908@calxeda.com \
    --to=rob.herring@calxeda.com \
    --cc=kyle@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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.