All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Filippov <jcmvbkbc@gmail.com>
To: Christian Lamparter <chunkeey@googlemail.com>
Cc: linux-wireless <linux-wireless@vger.kernel.org>,
	"Michael Büsch" <m@bues.ch>
Subject: Re: [RFC] p54spi: don't DMA onto the stack
Date: Sun, 20 Nov 2011 04:48:55 +0400	[thread overview]
Message-ID: <201111200448.55662.jcmvbkbc@gmail.com> (raw)
In-Reply-To: <201111192356.54667.chunkeey@googlemail.com>

> On Saturday 19 November 2011 23:15:34 Max Filippov wrote:
> > > On Thursday 17 November 2011 00:15:42 Michael Büsch wrote:
> > > > On Thu, 17 Nov 2011 00:12:03 +0100
> > > > Christian Lamparter <chunkeey@googlemail.com> wrote:
> > > > > BTW: I always wondered if it would make sense to have a
> > > > > cached rx skb ready in p54spi_rx(). This way we don't
> > > > > have to do DMA onto the stack [which is really ugly and
> > > > > possibly illegal] and might even get a better rx
> > > > > performance. I could write the code but as you know I don't
> > > > > have the hardware to test it.
> > > > 
> > > > I'll test it, if you can come up with a patch.
> > > ---
> > > [RFC] p54spi: don't DMA onto the stack
> > > 
> > > DMA transfers should not be done onto the kernel stack.
> > 
> > What about p54spi_read32, it does the same thing?
> AFAIK no, p54spi_read32 and p54spi_write16/32 uses PIO.

Initial p54spi_rx transfer with the kludge in place is 4 bytes long as well.

> Of course, I don't know 100% just the docs from johannes' says so :-D.

That's right, drivers/spi/omap2_mcspi.c says that:

/* use PIO for small transfers, avoiding DMA setup/teardown overhead and
 * cache operations; better heuristics consider wordsize and bitrate.
 */                 
#define DMA_MIN_BYTES           160

> > I have tested this patch, it works, no measurable rx speed boost though
> > (~6.1Mbit/sec in iperf as either server or client).
> I guess that number comes from unicast plain udp testing, right. Do you
> know if the performance can be improved by setting the mtu to 2274
> [ifconfig wlanX mtu 2274] on both client and AP/server?

~6.7Mbit/sec
 
> > > -	if (len <= READAHEAD_SZ) {
> > > -		memcpy(skb_put(skb, len), rx_head + 1, len);
> > > +	if (len <= READAHEAD) {
> > > +		skb_put(skb, len);
> > >  	} else {
> > > -		memcpy(skb_put(skb, READAHEAD_SZ), rx_head + 1, READAHEAD_SZ);
> > > +		skb_put(skb, READAHEAD);
> > >  		p54spi_spi_read(priv, SPI_ADRS_DMA_DATA,
> > > -				skb_put(skb, len - READAHEAD_SZ),
> > > -				len - READAHEAD_SZ);
> > > +				skb_put(skb, len - READAHEAD),
> > > +				len - READAHEAD);
> > >  	}
> > 
> > I have also tested this patch without this (READAHEAD_SZ) kludge.
> > It appears to work now.
> well, there's one more thing: what happens when there's just
> a single read. .e.g.: 

[...snip...]

Highly unstable link and lots of "rx request of zero bytes" in the dmesg log.

Thanks.
-- Max

  reply	other threads:[~2011-11-20  0:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20111116235120.4c60c066@milhouse>
2011-11-16 23:12 ` [PATCH] p54spi: Remove FIXME in op_stop Christian Lamparter
2011-11-16 23:15   ` Michael Büsch
2011-11-19 17:59     ` [RFC] p54spi: don't DMA onto the stack Christian Lamparter
2011-11-19 22:15       ` Max Filippov
2011-11-19 22:56         ` Christian Lamparter
2011-11-20  0:48           ` Max Filippov [this message]
2011-11-20 13:24             ` Christian Lamparter
2011-11-20 14:36               ` Max Filippov

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=201111200448.55662.jcmvbkbc@gmail.com \
    --to=jcmvbkbc@gmail.com \
    --cc=chunkeey@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=m@bues.ch \
    /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.