[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 07 Jul 2011 00:13:01 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: loke.chetan@...il.com
Cc: netdev@...r.kernel.org, eric.dumazet@...il.com, joe@...ches.com,
bhutchings@...arflare.com, shemminger@...tta.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 net-next af-packet 1/2] Enhance af-packet to provide
(near zero)lossless packet capture functionality.
From: chetan loke <loke.chetan@...il.com>
Date: Wed, 6 Jul 2011 17:45:20 -0400
> new format:
>
> union bd_header_u {
> /* renamed struct bd_v1 to hdr_v1 */
> struct hdr_v1 h1;
> } __attribute__ ((__packed__));
>
> struct block_desc {
> __u16 version;
> __u16 offset_to_priv;
> union bd_header_u hdr;
> } __attribute__ ((__packed__));
>
> Is this ok with you?
Get rid of __packed__, it's going to kill performance on RISC
platforms. If you use __packed__, regardless of the actual alignment,
the compiler must assume that each part of the struct "might" be
unaligned. So on architectures such as sparc where alignment matters,
a word is going to be accessed by a sequence of byte loads/stores.
Do not use packed unless absolutely enforced by a protocol or hardware
data structure, it's evil.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists