Thread (13 messages) flat view 13 messages, 5 authors, 2010-08-12

Re: Problem with non aligned DMA in usbnet on ARM

From: Russell King - ARM Linux <hidden>
Date: 2010-08-11 09:54:54
Also in: linux-arm-kernel

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.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help