[openib-general] Re: [PATCH 3/27] Add MAD helper functions
Sean Hefty
mshefty at ichips.intel.com
Fri Jul 15 15:36:11 PDT 2005
Alexey Dobriyan wrote:
> ----------------------------------------------------------------------------
> 313 in_mad->mad_hdr.attr_id = cpu_to_be16(0x12); /* PortCounters */
> ----------------------------------------------------------------------------
> drivers/infiniband/core/sysfs.c:313:32: warning: incorrect type in assignment (different base types)
> drivers/infiniband/core/sysfs.c:313:32: expected unsigned short [unsigned] [usertype] attr_id
> drivers/infiniband/core/sysfs.c:313:32: got restricted unsigned short [usertype] [force] <noident>
> ----------------------------------------------------------------------------
> Grepping for attr_id in drivers/infiniband/ shows that:
> 1) in_mad->attr_id is set to IB_SMP_ATTR_NODE_INFO (network order)
> 2) mad->mad_hdr.attr_id is compared with IB_SMP_ATTR_PORT_INFO (network order)
> 3) *->mad_hdr.attr_id is set to big-endian value
>
> All this suggests that struct ib_mad_hdr::attr_id should be __be16 instead of
> u16. So, if attr_id is really something big-endian (infiniband people should
> know), convert it. If not (unlikely) all those cpu_to_be16() and htons() are
> bogus.
If anyone else has started to look at these, please let me know. Otherwise,
I will start trying to eliminate them.
- Sean
More information about the general
mailing list