Re: [PATCH] SIW: iWARP Protocol headers

Bart Van Assche
2010-10-06T16:02:39Z

On Wed, Oct 6, 2010 at 2:52 PM, Bernard Metzler <BMT@zurich.ibm.com> wrote:
>
>
> linux-rdma-owner@vger.kernel.org wrote on 10/05/2010 06:10:45 PM:
>
> > On Tue, Oct 5, 2010 at 8:53 AM, Bernard Metzler <bmt@zurich.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
>
> (1) is not harmful. (2) could be limited to
> just one read/write operation per rx/tx path
> and all other access could be done on a
> structure which contains the host representation
> of the hdr content. both structures could coexist
> in a union, part of the rx or tx context.
> would that satisfy your complain?

Please have a look at e.g. the header file <scsi/srp.h>. As you can
see in that header file, __attribute__((__packed__)) is only specified
when absolutely necessary.

Bart.