From: Siarhei Siamashka <siarhei.siamashka@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 4/5] net/designware: reorder struct dw_eth_dev to pack more efficiently.
Date: Thu, 15 May 2014 15:34:49 +0300 [thread overview]
Message-ID: <20140515153449.4257e104@i7> (raw)
In-Reply-To: <1400092229.15871.19.camel@hastur.hellion.org.uk>
On Wed, 14 May 2014 19:30:29 +0100
Ian Campbell <ijc@hellion.org.uk> wrote:
> On Thu, 2014-05-08 at 22:26 +0100, Ian Campbell wrote:
> > The {r,t}xbuffs fields also need to be aligned. Previously this was done
> > implicitly because they immediately followed the descriptor tables. Make this
> > explicit and also move to the head of the struct.
>
> Looks like I managed to not actually commit the move of the field to the
> head of the struct! v3.1 follows....
>
> Ian.
>
> 8<------------
>
> From 2937ba01841887317f6792709ed57cb86b5fc0cd Mon Sep 17 00:00:00 2001
> From: Ian Campbell <ijc@hellion.org.uk>
> Date: Thu, 1 May 2014 19:45:15 +0100
> Subject: [PATCH] net/designware: reorder struct dw_eth_dev to pack more
> efficiently.
>
> The {tx,rx}_mac_descrtable fields are aligned to ARCH_DMA_MINALIGN, which could
> be 256 or even larger. That means there is a potentially huge hole in the
> struct before those fields, so move them to the front where they are better
> packed.
>
> Moving them to the front also helps ensure that so long as dw_eth_dev is
> properly aligned (which it is since "net/designware: ensure device private data
> is DMA aligned.") the {tx,rx}_mac_descrtable will be too, or at least avoids
> having to worry too much about compiler specifics.
>
> The {r,t}xbuffs fields also need to be aligned. Previously this was done
> implicitly because they immediately followed the descriptor tables. Make this
> explicit and also move to the head of the struct.
>
> Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
> Cc: Alexey Brodkin <abrodkin@synopsys.com>
> ---
> v3.1: Actually move to the head of the struct, like the commit log said...
> v3: Also align tx and rx bufs
> ---
> drivers/net/designware.h | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/designware.h b/drivers/net/designware.h
> index 382b0c7..de2fdcb 100644
> --- a/drivers/net/designware.h
> +++ b/drivers/net/designware.h
> @@ -215,15 +215,14 @@ struct dmamacdescr {
> #endif
>
> struct dw_eth_dev {
> - u32 interface;
> - u32 tx_currdescnum;
> - u32 rx_currdescnum;
> -
> struct dmamacdescr tx_mac_descrtable[CONFIG_TX_DESCR_NUM];
> struct dmamacdescr rx_mac_descrtable[CONFIG_RX_DESCR_NUM];
> + char txbuffs[TX_TOTAL_BUFSIZE] __aligned(ARCH_DMA_MINALIGN);
> + char rxbuffs[RX_TOTAL_BUFSIZE] __aligned(ARCH_DMA_MINALIGN);
>
> - char txbuffs[TX_TOTAL_BUFSIZE];
> - char rxbuffs[RX_TOTAL_BUFSIZE];
> + u32 interface;
> + u32 tx_currdescnum;
> + u32 rx_currdescnum;
>
> struct eth_mac_regs *mac_regs_p;
> struct eth_dma_regs *dma_regs_p;
Thanks for your hard work addressing this nasty tftp breakage
regression on the Cubietruck (and on the other ARM hardware, which
happens to use the same designware driver). Now everything looks
perfect. The whole v3 patch set with this v3.1 reorder fix is
Tested-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
and also if anybody cares
Reviewed-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
--
Best regards,
Siarhei Siamashka
next prev parent reply other threads:[~2014-05-15 12:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-08 21:26 [U-Boot] [PATCH v3 0/5] net/designware: fixes for data cache, phylib and burst size Ian Campbell
2014-05-08 21:26 ` [U-Boot] [PATCH v3 1/5] net/designware: call phy_connect_dev() to properly setup phylib device Ian Campbell
2014-05-08 21:26 ` [U-Boot] [PATCH v3 2/5] net/designware: ensure device private data is DMA aligned Ian Campbell
2014-05-08 21:26 ` [U-Boot] [PATCH v3 3/5] net/designware: ensure cache invalidations are aligned to ARCH_DMA_MINALIGN Ian Campbell
2014-05-08 21:26 ` [U-Boot] [PATCH v3 4/5] net/designware: reorder struct dw_eth_dev to pack more efficiently Ian Campbell
2014-05-14 18:30 ` Ian Campbell
2014-05-15 12:34 ` Siarhei Siamashka [this message]
2014-05-08 21:26 ` [U-Boot] [PATCH v3 5/5] net/designware: Make DMA burst length configurable and reduce by default Ian Campbell
2014-05-25 18:53 ` [U-Boot] [PATCH v3 0/5] net/designware: fixes for data cache, phylib and burst size Albert ARIBAUD
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=20140515153449.4257e104@i7 \
--to=siarhei.siamashka@gmail.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