public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eric Nelson <eric.nelson@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: force PKTALIGN to ARCH_DMA_MINALIGN
Date: Thu, 15 Mar 2012 20:36:34 -0700	[thread overview]
Message-ID: <4F62B542.7080502@boundarydevices.com> (raw)
In-Reply-To: <201203160350.08910.marex@denx.de>

On 03/15/2012 07:50 PM, Marek Vasut wrote:
> Dear Eric Nelson,
>
>> This will prevent the need for architectures whose DMA alignment
>> is greater than 32 to have bounce buffers.
>>
>> Signed-off-by: Eric Nelson<eric.nelson@boundarydevices.com>
>> ---
>>   include/net.h |    3 ++-
>>   1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/include/net.h b/include/net.h
>> index e4d42c2..ff428d0 100644
>> --- a/include/net.h
>> +++ b/include/net.h
>> @@ -16,6 +16,7 @@
>>   #include<commproc.h>
>>   #endif	/* CONFIG_8xx */
>>
>> +#include<asm/cache.h>
>>   #include<asm/byteorder.h>	/* for nton* / ntoh* stuff */
>>
>>
>> @@ -31,7 +32,7 @@
>>   # define PKTBUFSRX	4
>>   #endif
>>
>> -#define PKTALIGN	32
>> +#define PKTALIGN	ARCH_DMA_MINALIGN
>>
>>   /* IPv4 addresses are always 32 bits in size */
>>   typedef u32		IPaddr_t;
>
> Won't this break retarded hardware that has ARCH_DMA_MINALIGN smaller than 32 ?
>

I can't see how it would.

This macro is only used for alignment and the PKTSIZE_ALIGN variable should be
safe on any architecture at 1536 (0x600) bytes.

I do see a potential problem with eth.c iff CONFIG_API is set, but I'm
unfamiliar with this API. It appears to me that this declaration
needs to be aligned, with or without the PKTALIGN change or it won't be
usable with DMA since PKTSIZE is unlikely to be cache line or DMA friendly
at 1518 (0x5EE) bytes.

	static struct {
		uchar data[PKTSIZE];
		int length;
	} eth_rcv_bufs[PKTBUFSRX];

It appears that the CONFIG_API macro is only defined for PMC440. Is this
supported for other machines?

Is there some test code available?

Please advise,


Eric

  parent reply	other threads:[~2012-03-16  3:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <http://lists.denx.de/pipermail/u-boot/2012-March/120205.html>
2012-03-14 21:35 ` [U-Boot] [PATCH] net: force PKTALIGN to ARCH_DMA_MINALIGN Eric Nelson
2012-03-14 22:57   ` Mike Frysinger
2012-03-16  2:50   ` Marek Vasut
2012-03-16  3:30     ` Mike Frysinger
2012-03-16  4:43       ` Marek Vasut
2012-03-16  3:36     ` Eric Nelson [this message]
2012-03-16 16:18       ` Mike Frysinger

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=4F62B542.7080502@boundarydevices.com \
    --to=eric.nelson@boundarydevices.com \
    --cc=u-boot@lists.denx.de \
    /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