All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksij Rempel <linux@rempel-privat.de>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH v2] ath9k: collect statistics about Rx-Dup and Rx-STBC packets
Date: Sat, 27 Apr 2013 21:13:57 +0200	[thread overview]
Message-ID: <517C2375.3030907@rempel-privat.de> (raw)
In-Reply-To: <CAJ-VmokUFtFjQk0T87E57kEhp40f1v4XgJL-iN35Bzo4h-McDQ@mail.gmail.com>

Am 27.04.2013 21:06, schrieb Adrian Chadd:
> On 27 April 2013 11:53, Oleksij Rempel <linux@rempel-privat.de> wrote:
>
>>> (And then go and re-align things inside that struct so you don't waste
>>> space.)
>>
>>
>> hmm.. what do you mean here?
>
> Structure alignment? Well, you typically want to have everything be
> dword aligned (32 bits) or word (16 bits) aligned. Otherwise the
> compiler may insert extra padding between fields in order to meet
> alignment requirements on platforms that need it (MIPS, older ARM) or
> platforms that perform slower (newer ARM.)
>
> Eg:
>
> u32 a;
> u16 b;
> u8 c;
> u8 d;
>
> .. that's fine - the u32 is dword aligned, the u16 is word aligned,
> the u8's don't need aligning.
>
> But, considder:
>
> u32 a;
> u8 b;
> u16 c;
> u8 d;
>
> .. u32 is dword aligned, u8 b is fine as it's a a byte and doesn't
> need aligning, but 'u16 c' isn't dword aligned! So the compiler will
> insert a byte padding between 'b' and 'c'.
>
> same deal with:
>
> u32 a;
> u16 b;
> u32 c;
>
> .. 'a' is fine; 'b' is fine, but 'c' starts at a word boundary, not a
> dword boundary.
>
> Hence why things like IP/TCP headers and such look the way they do. :-)
>
> Now, i don't know what 'bool' is, whether it's a byte, word or dword.
> That "is_mybeacon" field should probably be just another flag in
> rx_status, then just extend 'rs_flags' to 16 bits and include it. That
> way the alignment is easy to see - all the fields in rx_status and the
> htc rx_status structs have explicit sizes. :-)

ok, i was not sure if you mean what i think :)
I would prefer to do this in separate patch.

-- 
Regards,
Oleksij

WARNING: multiple messages have this Message-ID (diff)
From: Oleksij Rempel <linux@rempel-privat.de>
To: Adrian Chadd <adrian@freebsd.org>
Cc: Felix Fietkau <nbd@nbd.name>,
	ath9k-devel@lists.ath9k.org, linux-wireless@vger.kernel.org
Subject: Re: [PATCH v2] ath9k: collect statistics about Rx-Dup and Rx-STBC packets
Date: Sat, 27 Apr 2013 21:13:57 +0200	[thread overview]
Message-ID: <517C2375.3030907@rempel-privat.de> (raw)
In-Reply-To: <CAJ-VmokUFtFjQk0T87E57kEhp40f1v4XgJL-iN35Bzo4h-McDQ@mail.gmail.com>

Am 27.04.2013 21:06, schrieb Adrian Chadd:
> On 27 April 2013 11:53, Oleksij Rempel <linux@rempel-privat.de> wrote:
>
>>> (And then go and re-align things inside that struct so you don't waste
>>> space.)
>>
>>
>> hmm.. what do you mean here?
>
> Structure alignment? Well, you typically want to have everything be
> dword aligned (32 bits) or word (16 bits) aligned. Otherwise the
> compiler may insert extra padding between fields in order to meet
> alignment requirements on platforms that need it (MIPS, older ARM) or
> platforms that perform slower (newer ARM.)
>
> Eg:
>
> u32 a;
> u16 b;
> u8 c;
> u8 d;
>
> .. that's fine - the u32 is dword aligned, the u16 is word aligned,
> the u8's don't need aligning.
>
> But, considder:
>
> u32 a;
> u8 b;
> u16 c;
> u8 d;
>
> .. u32 is dword aligned, u8 b is fine as it's a a byte and doesn't
> need aligning, but 'u16 c' isn't dword aligned! So the compiler will
> insert a byte padding between 'b' and 'c'.
>
> same deal with:
>
> u32 a;
> u16 b;
> u32 c;
>
> .. 'a' is fine; 'b' is fine, but 'c' starts at a word boundary, not a
> dword boundary.
>
> Hence why things like IP/TCP headers and such look the way they do. :-)
>
> Now, i don't know what 'bool' is, whether it's a byte, word or dword.
> That "is_mybeacon" field should probably be just another flag in
> rx_status, then just extend 'rs_flags' to 16 bits and include it. That
> way the alignment is easy to see - all the fields in rx_status and the
> htc rx_status structs have explicit sizes. :-)

ok, i was not sure if you mean what i think :)
I would prefer to do this in separate patch.

-- 
Regards,
Oleksij

  reply	other threads:[~2013-04-27 19:13 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-27 15:25 [ath9k-devel] [PATCH RFC] ath9k: collect statistics about Rx-Dup and Rx-STBC packets Oleksij Rempel
2013-04-27 15:25 ` Oleksij Rempel
2013-04-27 18:39 ` [ath9k-devel] [PATCH v2] " Oleksij Rempel
2013-04-27 18:39   ` Oleksij Rempel
2013-04-27 18:51   ` [ath9k-devel] " Adrian Chadd
2013-04-27 18:51     ` Adrian Chadd
2013-04-27 18:53     ` [ath9k-devel] " Oleksij Rempel
2013-04-27 18:53       ` Oleksij Rempel
2013-04-27 19:06       ` [ath9k-devel] " Adrian Chadd
2013-04-27 19:06         ` Adrian Chadd
2013-04-27 19:13         ` Oleksij Rempel [this message]
2013-04-27 19:13           ` Oleksij Rempel
2013-04-28  1:21         ` [ath9k-devel] " Felix Fietkau
2013-04-28  1:21           ` Felix Fietkau
2013-04-28  6:41 ` [ath9k-devel] [PATCH v3] " Oleksij Rempel
2013-04-28  6:41   ` Oleksij Rempel
2013-04-28 12:51 ` [ath9k-devel] [PATCH RFC] " Felix Fietkau
2013-04-28 12:51   ` Felix Fietkau
2013-04-28 14:13   ` [ath9k-devel] " Oleksij Rempel
2013-04-28 14:13     ` Oleksij Rempel
2013-04-28 15:03     ` [ath9k-devel] " Oleksij Rempel
2013-04-28 15:03       ` Oleksij Rempel
2013-04-28 19:19       ` Oleksij Rempel
2013-04-28 19:19         ` Oleksij Rempel
2013-04-28 19:20         ` Felix Fietkau
2013-04-28 19:20           ` Felix Fietkau
2013-04-29  6:45       ` Wojciech Dubowik
2013-04-29  6:45         ` Wojciech Dubowik
2013-04-29  7:20         ` Oleksij Rempel
2013-04-29  7:20           ` Oleksij Rempel
2013-04-28 14:54   ` Ben Greear
2013-04-28 14:54     ` Ben Greear
2013-04-28 15:08     ` Felix Fietkau
2013-04-28 15:08       ` Felix Fietkau
2013-04-28 15:15       ` Ben Greear
2013-04-28 15:15         ` Ben Greear
2013-04-28 15:32         ` Felix Fietkau
2013-04-28 15:32           ` Felix Fietkau
2013-05-08  5:32       ` Sujith Manoharan
2013-05-08  5:32         ` Sujith Manoharan
2013-05-08 16:07         ` Ben Greear
2013-05-08 16:07           ` Ben Greear
2013-05-08 22:45           ` Adrian Chadd
2013-05-08 22:45             ` Adrian Chadd

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=517C2375.3030907@rempel-privat.de \
    --to=linux@rempel-privat.de \
    --cc=ath9k-devel@lists.ath9k.org \
    /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.