[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20101006172518.GI24268@obsidianresearch.com>
Date: Wed, 6 Oct 2010 11:25:18 -0600
From: Jason Gunthorpe <jgunthorpe@...idianresearch.com>
To: Bernard Metzler <BMT@...ich.ibm.com>
Cc: Bart Van Assche <bvanassche@....org>, linux-rdma@...r.kernel.org,
linux-rdma-owner@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] SIW: iWARP Protocol headers
On Wed, Oct 06, 2010 at 02:52:46PM +0200, Bernard Metzler wrote:
>
>
> linux-rdma-owner@...r.kernel.org wrote on 10/05/2010 06:10:45 PM:
>
> > On Tue, Oct 5, 2010 at 8:53 AM, Bernard Metzler <bmt@...ich.ibm.com>
> wrote:
> > > +} __attribute__((__packed__));
> >
> > Apparently you make extensive use of the packed attribute. Please read
> > this blog entry, in which it is explained why this is harmful:
> >
> > http://digitalvampire.org/blog/index.php/2006/07/31/why-you-
> > shouldnt-use-__attribute__packed/
> >
> right, thanks, i was not aware of that
> big overhead.
> but...there are reasons why we may need it _packed_:
> (1) to get the size of the packet hdr
> (2) to read/write the hdr content
It is actually a little more complicated than just this. I assume you
are casting the structures over packet payloads? In this case you
have to guarentee alignment (or used packed everywhere). Does iwarp
have provisions for alignment? If so you can construct your bitfields
using the alignment type, ie if iWarp guarantees 4 bytes then the
biggest type you can use is u32 - then you can avoid using packed.
Mind you, I'm not sure how to guarentee alignment when you consider
all the possible sources of unalignment in the stack: TCP, IP, L2 stack ?
Otherwise you need a strategy for dealing with unaligned data for
portability. :(
Jason
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists