public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] net: fec_mxc: Fix timeouts during tftp transfer
Date: Tue, 17 Sep 2013 12:59:34 +0200 (CEST)	[thread overview]
Message-ID: <1135126743.1842859.1379415574013.JavaMail.zimbra@advansee.com> (raw)
In-Reply-To: <201309170500.58855.marex@denx.de>

Hi Marek,

On Tuesday, September 17, 2013 5:00:58 AM, Marek Vasut wrote:
> Dear Fabio Estevam,
> 
> > From: Fabio Estevam <fabio.estevam@freescale.com>
> > 
> > Performing tftp transfers on mx28 results in random timeouts.
> > 
> > Hector Palacios and Robert Hodaszi analyzed the root cause being related to
> > the alignment of the 'buff' buffer inside fec_recv().
> > 
> > GCC versions such as 4.4/4.5 are more likely to exhibit such problem.
> > 
> > Use ALLOC_CACHE_ALIGN_BUFFER() for making the proper alignment of buffer.
> > 
> > Reported-by: Hector Palacios <hector.palacios@digi.com>
> > Tested-by: Oliver Metz <oliver@freetz.org>
> > Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> > ---
> >  drivers/net/fec_mxc.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
> > index 690e572..b423ff6 100644
> > --- a/drivers/net/fec_mxc.c
> > +++ b/drivers/net/fec_mxc.c
> > @@ -794,7 +794,7 @@ static int fec_recv(struct eth_device *dev)
> >  	uint16_t bd_status;
> >  	uint32_t addr, size, end;
> >  	int i;
> > -	uchar buff[FEC_MAX_PKT_SIZE] __aligned(ARCH_DMA_MINALIGN);
> > +	ALLOC_CACHE_ALIGN_BUFFER(uchar, buff, FEC_MAX_PKT_SIZE);
> 
> OK, it's gonna be safer this way, still what's the root cause of the issue?
> 
> FEC_MAX_PKT_SIZE is 1536 (which is aligned to 32b and even 64b)
> __aligned(ARCH_DMA_MINALIGN) aligns the stuff to 32b or 64b depending on CPU
> 
> So how can the above not properly align the buffer? Is that a compiler bug
> then?
> 
> btw. using ALLOC_CACHE_ALIGN_BUFFER will be safer were someone to change
> FEC_MAX_PKT_SIZE, the buffer would still be safe for cache flush/inval ops.

I have encountered the same kind of alignment issue recently on something else.
It looks like GCC for ARM just silently ignores the aligned attribute for auto
(stacked) variables.

Best regards,
Beno?t

  reply	other threads:[~2013-09-17 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16  1:10 [U-Boot] [PATCH] net: fec_mxc: Fix timeouts during tftp transfer Fabio Estevam
2013-09-16  7:40 ` Hector Palacios
2013-09-17  3:00 ` Marek Vasut
2013-09-17 10:59   ` Benoît Thébaudeau [this message]
2013-09-17 11:47     ` Wolfgang Denk
2013-09-17 14:42       ` Benoît Thébaudeau
2013-09-17 19:27         ` Wolfgang Denk
2013-09-17 19:30           ` Fabio Estevam

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=1135126743.1842859.1379415574013.JavaMail.zimbra@advansee.com \
    --to=benoit.thebaudeau@advansee.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