linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: Problem with non aligned DMA in usbnet on ARM
Date: Wed, 11 Aug 2010 10:54:54 +0100	[thread overview]
Message-ID: <20100811095454.GA22543@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <AANLkTi=ycg=adcizNWKMCb7EdfDANM=6Es7r_gF1LbhV@mail.gmail.com>

On Wed, Aug 11, 2010 at 11:41:41AM +0200, Martin Fuzzey wrote:
> Digging a bit showed that the driver was submitting a non aligned data
> pointer in the URB.
> This is due to:
> skb_reserve (skb, NET_IP_ALIGN);
> 
> in net/usb/usbnet.c rx_submit()
> 
> NET_IP_ALIGN is defined as 2 in skbuff.h (default value as not defined
> by ARM) hence the data buffer address was offset by 2 whereas the hcd
> requires 4 byte alignment to work at all and cache line (32 byte here)
> alignment to work reliably.

x86 also has NET_IP_ALIGN as 2, so it will also be IP-header aligned there
too, so the restriction won't be from the USB stack.

> Removing this call to skb_reserve() fixes the problem for me.

However, that makes parsing and creating IP headers really inefficient,
especially as we take a trap each time a misaligned access is performed.

> 3) Change the HCD to copy if not aligned
> I'd like to avoid that.

You haven't said what HCD you're using.

> On a related note, this is the second time I've run into this type of
> problem.It would be much easier to debug if the HCD warned (or
> refused) misaligned URBs.

If HCD can't cope with misaligned URBs, it should fail across the board -
or be made to warn across the board - but I suspect it's a specific HCD
that you're using which is only applicable to ARM.

In that case, I'd say the HCD must handle misaligned URBs itself so
behaviour is consistent between all implementations on different
platforms.

  reply	other threads:[~2010-08-11  9:54 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-11  9:41 Problem with non aligned DMA in usbnet on ARM Martin Fuzzey
2010-08-11  9:54 ` Russell King - ARM Linux [this message]
2010-08-11 10:11   ` Martin Fuzzey
2010-08-11 15:04     ` Greg KH
2010-08-11 16:08       ` Martin Fuzzey
2010-08-11 17:42         ` Greg KH
2010-08-11 19:07           ` Martin Fuzzey
2010-08-11 20:13             ` Greg KH
2010-08-11 22:31               ` Martin Fuzzey
2010-08-12 17:01                 ` Matthieu CASTET
2010-08-11 19:10           ` Oliver Neukum
2010-08-11  9:59 ` Matthieu CASTET
2010-08-11 11:38   ` Martin Fuzzey
2010-08-11 15:54     ` Gary King
2010-08-11 20:35       ` Russell King - ARM Linux
2010-08-11 22:20         ` Martin Fuzzey
2010-08-11 22:47           ` Russell King - ARM Linux
2010-08-12 17:08           ` Matthieu CASTET
2010-08-13 10:06             ` Martin Fuzzey
2010-08-13 10:58               ` Oliver Neukum
2010-08-13 13:42                 ` David Brownell
2010-08-13 13:53                   ` Oliver Neukum

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=20100811095454.GA22543@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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 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).