author | Boris Chiu <boris.chiu@oracle.com> |
Thu, 27 Mar 2014 10:19:43 -0700 | |
changeset 1793 | b253729db1c0 |
parent 900 | 63d3bf696d85 |
child 1934 | 49005740c7f6 |
permissions | -rw-r--r-- |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
1 |
diff -r -u /tmp/libibumad-1.3.7/Makefile.in libibumad-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/libibumad-1.3.7/Makefile.in Mon Feb 14 06:18:00 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
3 |
+++ libibumad-1.3.7/Makefile.in Fri Feb 25 03:11:40 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
4 |
@@ -367,8 +367,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/libibumad-1.3.7/include/infiniband/umad.h libibumad-1.3.7/include/infiniband/umad.h |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
16 |
--- /tmp/libibumad-1.3.7/include/infiniband/umad.h Mon Feb 14 01:08:29 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
17 |
+++ libibumad-1.3.7/include/infiniband/umad.h Fri May 13 04:28:12 2011 |
1793
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
18 |
@@ -45,7 +45,15 @@ |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
19 |
#endif /* __cplusplus */ |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
20 |
|
1793
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
21 |
BEGIN_C_DECLS |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
22 |
-#define UMAD_MAX_DEVICES 32 |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
23 |
+/* To accomodate max. of 16 PCIe slots and 63 VFs per HCA, */ |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
24 |
+/* we define MAX_HCAS = (63VFs + 1PF) * 16HCAs */ |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
25 |
+/* MAX_PORTS = MAX_HCAS * 2ports per HCA */ |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
26 |
+#define MAX_HCAS (64*16) |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
27 |
+#define MAX_PORTS (MAX_HCAS*2) |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
28 |
+#define UMAD_MAX_DEVICES MAX_HCAS |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
29 |
+#define UMAD_MAX_HCAS MAX_HCAS |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
30 |
+#define UMAD_MAX_PORTS MAX_PORTS |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
31 |
+ |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
32 |
#define UMAD_ANY_PORT 0 |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
33 |
typedef struct ib_mad_addr { |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
34 |
uint32_t qpn; |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
35 |
@@ -94,9 +102,13 @@ |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
36 |
#define SYS_IB_MAD_PORT "port" |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
37 |
#define SYS_IB_MAD_DEV "ibdev" |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
38 |
|
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
39 |
-#define UMAD_MAX_PORTS 64 |
b253729db1c0
18117487 saquery -m -t 50000 failed with multiple VFs created
Boris Chiu <boris.chiu@oracle.com>
parents:
900
diff
changeset
|
40 |
+#define UMAD_MAX_PORTS MAX_PORTS |
369
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 |
+#if defined(__SVR4) && defined(__sun) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
43 |
+#define UMAD_DEV_DIR "/dev/infiniband/ofs" |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
44 |
+#else |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
45 |
#define UMAD_DEV_DIR "/dev/infiniband" |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
46 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
47 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
48 |
#define SYS_CA_PORTS_DIR "ports" |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
49 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
50 |
diff -r -u /tmp/libibumad-1.3.7/configure libibumad-1.3.7/configure |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
51 |
--- /tmp/libibumad-1.3.7/configure Mon Feb 14 06:18:01 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
52 |
+++ libibumad-1.3.7/configure Thu Feb 24 11:27:18 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
53 |
@@ -8713,6 +8713,7 @@ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
54 |
;; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
55 |
esac |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
56 |
link_all_deplibs=yes |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
57 |
+ hardcode_libdir_flag_spec= |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
58 |
;; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
59 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
60 |
sunos4*) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
61 |
diff -r -u /tmp/libibumad-1.3.7/src/sysfs.c libibumad-1.3.7/src/sysfs.c |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
62 |
--- /tmp/libibumad-1.3.7/src/sysfs.c Mon Feb 14 01:08:29 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
63 |
+++ libibumad-1.3.7/src/sysfs.c Thu Feb 24 11:27:30 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
64 |
@@ -46,9 +46,14 @@ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
65 |
#include <sys/types.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
66 |
#include <sys/stat.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
67 |
#include <fcntl.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
68 |
+#if !(defined(__SVR4) && defined(__sun)) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
69 |
#include <endian.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
70 |
#include <byteswap.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
71 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
72 |
#include <netinet/in.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
73 |
+#if defined(__SVR4) && defined(__sun) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
74 |
+#include <infiniband/driver.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
75 |
+#endif |
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 |
#if __BYTE_ORDER == __LITTLE_ENDIAN |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
78 |
#define htonll(x) bswap_64(x) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
79 |
@@ -70,6 +75,16 @@ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
80 |
char path[256], *s; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
81 |
int fd, r; |
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 |
+#if defined(__SVR4) && defined(__sun) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
84 |
+ if ((r = ibv_read_sysfs_file(dir_name, file_name, str, max_len)) < 0) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
85 |
+ return -EINVAL; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
86 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
87 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
88 |
+ str[(r < max_len) ? r : max_len - 1] = 0; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
89 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
90 |
+ if ((s = strrchr(str, '\n'))) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
91 |
+ *s = 0; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
92 |
+#else |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
93 |
snprintf(path, sizeof(path), "%s/%s", dir_name, file_name); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
94 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
95 |
if ((fd = open(path, O_RDONLY)) < 0) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
96 |
@@ -88,6 +103,7 @@ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
97 |
*s = 0; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
98 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
99 |
close(fd); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
100 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
101 |
return 0; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
102 |
} |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
103 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
104 |
diff -r -u /tmp/libibumad-1.3.7/src/umad.c libibumad-1.3.7/src/umad.c |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
105 |
--- /tmp/libibumad-1.3.7/src/umad.c Mon Feb 14 01:08:29 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
106 |
+++ libibumad-1.3.7/src/umad.c Fri May 6 05:18:47 2011 |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
107 |
@@ -50,6 +50,10 @@ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
108 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
109 |
#include "umad.h" |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
110 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
111 |
+#if defined(__SVR4) && defined(__sun) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
112 |
+#include <infiniband/verbs.h> |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
113 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
114 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
115 |
#define IB_OPENIB_OUI (0x001405) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
116 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
117 |
#ifdef HAVE_VALGRIND_MEMCHECK_H |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
118 |
@@ -82,7 +86,7 @@ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
119 |
extern int sys_read_uint64(char *dir_name, char *file_name, uint64_t * u); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
120 |
extern int sys_read_uint(char *dir_name, char *file_name, unsigned *u); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
121 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
122 |
-#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", getpid(), __func__, ## args) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
123 |
+#define IBWARN(fmt, args...) fprintf(stderr, "ibwarn: [%d] %s: " fmt "\n", (int)getpid(), __func__, ## args) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
124 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
125 |
#define TRACE if (umaddebug) IBWARN |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
126 |
#define DEBUG if (umaddebug) IBWARN |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
127 |
@@ -126,7 +130,12 @@ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
128 |
return *p ? 0 : 1; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
129 |
} |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
130 |
|
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
131 |
+#if defined(__SVR4) && defined(__sun) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
132 |
+static int get_port(char *ca_name, char *dir, int portnum, |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
133 |
+ struct ibv_context *ctx, umad_port_t * port) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
134 |
+#else |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
135 |
static int get_port(char *ca_name, char *dir, int portnum, umad_port_t * port) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
136 |
+#endif |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
137 |
{ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
138 |
char port_dir[256]; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
139 |
uint8_t gid[16]; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
140 |
@@ -172,6 +181,39 @@ |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
141 |
memcpy(&port->port_guid, gid + 8, sizeof port->port_guid); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
142 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
143 |
snprintf(port_dir + len, sizeof(port_dir) - len, "/pkeys"); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
144 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
145 |
+#if defined(__SVR4) && defined(__sun) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
146 |
+ { |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
147 |
+ struct ibv_port_attr port_attr; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
148 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
149 |
+ if (ibv_query_port(ctx, portnum, &port_attr)) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
150 |
+ IBWARN("Could not query \"%s\" port %d", ca_name, |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
151 |
+ portnum); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
152 |
+ goto clean; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
153 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
154 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
155 |
+ port->pkeys = |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
156 |
+ malloc(sizeof (uint16_t) * port_attr.pkey_tbl_len); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
157 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
158 |
+ if (!port->pkeys) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
159 |
+ IBWARN("Could not retrieve pkeys for \"%s\"", ca_name); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
160 |
+ goto clean; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
161 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
162 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
163 |
+ /* |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
164 |
+ * set high bit of port_num, and try get all pkeys in one go. |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
165 |
+ */ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
166 |
+ portnum |= 0x80; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
167 |
+ num_pkeys = ibv_query_pkey(ctx, portnum, port_attr.pkey_tbl_len, |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
168 |
+ port->pkeys); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
169 |
+ if (num_pkeys != 0) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
170 |
+ IBWARN("get_port: ibv_query_pkey() failed for \"%s\"", |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
171 |
+ ca_name); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
172 |
+ goto clean; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
173 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
174 |
+ port->pkeys_size = port_attr.pkey_tbl_len; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
175 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
176 |
+#else |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
177 |
num_pkeys = scandir(port_dir, &namelist, check_for_digit_name, NULL); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
178 |
if (num_pkeys <= 0) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
179 |
IBWARN("no pkeys found for %s:%u (at dir %s)...", |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
180 |
@@ -193,6 +235,8 @@ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
181 |
port->pkeys_size = num_pkeys; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
182 |
free(namelist); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
183 |
namelist = NULL; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
184 |
+#endif |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
185 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
186 |
port_dir[len] = '\0'; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
187 |
|
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
188 |
/* FIXME: handle gids */ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
189 |
@@ -384,6 +428,7 @@ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
190 |
snprintf(dir_name, sizeof(dir_name), "%s/%s/%s", |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
191 |
SYS_INFINIBAND, ca->ca_name, SYS_CA_PORTS_DIR); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
192 |
|
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
193 |
+#if !(defined(__SVR4) && defined(__sun)) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
194 |
if (!(dir = opendir(dir_name))) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
195 |
return -ENOENT; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
196 |
|
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
197 |
@@ -425,15 +470,91 @@ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
198 |
free(namelist); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
199 |
|
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
200 |
closedir(dir); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
201 |
+#else |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
202 |
+ { |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
203 |
+ struct ibv_device **root_dev_list, **dev_list = NULL; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
204 |
+ struct ibv_context *ctx = NULL; |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
205 |
+ struct ibv_device_attr dev_attr; |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
206 |
+ int num_dev; |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
207 |
+ int ret; |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
208 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
209 |
+ root_dev_list = dev_list = ibv_get_device_list(&num_dev); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
210 |
+ if (!dev_list) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
211 |
+ IBWARN("No HCA devices found"); |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
212 |
+ return -EIO; |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
213 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
214 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
215 |
+ for (i = 0; i < num_dev; i++, dev_list++) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
216 |
+ if (strcmp(ibv_get_device_name(*dev_list), ca_name) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
217 |
+ == 0) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
218 |
+ break; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
219 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
220 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
221 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
222 |
+ if (i == num_dev) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
223 |
+ IBWARN("Could not find \"%s\"", ca_name); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
224 |
+ ibv_free_device_list(root_dev_list); |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
225 |
+ ret = -EIO; |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
226 |
+ goto clean; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
227 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
228 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
229 |
+ if (!(ctx = ibv_open_device(*dev_list))) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
230 |
+ IBWARN("failed to open device \"%s\"", ca_name); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
231 |
+ ibv_free_device_list(root_dev_list); |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
232 |
+ ret = -EIO; |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
233 |
+ goto clean; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
234 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
235 |
+ |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
236 |
+ /* Get port count */ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
237 |
+ memset(&dev_attr, 0, sizeof (struct ibv_device_attr)); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
238 |
+ if (ibv_query_device(ctx, &dev_attr) != 0) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
239 |
+ IBWARN("failed to query device \"%s\"", ca_name); |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
240 |
+ ibv_close_device(ctx); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
241 |
+ ibv_free_device_list(root_dev_list); |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
242 |
+ ret = -EIO; |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
243 |
+ goto clean; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
244 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
245 |
+ |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
246 |
+ ca->numports = 0; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
247 |
+ memset(ca->ports, 0, sizeof ca->ports); |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
248 |
+ |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
249 |
+ for (portnum = 1; portnum <= dev_attr.phys_port_cnt; portnum++) { |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
250 |
+ |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
251 |
+ if (!(ca->ports[portnum] = calloc(1, |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
252 |
+ sizeof(*ca->ports[portnum])))) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
253 |
+ ret = -ENOMEM; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
254 |
+ ibv_close_device(ctx); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
255 |
+ ibv_free_device_list(root_dev_list); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
256 |
+ goto clean; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
257 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
258 |
+ if (get_port(ca_name, dir_name, portnum, ctx, |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
259 |
+ ca->ports[portnum]) < 0) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
260 |
+ free(ca->ports[portnum]); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
261 |
+ ca->ports[portnum] = NULL; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
262 |
+ ret = -EIO; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
263 |
+ ibv_close_device(ctx); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
264 |
+ ibv_free_device_list(root_dev_list); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
265 |
+ goto clean; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
266 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
267 |
+ if (ca->numports < portnum) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
268 |
+ ca->numports = portnum; |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
269 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
270 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
271 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
272 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
273 |
put_ca(ca); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
274 |
return 0; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
275 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
276 |
clean: |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
277 |
+#if !(defined(__SVR4) && defined(__sun)) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
278 |
for (i = 0; i < r; i++) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
279 |
free(namelist[i]); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
280 |
free(namelist); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
281 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
282 |
error: |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
283 |
+#if !(defined(__SVR4) && defined(__sun)) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
284 |
closedir(dir); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
285 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
286 |
release_ca(ca); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
287 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
288 |
return ret; |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
289 |
@@ -484,6 +605,11 @@ |
636
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
290 |
int umad_init(void) |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
291 |
{ |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
292 |
TRACE("umad_init"); |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
293 |
+ struct ibv_device **devlist = ibv_get_device_list(NULL); |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
294 |
+ if (devlist == NULL) { |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
295 |
+ IBWARN("No IB devices found"); |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
296 |
+ return -1; |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
297 |
+ } |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
298 |
if (sys_read_uint(IB_UMAD_ABI_DIR, IB_UMAD_ABI_FILE, &abi_version) < 0) { |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
299 |
IBWARN |
da28b1dc61e7
PSARC 2011/291 EOL Tavor IB HCA driver
Boris Chiu <Boris.Chiu@oracle.COM>
parents:
369
diff
changeset
|
300 |
("can't read ABI version from %s/%s (%m): is ib_umad module loaded?", |
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
301 |
@@ -522,6 +648,28 @@ |
369
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
302 |
|
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
303 |
int umad_get_cas_names(char cas[][UMAD_CA_NAME_LEN], int max) |
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 |
+#if defined(__SVR4) && defined(__sun) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
306 |
+ struct ibv_device **devlist = ibv_get_device_list(NULL); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
307 |
+ int j = 0; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
308 |
+ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
309 |
+ TRACE("max %d", max); |
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 |
+ if (devlist) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
312 |
+ while (devlist[j] && j < max) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
313 |
+ strncpy(cas[j], ibv_get_device_name(devlist[j]), |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
314 |
+ UMAD_CA_NAME_LEN); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
315 |
+ j++; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
316 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
317 |
+ ibv_free_device_list(devlist); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
318 |
+ DEBUG("return %d cas", j); |
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 |
+ if (j == 0 && max > 0) { |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
321 |
+ /* Is this still needed ? */ |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
322 |
+ strncpy((char *)cas, def_ca_name, UMAD_CA_NAME_LEN); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
323 |
+ DEBUG("return 1 ca"); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
324 |
+ j = 1; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
325 |
+ } |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
326 |
+#else |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
327 |
struct dirent **namelist; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
328 |
int n, i, j = 0; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
329 |
|
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
330 |
@@ -547,6 +695,7 @@ |
369
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 (n >= 0) |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
333 |
free(namelist); |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
334 |
+#endif |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
335 |
return j; |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
336 |
} |
cc8c00719da9
PSARC 2011/165 OFUV update of existing components
Boris Chiu <Boris.Chiu@Sun.COM>
parents:
diff
changeset
|
337 |
|
900
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
338 |
@@ -673,7 +822,46 @@ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
339 |
snprintf(dir_name, sizeof(dir_name), "%s/%s/%s", |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
340 |
SYS_INFINIBAND, ca_name, SYS_CA_PORTS_DIR); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
341 |
|
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
342 |
+#if defined(__SVR4) && defined(__sun) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
343 |
+ { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
344 |
+ struct ibv_device **root_dev_list, **dev_list = NULL; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
345 |
+ struct ibv_context *ctx = NULL; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
346 |
+ int num_dev, ret, i; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
347 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
348 |
+ root_dev_list = dev_list = ibv_get_device_list(&num_dev); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
349 |
+ if (!dev_list) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
350 |
+ IBWARN("No HCA devices found"); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
351 |
+ return -EIO; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
352 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
353 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
354 |
+ for (i = 0; i < num_dev; i++, dev_list++) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
355 |
+ if (strcmp(ibv_get_device_name(*dev_list), ca_name) |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
356 |
+ == 0) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
357 |
+ break; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
358 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
359 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
360 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
361 |
+ if (i == num_dev) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
362 |
+ IBWARN("Could not find \"%s\"", ca_name); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
363 |
+ ibv_free_device_list(root_dev_list); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
364 |
+ return -EIO; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
365 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
366 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
367 |
+ if (!(ctx = ibv_open_device(*dev_list))) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
368 |
+ IBWARN("failed to open device \"%s\"", ca_name); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
369 |
+ ibv_free_device_list(root_dev_list); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
370 |
+ return -EIO; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
371 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
372 |
+ |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
373 |
+ if ((ret = get_port(ca_name, dir_name, portnum, ctx, port)) != 0) { |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
374 |
+ ibv_close_device(ctx); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
375 |
+ ibv_free_device_list(root_dev_list); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
376 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
377 |
+ return ret; |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
378 |
+ } |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
379 |
+#else |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
380 |
return get_port(ca_name, dir_name, portnum, port); |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
381 |
+#endif |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
382 |
} |
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
383 |
|
63d3bf696d85
7178014 Some OFED tools print errors with a single port HCA
Sharath M Srinivasan <sharath.srinivasan@oracle.com>
parents:
715
diff
changeset
|
384 |
int umad_release_port(umad_port_t * port) |