On Thu, Jan 18, 2007 at 06:14:31PM +0200, Michael S. Tsirkin wrote:

> So the issue is that we are casting char *data which has no
> alignment guarantees to 64 bit number. We really must find a way to
> force 64 bit alignment for struct ib_user_mad all over. Would not
> something like the following simple trick work?
 
> struct ib_user_mad_hdr {
>       .............
> } __attribute__((aligned (8)));

You might get a similar result if you change:

struct ib_user_mad {
        struct ib_user_mad_hdr hdr;
        __u8    data[0];
};

To

struct ib_user_mad {
        struct ib_user_mad_hdr hdr;
        __u64    data[0];
};

Which is more clear since it is the data[0] that has the alignment
requirement not the ib_usr_mad_hdr.. Plus you only get the pad if you
actually need it.

Jason

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to