[ofa-general] [PATCH/Resend] Fixed capability mask problem in ibstat introduec by commit 722b6c6428c9e4921a81f4a6db2838bcee660bb7
Sean Hefty
sean.hefty at intel.com
Fri Apr 24 10:27:24 PDT 2009
>diff --git a/infiniband-diags/src/ibstat.c b/infiniband-diags/src/ibstat.c
>index 7985be1..99af9a8 100644
>--- a/infiniband-diags/src/ibstat.c
>+++ b/infiniband-diags/src/ibstat.c
>@@ -111,7 +111,7 @@ port_dump(umad_port_t *port, int alone)
> printf("%sBase lid: %d\n", pre, port->base_lid);
> printf("%sLMC: %d\n", pre, port->lmc);
> printf("%sSM lid: %d\n", pre, port->sm_lid);
>- printf("%sCapability mask: 0x%08x\n", pre, (unsigned)ntohll(port-
>>capmask));
>+ printf("%sCapability mask: 0x%08x\n", pre,
>(unsigned)(ntohl((uint32_t)(port->capmask))));
Casting from 64-bit to 32-bit, then byte swapping doesn't look right.
I think the problem may be in libibumad, umad.c, line 166:
if (sys_read_uint64(port_dir, SYS_PORT_CAPMASK, &port->capmask) < 0)
goto clean;
port->capmask = htonl(port->capmask);
capmask is read as a 64-bit value, but only 32-bit swap is used. (libibumad is
not shared between Linux and Windows, so this problem doesn't show up on
Windows.)
- Sean
More information about the general
mailing list