[ofw] ib_portinfo_record_t padding history?

Fab Tillier ftillier at microsoft.com
Tue May 18 13:51:35 PDT 2010


Sean Hefty wrote on Tue, 18 May 2010 at 12:08:08

>> Thoughts?
> 
> The padding looks wrong based on the IB spec.  PortInfoRecord should
> have PortInfo as its last field.  The size of PortInfoRecord should be
> 58 bytes.

AttributeOffset in the MAD is defined as number of 8-byte words between attributes.  I believe the extra pad is there so that you can treat the records in a GET_TABLE response as an array of PortInfoRecords.  I don't know if any code actually uses it this way, but that's what I guess the intent is.

>> #include <complib/cl_packon.h>
>> typedef struct _ib_portinfo_record
>> {
>>        ib_net16_t              lid;
>>        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>
> 
> My guess (and this is only a guess) is that the padding was added to
> make PortInfoRecord align on a 64-bit boundary, probably in case it
> were sent as part of an RMPP mad.  The PortInfo structure contains 64-
> bit values at the top of the structure.

Nah, the attributes end up unaligned anyway thanks to the stellar layout of the SA MADs.  I'm pretty sure it's there to allow indexing as an array.  While the pad isn't formally documented, it will always be there.  It should be harmless.

-Fab

> You should be safe removing the padding.  It may cause Itanium to
> complain about unaligned fields, but I would expect it to work.
> 
> - Sean
> 
> _______________________________________________
> ofw mailing list
> ofw at lists.openfabrics.org
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw



More information about the ofw mailing list