[ofw] [PATCH] ib_types.h - align structs to even multiples of 8 bytes
Smith, Stan
stan.smith at intel.com
Thu May 20 13:07:54 PDT 2010
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 <stan.smith at intel.com>
--- 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);
+ 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>
More information about the ofw
mailing list