components/open-fabrics/libibmad/patches/base.patch
author Alex Chiu <Alex.Chiu@Oracle.COM>
Fri, 30 Nov 2012 09:00:34 -0800
changeset 1067 0dc41b42eadb
parent 995 52ebc73c889f
child 1216 bd892ba92960
permissions -rw-r--r--
15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
369
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     1
diff -r -u /tmp/libibmad-1.3.7/Makefile.in libibmad-1.3.7/Makefile.in
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     2
--- /tmp/libibmad-1.3.7/Makefile.in	Wed Feb 16 02:25:43 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     3
+++ libibmad-1.3.7/Makefile.in	Fri Feb 25 03:14:42 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     4
@@ -357,8 +357,8 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     5
 	  else :; fi; \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     6
 	done; \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     7
 	test -z "$$list2" || { \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     8
-	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
     9
-	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    10
+	  echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    11
+	  $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) -m 755 $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    12
 	}
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    13
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    14
 uninstall-libLTLIBRARIES:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    15
diff -r -u /tmp/libibmad-1.3.7/include/infiniband/mad.h libibmad-1.3.7/include/infiniband/mad.h
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    16
--- /tmp/libibmad-1.3.7/include/infiniband/mad.h	Wed Feb 16 02:12:53 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    17
+++ libibmad-1.3.7/include/infiniband/mad.h	Thu Feb 24 11:27:11 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    18
@@ -1036,6 +1036,10 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    19
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    20
 extern MAD_EXPORT int ibdebug;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    21
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    22
+#if !(defined(__SVR4) && defined(__sun))
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    23
+#include <endian.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    24
+#include <byteswap.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    25
+
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    26
 #if __BYTE_ORDER == __LITTLE_ENDIAN
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    27
 #ifndef ntohll
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    28
 static inline uint64_t ntohll(uint64_t x)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    29
@@ -1063,6 +1067,9 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    30
 }
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    31
 #endif
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    32
 #endif				/* __BYTE_ORDER == __BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    33
+#else
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    34
+#include <infiniband/ofa_solaris.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    35
+#endif
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    36
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    37
 /* Misc. macros: */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    38
 /** align value \a l to \a size (ceil) */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    39
@@ -1069,14 +1076,14 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    40
 #define ALIGN(l, size) (((l) + ((size) - 1)) / (size) * (size))
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    41
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    42
 /** printf style warning MACRO, includes name of function and pid */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    43
-#define IBWARN(fmt, ...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    44
+#define IBWARN(fmt, ...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    45
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    46
-#define IBDEBUG(fmt, ...) fprintf(stdout, "ibdebug: [%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    47
+#define IBDEBUG(fmt, ...) fprintf(stdout, "ibdebug: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    48
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    49
-#define IBVERBOSE(fmt, ...) fprintf(stdout, "[%d] %s: " fmt "\n", getpid(), __func__, ## __VA_ARGS__)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    50
+#define IBVERBOSE(fmt, ...) fprintf(stdout, "[%d] %s: " fmt "\n", (int)getpid(), __func__, ## __VA_ARGS__)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    51
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    52
 #define IBPANIC(fmt, ...) do { \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    53
-	fprintf(stderr, "ibpanic: [%d] %s: " fmt ": %m\n", getpid(), __func__, ## __VA_ARGS__); \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    54
+	fprintf(stderr, "ibpanic: [%d] %s: " fmt ": %m\n", (int)getpid(), __func__, ## __VA_ARGS__); \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    55
 	exit(-1); \
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    56
 } while(0)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    57
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    58
diff -r -u /tmp/libibmad-1.3.7/include/infiniband/mad_osd.h libibmad-1.3.7/include/infiniband/mad_osd.h
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    59
--- /tmp/libibmad-1.3.7/include/infiniband/mad_osd.h	Wed Feb 16 02:12:53 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    60
+++ libibmad-1.3.7/include/infiniband/mad_osd.h	Thu Feb 24 11:27:11 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    61
@@ -39,7 +39,9 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    62
 #include <stdio.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    63
 #include <sys/types.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    64
 #include <unistd.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    65
+#if !(defined(__SVR4) && defined(__sun))
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    66
 #include <byteswap.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    67
+#endif
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    68
 #include <inttypes.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    69
 #include <arpa/inet.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    70
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    71
diff -r -u /tmp/libibmad-1.3.7/src/fields.c libibmad-1.3.7/src/fields.c
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    72
--- /tmp/libibmad-1.3.7/src/fields.c	Wed Feb 16 02:12:53 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    73
+++ libibmad-1.3.7/src/fields.c	Thu Feb 24 13:27:00 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    74
@@ -514,7 +514,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    75
 	uint64_t nval;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    76
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    77
 	nval = htonll(val);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    78
-	memcpy((char *)buf + base_offs + f->bitoffs / 8, &nval,
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    79
+	memcpy( (void*)((char *)buf + base_offs + f->bitoffs / 8), (void *)&nval,
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    80
 	       sizeof(uint64_t));
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    81
 }
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    82
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    83
@@ -521,7 +521,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    84
 static uint64_t _get_field64(void *buf, int base_offs, const ib_field_t * f)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    85
 {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    86
 	uint64_t val;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    87
-	memcpy(&val, ((char *)buf + base_offs + f->bitoffs / 8),
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    88
+	memcpy( (void *)&val, (void *)((char *)buf + base_offs + f->bitoffs / 8),
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    89
 	       sizeof(uint64_t));
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    90
 	return ntohll(val);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
    91
 }
984
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    92
diff -r -u /tmp/libibmad-1.3.7/src/mad.c libibmad-1.3.7/src/mad.c
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    93
--- /tmp/libibmad-1.3.7/src/mad.c	Wed Feb 16 02:12:53 2011
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    94
+++ libibmad-1.3.7/src/mad.c	Thu Sep 13 09:31:03 2012
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    95
@@ -61,6 +61,7 @@
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    96
 		trid = random();
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    97
 	}
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    98
 	next = ++trid | (base << 32);
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
    99
+	next &= 0x00ffffffffffffff;
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
   100
 	return next;
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
   101
 }
f34e7c7efa38 7199357 libibmad: encoding VFs in transaction IDs
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 490
diff changeset
   102
 
995
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   103
diff -r -u /tmp/libibmad-1.3.7/src/resolve.c libibmad-1.3.7/src/resolve.c
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   104
--- /tmp/libibmad-1.3.7/src/resolve.c	Wed Feb 16 02:12:53 2011
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   105
+++ libibmad-1.3.7/src/resolve.c	Mon Oct  1 01:32:21 2012
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   106
@@ -40,6 +40,7 @@
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   107
 #include <stdlib.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   108
 #include <string.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   109
 #include <arpa/inet.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   110
+#include <errno.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   111
 
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   112
 #include <infiniband/umad.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   113
 #include <infiniband/mad.h>
1067
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   114
@@ -57,10 +58,18 @@
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   115
 
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   116
 	memset(sm_id, 0, sizeof(*sm_id));
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   117
 
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   118
-	if (!smp_query_via(portinfo, &self, IB_ATTR_PORT_INFO, 0, 0, srcport))
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   119
+	if (!smp_query_via(portinfo, &self, IB_ATTR_PORT_INFO, 0, 0, srcport)) {
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   120
+		if (!errno)
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   121
+			errno = EIO;
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   122
 		return -1;
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   123
+	}
995
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   124
 
1067
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   125
 	mad_decode_field(portinfo, IB_PORT_SMLID_F, &lid);
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   126
+	if (lid == 0) {
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   127
+		if (!errno)
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   128
+			errno = EIO;
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   129
+		return -1;
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   130
+	}
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   131
 	mad_decode_field(portinfo, IB_PORT_SMSL_F, &sm_id->sl);
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   132
 
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   133
 	return ib_portid_set(sm_id, lid, 0, 0);
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   134
@@ -95,7 +104,7 @@
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   135
 			ib_portid_t * sm_id, int timeout,
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   136
 			const struct ibmad_port *srcport)
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   137
 {
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   138
-	ib_portid_t sm_portid;
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   139
+	ib_portid_t sm_portid = { 0 };
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   140
 	uint8_t buf[IB_SA_DATA_SIZE] = { 0 };
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   141
 	ib_portid_t self = { 0 };
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   142
 	uint64_t selfguid, prefix;
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   143
@@ -102,14 +111,19 @@
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   144
 	ibmad_gid_t selfgid;
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   145
 	uint8_t nodeinfo[64];
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   146
 
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   147
-	if (!sm_id) {
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   148
+	if (!sm_id)
995
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   149
 		sm_id = &sm_portid;
1067
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   150
+
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   151
+	if (!sm_id->lid) {
0dc41b42eadb 15819412 SUNBT7201971 libibmad - ib_resolve_smlid_via() returns sm lid as 0
Alex Chiu <Alex.Chiu@Oracle.COM>
parents: 995
diff changeset
   152
 		if (ib_resolve_smlid_via(sm_id, timeout, srcport) < 0)
995
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   153
 			return -1;
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   154
 	}
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   155
 
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   156
-	if (!smp_query_via(nodeinfo, &self, IB_ATTR_NODE_INFO, 0, 0, srcport))
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   157
+	if (!smp_query_via(nodeinfo, &self, IB_ATTR_NODE_INFO, 0, 0, srcport)) {
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   158
+		if (!errno)
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   159
+			errno = EIO;
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   160
 		return -1;
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   161
+	}
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   162
 	mad_decode_field(nodeinfo, IB_NODE_PORT_GUID_F, &selfguid);
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   163
 	mad_set_field64(selfgid, 0, IB_GID_PREFIX_F, IB_DEFAULT_SUBN_PREFIX);
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   164
 	mad_set_field64(selfgid, 0, IB_GID_GUID_F, selfguid);
369
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   165
diff -r -u /tmp/libibmad-1.3.7/src/dump.c libibmad-1.3.7/src/dump.c
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   166
--- /tmp/libibmad-1.3.7/src/dump.c	Wed Feb 16 02:12:53 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   167
+++ libibmad-1.3.7/src/dump.c	Thu Feb 24 11:27:11 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   168
@@ -46,12 +46,24 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   169
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   170
 void mad_dump_int(char *buf, int bufsz, void *val, int valsz)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   171
 {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   172
+	/*
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   173
+	 * the val pointer passed to the dump routines are always 32 bit
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   174
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   175
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   176
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   177
+	 */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   178
 	switch (valsz) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   179
 	case 1:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   180
-		snprintf(buf, bufsz, "%d", *(uint32_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   181
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   182
+		val = ((uint8_t *)val) + 3;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   183
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   184
+		snprintf(buf, bufsz, "%d", *(uint8_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   185
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   186
 	case 2:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   187
-		snprintf(buf, bufsz, "%d", *(uint32_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   188
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   189
+		val = ((uint16_t *)val) + 1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   190
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   191
+		snprintf(buf, bufsz, "%d", *(uint16_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   192
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   193
 	case 3:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   194
 	case 4:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   195
@@ -71,12 +83,24 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   196
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   197
 void mad_dump_uint(char *buf, int bufsz, void *val, int valsz)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   198
 {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   199
+	/*
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   200
+	 * the val pointer passed to the dump routines are always 32 bit
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   201
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   202
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   203
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   204
+	 */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   205
 	switch (valsz) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   206
 	case 1:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   207
-		snprintf(buf, bufsz, "%u", *(uint32_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   208
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   209
+		val = ((uint8_t *)val) + 3;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   210
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   211
+		snprintf(buf, bufsz, "%u", *(uint8_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   212
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   213
 	case 2:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   214
-		snprintf(buf, bufsz, "%u", *(uint32_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   215
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   216
+		val = ((uint16_t *)val) + 1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   217
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   218
+		snprintf(buf, bufsz, "%u", *(uint16_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   219
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   220
 	case 3:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   221
 	case 4:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   222
@@ -96,15 +120,28 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   223
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   224
 void mad_dump_hex(char *buf, int bufsz, void *val, int valsz)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   225
 {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   226
+	/*
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   227
+	 * the val pointer passed to the dump routines are always 32 bit
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   228
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   229
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   230
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   231
+	 */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   232
 	switch (valsz) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   233
 	case 1:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   234
-		snprintf(buf, bufsz, "0x%02x", *(uint32_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   235
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   236
+		val = ((uint8_t *)val) + 3;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   237
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   238
+		snprintf(buf, bufsz, "0x%02x", *(uint8_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   239
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   240
 	case 2:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   241
-		snprintf(buf, bufsz, "0x%04x", *(uint32_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   242
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   243
+		val = ((uint16_t *)val) + 1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   244
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   245
+		snprintf(buf, bufsz, "0x%04x", *(uint16_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   246
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   247
 	case 3:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   248
-		snprintf(buf, bufsz, "0x%06x", *(uint32_t *) val & 0xffffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   249
+		//snprintf(buf, bufsz, "0x%06x", *(uint32_t *) val & 0xffffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   250
+		snprintf(buf, bufsz, "0x%x", *(uint32_t *)val & 0xffffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   251
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   252
 	case 4:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   253
 		snprintf(buf, bufsz, "0x%08x", *(uint32_t *) val);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   254
@@ -132,12 +169,24 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   255
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   256
 void mad_dump_rhex(char *buf, int bufsz, void *val, int valsz)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   257
 {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   258
+	/*
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   259
+	 * the val pointer passed to the dump routines are always 32 bit
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   260
+	 * integers for valsz <= 4 and 64 bit integer for the rest. It is never
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   261
+	 * uint8_t or uint16_t. This is because mad_decode_field always returns
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   262
+	 * the values as 32 bit integer even if they are 8 bit or 16 bit fields.
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   263
+	 */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   264
 	switch (valsz) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   265
 	case 1:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   266
-		snprintf(buf, bufsz, "%02x", *(uint32_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   267
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   268
+		val = ((uint8_t *)val) + 3;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   269
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   270
+		snprintf(buf, bufsz, "%02x", *(uint8_t *) val & 0xff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   271
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   272
 	case 2:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   273
-		snprintf(buf, bufsz, "%04x", *(uint32_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   274
+#if defined(_BIG_ENDIAN)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   275
+		val = ((uint16_t *)val) + 1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   276
+#endif /* _BIG_ENDIAN */
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   277
+		snprintf(buf, bufsz, "%04x", *(uint16_t *) val & 0xffff);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   278
 		break;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   279
 	case 3:
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   280
 		snprintf(buf, bufsz, "%06x", *(uint32_t *) val & 0xffffff);
995
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   281
diff -r -u /tmp/libibmad-1.3.7/src/sa.c libibmad-1.3.7/src/sa.c
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   282
--- /tmp/libibmad-1.3.7/src/sa.c	Wed Feb 16 02:12:53 2011
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   283
+++ libibmad-1.3.7/src/sa.c	Mon Oct  1 01:32:21 2012
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   284
@@ -38,6 +38,7 @@
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   285
 #include <stdio.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   286
 #include <stdlib.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   287
 #include <string.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   288
+#include <errno.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   289
 
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   290
 #include <infiniband/mad.h>
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   291
 #include "mad_internal.h"
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   292
@@ -56,6 +57,7 @@
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   293
 
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   294
 	if (portid->lid <= 0) {
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   295
 		IBWARN("only lid routes are supported");
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   296
+		errno = EIO;
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   297
 		return NULL;
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   298
 	}
52ebc73c889f 7198889 with SRU12.1 all connections to my storage cells are lost
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents: 984
diff changeset
   299
 
369
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   300
diff -r -u /tmp/libibmad-1.3.7/src/rpc.c libibmad-1.3.7/src/rpc.c
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   301
--- /tmp/libibmad-1.3.7/src/rpc.c	Wed Feb 16 02:12:53 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   302
+++ libibmad-1.3.7/src/rpc.c	Thu Feb 24 11:27:14 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   303
@@ -152,7 +152,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   304
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   305
 		length = len;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   306
 		if (umad_send(port_id, agentid, sndbuf, length, timeout, 0) < 0) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   307
-			IBWARN("send failed; %m");
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   308
+			IBWARN("send failed; %s", strerror(errno));
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   309
 			return -1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   310
 		}
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   311
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   312
@@ -161,7 +161,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   313
 		do {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   314
 			length = len;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   315
 			if (umad_recv(port_id, rcvbuf, &length, timeout) < 0) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   316
-				IBWARN("recv failed: %m");
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   317
+				IBWARN("recv failed: %s", strerror(errno));
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   318
 				return -1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   319
 			}
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   320
 
490
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   321
@@ -175,6 +175,7 @@
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   322
 					 IB_MAD_TRID_F) != trid);
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   323
 
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   324
 		status = umad_status(rcvbuf);
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   325
+		errno = status;
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   326
 		if (!status)
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   327
 			return length;	/* done */
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   328
 		if (status == ENOMEM)
20074ee5793e 7078137 libibma _do_madrpc() does not set errno on mad timeout - ref oracle bug 11823643
Boris Chiu <Boris.Chiu@Sun.COM>
parents: 369
diff changeset
   329
@@ -337,7 +338,7 @@
369
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   330
 		IBPANIC("can't init UMAD library");
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   331
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   332
 	if ((fd = umad_open_port(dev_name, dev_port)) < 0)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   333
-		IBPANIC("can't open UMAD port (%s:%d)", dev_name, dev_port);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   334
+		IBPANIC("can't open UMAD port (%s:%d)", dev_name?dev_name:"(nil)", dev_port);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   335
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   336
 	if (num_classes >= MAX_CLASS)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   337
 		IBPANIC("too many classes %d requested", num_classes);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   338
diff -r -u /tmp/libibmad-1.3.7/src/serv.c libibmad-1.3.7/src/serv.c
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   339
--- /tmp/libibmad-1.3.7/src/serv.c	Wed Feb 16 02:12:53 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   340
+++ libibmad-1.3.7/src/serv.c	Thu Feb 24 11:27:14 2011
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   341
@@ -38,6 +38,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   342
 #include <stdio.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   343
 #include <stdlib.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   344
 #include <string.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   345
+#include <errno.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   346
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   347
 #include <infiniband/umad.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   348
 #include <infiniband/mad.h>
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   349
@@ -75,7 +76,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   350
 	if (umad_send(srcport->port_id, srcport->class_agents[rpc->mgtclass],
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   351
 		      umad, IB_MAD_SIZE, mad_get_timeout(srcport, rpc->timeout),
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   352
 		      0) < 0) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   353
-		IBWARN("send failed; %m");
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   354
+		IBWARN("send failed; %s", strerror(errno));
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   355
 		return -1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   356
 	}
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   357
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   358
@@ -157,7 +158,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   359
 	if (umad_send
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   360
 	    (srcport->port_id, srcport->class_agents[rpc.mgtclass], umad,
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   361
 	     IB_MAD_SIZE, mad_get_timeout(srcport, rpc.timeout), 0) < 0) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   362
-		DEBUG("send failed; %m");
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   363
+		DEBUG("send failed; %s", strerror(errno));
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   364
 		return -1;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   365
 	}
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   366
 
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   367
@@ -179,7 +180,7 @@
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   368
 			       mad_get_timeout(srcport, timeout))) < 0) {
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   369
 		if (!umad)
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   370
 			umad_free(mad);
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   371
-		DEBUG("recv failed: %m");
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   372
+		DEBUG("recv failed: %s", strerror(errno));
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   373
 		return 0;
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   374
 	}
cc8c00719da9 PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff changeset
   375