public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alexey Brodkin <Alexey.Brodkin@synopsys.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2] drivers/net/designware - fix alignment of buffer descriptors
Date: Thu, 26 Sep 2013 08:30:49 +0000	[thread overview]
Message-ID: <5243F0B8.2010608@synopsys.com> (raw)
In-Reply-To: <E6BF041E97966E4DB955F0DF883AD2D685F0C31B@de02wembxa.internal.synopsys.com>

On 09/26/2013 09:26 AM, Mischa Jonker wrote:
> Vipin wrote:
>> I have also faced this problem before. May be a better solution is to
>> place all the struct and buffer declarations at the very start of
>> dw_eth_dev structure (off-course with a comment that these should not
>> be moved). It may avoid the problem in later modifications
>
> I think that's why Alexey added the alignment to the struct dmamacdescr declaration, to make sure that it always aligned on a boundary of 16 bytes (so even 128-bit busses don't face this issue).
>
> I don't know though whether the __aligned attribute should be at the type definition of the struct or at the declaration of the "struct dmamacdescr" inside "struct dw_eth_dev". I'm guessing the declaration inside "struct dw_eth_dev" will inherit the alignment requirements of the type def though, but not sure.

At least from what I see during my trials "__aligned" in definition of 
BD structure works as well. Both arrays of buffer descriptors were 
properly aligned compared to "dw_eth_dev" base address.
And since "dw_eth_dev" structure is already aligned (it is allocated 
with "memalign") both BD arrays are also properly aligned.

Initially I thought about move of BD arrays on top of the mother 
structure but then decided to go with "__aligned" specifiers. IMHO it is 
safe enough while still very clear - no need to worry about order of 
structure members and no need to add any comments on how to keep members 
in order.

-Alexey

      reply	other threads:[~2013-09-26  8:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-25 15:27 [U-Boot] [PATCH v2] drivers/net/designware - fix alignment of buffer descriptors Alexey Brodkin
2013-09-26  4:09 ` Vipin Kumar
2013-09-26  5:26   ` Mischa Jonker
2013-09-26  8:30     ` Alexey Brodkin [this message]

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=5243F0B8.2010608@synopsys.com \
    --to=alexey.brodkin@synopsys.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