netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Martin Fuzzey <mfuzzey@gmail.com>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	linux-usb <linux-usb@vger.kernel.org>,
	netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: Problem with non aligned DMA in usbnet on ARM
Date: Wed, 11 Aug 2010 13:13:32 -0700	[thread overview]
Message-ID: <20100811201332.GB10379@kroah.com> (raw)
In-Reply-To: <4C62F4EF.1050808@gmail.com>

On Wed, Aug 11, 2010 at 09:07:27PM +0200, Martin Fuzzey wrote:
> Greg KH wrote:
> >> So the question is are hcds expected to accept arbitarilly aligned but
> >> heap allocated pointers (such as the result of kmalloc() + 1)?
> >>     
> >
> > It sounds like your HCD doesn't like this, so perhaps we should make
> > that rule :)
> >
> > If you allocate the urb with a kmalloc() call with no offset, does it
> > all work properly? 
> Yes
> >  The driver should be calling usb_alloc_urb() which
> > does this automatically for them, right?  Or is it trying to allocate
> > things on its own somehow?
> >
> >   
> It's not the URB itself (which is allocated by usb_alloc_urb) but rather
> the buffer pointer within the URB that causes the problem.

Doh, you are right, sorry about that.

> It's the asix driver (or more exactly the usbnet core used by that driver).
> It does (rx_submit() in drivers/net/usb/usbnet.c):
> 
> urb = usb_alloc_urb();
> skb = alloc_skb (...);
> skb_reserve (skb, NET_IP_ALIGN);
> usb_fill_bulk_urb (urb,...  skb->data);
> usb_submit_urb(urb)
> 
> skb->data as returned by alloc_skb() is aligned
> but skb_reserve adds 2.
> 
> Thus removing the skb_reserve() call makes it work.
> BUT if I do that the IP header is no longer aligned so accesses further
> up the network stack have to be fixed up by exception handlers which is
> expensive (even with hcds which don't require this)

Can you fix this in the host controller driver?

thanks,

greg k-h

  reply	other threads:[~2010-08-11 20:13 UTC|newest]

Thread overview: 20+ 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
     [not found] ` <AANLkTi=ycg=adcizNWKMCb7EdfDANM=6Es7r_gF1LbhV-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-11  9:54   ` Russell King - ARM Linux
2010-08-11 10:11     ` Martin Fuzzey
2010-08-11 15:04       ` Greg KH
2010-08-11 16:08         ` Martin Fuzzey
     [not found]           ` <AANLkTimmJDKbh3_pRY_ASKvjsf4YuuUMh3edh5LvDv-p-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-11 17:42             ` Greg KH
     [not found]               ` <20100811174238.GA12382-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2010-08-11 19:07                 ` Martin Fuzzey
2010-08-11 20:13                   ` Greg KH [this message]
     [not found]                     ` <20100811201332.GB10379-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
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
     [not found]     ` <4C627479.4060400-ITF29qwbsa/QT0dZR+AlfA@public.gmane.org>
2010-08-11 11:38       ` Martin Fuzzey
     [not found]         ` <4C62C7B3.2030706@nvidia.com>
     [not found]           ` <20100811203505.GA463@n2100.arm.linux.org.uk>
     [not found]             ` <20100811203505.GA463-l+eeeJia6m9vn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2010-08-11 22:20               ` Martin Fuzzey
2010-08-11 22:47                 ` Russell King - ARM Linux
     [not found]                 ` <4C632217.9000608-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-08-12 17:08                   ` Matthieu CASTET
2010-08-13 10:06                     ` Martin Fuzzey
     [not found]                       ` <4C65193E.4090807-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2010-08-13 10:58                         ` Oliver Neukum
     [not found]                           ` <201008131258.55016.oneukum-l3A5Bk7waGM@public.gmane.org>
2010-08-13 13:42                             ` David Brownell
     [not found]                               ` <732137.54230.qm-g47maUHHHF/6X00i2u5GFvu2YVrzzGjVVpNB7YpNyf8@public.gmane.org>
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=20100811201332.GB10379@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mfuzzey@gmail.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 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).