On Wed, Oct 19, 2011 at 11:47 AM, Bart Van Assche <[email protected]> wrote: > I'm referring to this code: > > sprintf(sport->port_guid, "0x0000000000000000%04x%04x%04x%04x", > be16_to_cpu(((__be16 *)&device->node_guid)[0]), > be16_to_cpu(((__be16 *)&device->node_guid)[1]), > be16_to_cpu(((__be16 *)&device->node_guid)[2]), > be16_to_cpu(((__be16 > *)&device->node_guid)[3]) + i); > > There is no guarantee that the above formula will match the numbers > assigned by the HCA manufacturer. Also, what will happen if for the > last two digits the sum exceeds 2**16 ? > > I would like to see the above code to be replaced by something like > the following: > > snprintf(sport->port_guid, sizeof(sport->port_guid), > "0x%016llx", > be64_to_cpu(sport->gid.global.interface_id)); > > Please note that in the InfiniBand Architecture Manual the words "port > GUID" refer to a manufacturer-assigned EUI-64. So if you are going to > use the name "port GUID" for an 128-bit quantity I'm afraid you are > going to really confuse some people.
I agree that this looks broken. I think the most sensible thing to do would be to have a port_gid (GID, not GUID) and use GID table entry 0, rather than doing this math on node GUID (that I agree is totally bogus). - R. -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
