libibumad: implement 'dump' functions
authorshefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Sep 2009 21:22:02 +0000 (21:22 +0000)
committershefty <shefty@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 23 Sep 2009 21:22:02 +0000 (21:22 +0000)
print mad information in 'dump' routines previously left unimplemented

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2457 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

ulp/libibumad/src/umad.cpp

index bf70c42..64aaac1 100644 (file)
@@ -690,11 +690,38 @@ int umad_debug(int level)
 __declspec(dllexport)\r
 void umad_addr_dump(ib_mad_addr_t *addr)\r
 {\r
-       UNREFERENCED_PARAMETER(addr);\r
+       printf("umad_addr:\n");\r
+       printf("\tqpn           0x%x\n", addr->qpn);\r
+       printf("\tqkey          0x%x\n", addr->qkey);\r
+       printf("\tsl            0x%x\n", addr->sl);\r
+       printf("\tlid           0x%x\n", addr->lid);\r
+       printf("\tpkey_index    0x%x\n", addr->pkey_index);\r
+       printf("\tpath_bits     0x%x\n", addr->path_bits);\r
+       printf("\trate          0x%x\n", addr->reserved_rate);\r
+\r
+       printf("\tgrh_present   0x%x\n", addr->grh_present);\r
+       if (addr->grh_present) {\r
+               printf("\tgid_index     0x%x\n", addr->gid_index);\r
+               printf("\tgid           0x%x %x\n",\r
+                       (uint64_t) addr->gid, (uint64_t) (addr->gid + 8));\r
+               printf("\tflow_lable    0x%x\n", addr->flow_label);\r
+               printf("\thop_limit     0x%x\n", addr->hop_limit);\r
+               printf("\ttraffic_class 0x%x\n", addr->qpn);\r
+       }\r
 }\r
 \r
 __declspec(dllexport)\r
 void umad_dump(void *umad)\r
 {\r
-       UNREFERENCED_PARAMETER(umad);\r
+       struct ib_user_mad *mad = (struct ib_user_mad *) umad;\r
+       int i;\r
+\r
+       umad_addr_dump(&mad->addr);\r
+       printf("umad_data\n");\r
+       printf("offset: hex data\n");\r
+       for (i = 0; i < 256; i += 4) {\r
+               printf("%03d: ", i);\r
+               printf("%02x %02x %02x %02x\n", mad->data[i], mad->data[i + 1],\r
+                       mad->data[i + 2], mad->data[i + 3]);\r
+       }\r
 }\r