Hal Rosenstock wrote: > On Thu, May 20, 2010 at 4:07 PM, Smith, Stan <[email protected]> > wrote: >> >> In function 'ib_get_attr_offset()' replace attr_size adjustment code >> with an ASSERT() as attr offset sizes are required to be a multiple >> of 8 bytes. >> >> By removing antiquated structure padding, the sizeof(struct) values >> return to the correct size alignment. >> Removal of padding allows osmtest to correctly generate and validate >> a fabric inventory file. >> >> signed-off-by: stan smith <[email protected]> >> >> --- a/inc/iba/ib_types.h Thu May 20 12:55:24 2010 >> +++ b/inc/iba/ib_types.h Thu May 20 11:33:10 2010 @@ -4408,10 >> +4408,8 @@ >> ib_get_attr_offset( >> IN const uint32_t >> attr_size ) >> { >> - if( attr_size & 0x07 ) >> - return( cl_hton16( (uint16_t)(attr_size >> 3) + 1 ) >> ); >> - else >> - return( cl_hton16( (uint16_t)(attr_size >> 3) ) ); >> + CL_ASSERT((attr_size & 0x07) == 0); > > Should this assert be pushed to the Linux (main) version of this file > ?
Your call. I'd vote for a yes as it can, and did, catch an inadvertent oops elsewhere. Since it's under DEBUG the runtime cost is minimized for the production case; although as Fab pointed out, you need to run DEBUG once in awhile. > > -- Hal > >> + return( cl_hton16( (uint16_t)(attr_size >> 3) ) ); >> } >> >> /****f* IBA Base: Types/ib_sa_mad_get_payload_ptr >> @@ -6088,7 +6086,6 @@ >> uint8_t port_num; >> uint8_t resv; >> ib_port_info_t port_info; >> - uint8_t pad[6]; >> >> } PACK_SUFFIX ib_portinfo_record_t; >> #include <complib/cl_packoff.h> >> @@ -6192,7 +6189,6 @@ >> ib_net16_t lid; >> uint16_t resv0; >> ib_switch_info_t switch_info; >> - uint8_t pad[3]; >> >> } PACK_SUFFIX ib_switch_info_record_t; >> #include <complib/cl_packoff.h> >> _______________________________________________ >> ofw mailing list >> [email protected] >> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw _______________________________________________ ofw mailing list [email protected] http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw
