On Fri, 2007-10-12 at 20:11 +1000, Max Matveev wrote:
> In OFED 1.2 perfquery attempts to check if a port supports extended
> counters:
> 
>         } else {
>           /* Should ClassPortInfo be implemented in libibmad ? */
>              pc2 = (uint16_t *)&pc[2];           /* CapabilityMask */
>              cap_mask = *pc2;
>              if (!(cap_mask & 0x100)) /* 1.2 errata: bit 9 is extended 
> counter support */
>                  IBWARN("PerfMgt ClassPortInfo 0x%x extended counters not 
> indicated\n", cap_mask);
> 
> It seems to be what there are at least 2 problems here:

The good news is it only prints out a warning message and continues on.

> 1. bit 9, if we're counting from 0, will have mask of 0x200,
>    not 0x100. mask of 0x100 will be for counter aggregation according
>    to IBA 1.2.
> 
> 2. If capmask is 16 bit big-endian word, then we're looking
>    at the wrong byte on x86, we must ntohs(*pc2) first.

Here's a patch to fix this for OFED 1.3:

perfquery.c: Fix issue checking PerfMgt:ClassPortInfo.CapabilityMask

1. bit 9, if we're counting from 0, will have mask of 0x200,
   not 0x100. mask of 0x100 will be for counter aggregation according
   to IBA 1.2.

2. If capmask is 16 bit big-endian word, then we're looking
   at the wrong byte on x86, we must ntohs(*pc2) first.

Found-by: Max Matveev <[EMAIL PROTECTED]>

Compile tested only

Signed-off-by: Hal Rosenstock <[EMAIL PROTECTED]>

diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
index 2ae3281..53b3fb3 100644
--- a/infiniband-diags/src/perfquery.c
+++ b/infiniband-diags/src/perfquery.c
@@ -40,8 +40,9 @@
 #include <unistd.h>
 #include <stdarg.h>
 #include <getopt.h>
+#include <netinet/in.h>
 
-#define __BUILD_VERSION_TAG__ 1.2.1
+#define __BUILD_VERSION_TAG__ 1.2.2
 #include <infiniband/common.h>
 #include <infiniband/umad.h>
 #include <infiniband/mad.h>
@@ -202,8 +203,8 @@ main(int argc, char **argv)
        } else {
                /* Should ClassPortInfo be implemented in libibmad ? */
                pc2 = (uint16_t *)&pc[2];       /* CapabilityMask */
-               cap_mask = *pc2;
-               if (!(cap_mask & 0x100)) /* 1.2 errata: bit 9 is extended 
counter support */
+               cap_mask = ntohs(*pc2);
+               if (!(cap_mask & 0x200)) /* 1.2 errata: bit 9 is extended 
counter support */
                        IBWARN("PerfMgt ClassPortInfo 0x%x extended counters 
not indicated\n", cap_mask);
 
                if (!port_performance_ext_query(pc, &portid, port, timeout))

> max
> _______________________________________________
> general mailing list
> [email protected]
> http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general
> 
> To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to