On Wed, Oct 19, 2011 at 8:35 PM, Nicholas A. Bellinger
<[email protected]> wrote:
> On Wed, 2011-10-19 at 19:56 +0200, Bart Van Assche wrote:
> Not sure what you mean here.  Can you be more specific..?

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.

Bart.
--
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

Reply via email to