92 static kstat_ctl_t *kc = NULL; /* libkstat cookie */ |
92 static kstat_ctl_t *kc = NULL; /* libkstat cookie */ |
93 static int sol_uverbs_drv_status = SOL_UVERBS_DRV_STATUS_UNKNOWN; |
93 static int sol_uverbs_drv_status = SOL_UVERBS_DRV_STATUS_UNKNOWN; |
94 static int sol_uverbs_minor_dev = -1; |
94 static int sol_uverbs_minor_dev = -1; |
95 |
95 |
96 /* |
96 /* |
97 * Ugly, evil and rest of the names that qualify for it. |
|
98 * This is a side definition for the uverbs hca_info till the |
|
99 * new header file can appear in the userland build environment once that |
|
100 * happens this code will go. |
|
101 */ |
|
102 #if (IB_USER_VERBS_SOLARIS_ABI_VERSION == 2) |
|
103 #undef IB_USER_VERBS_SOLARIS_ABI_VERSION |
|
104 #define IB_USER_VERBS_SOLARIS_ABI_VERSION 3 |
|
105 #define __VERBS_COMPAT_MODE 1 |
|
106 |
|
107 /* |
|
108 * Some useful definitions. |
97 * Some useful definitions. |
109 */ |
98 */ |
110 #define PSID_STR_SZ 40 |
|
111 #define IBDEV_NAME_SZ 64 |
|
112 #define HCA_DRIVER_NAME_SZ 40 |
|
113 #define DEVID_STR_SZ 40 |
|
114 |
|
115 /* |
|
116 * These are duplicate definitions to help the build complete on userland |
|
117 * build machines till the header files are populated with the new versions. |
|
118 * Once the new header file is available in the build system this code will |
|
119 * be removed. |
|
120 */ |
|
121 typedef struct sol_uverbs_hca_infov3_s { |
|
122 char uverbs_hca_psid_string[PSID_STR_SZ]; |
|
123 char uverbs_hca_ibdev_name[IBDEV_NAME_SZ]; |
|
124 char uverbs_hca_driver_name[HCA_DRIVER_NAME_SZ]; |
|
125 uint32_t uverbs_hca_driver_instance; |
|
126 uint32_t uverbs_hca_vendorid; |
|
127 uint16_t uverbs_hca_deviceid; |
|
128 uint16_t uverbs_hca_devidx; |
|
129 int32_t uverbs_hca_abi_version; |
|
130 uint64_t uverbs_hca_fw_ver; |
|
131 uint64_t uverbs_hca_node_guid; |
|
132 uint64_t uverbs_hca_node_external_guid; |
|
133 uint64_t uverbs_hca_sys_image_guid; |
|
134 uint32_t uverbs_hca_hw_version; |
|
135 uint8_t uverbs_hca_pad1[4]; |
|
136 char uverbs_hca_devid_string[DEVID_STR_SZ]; |
|
137 } sol_uverbs_hca_infov3_t; |
|
138 |
|
139 typedef struct sol_uverbs_info_v3_s { |
|
140 int32_t uverbs_abi_version; |
|
141 int32_t uverbs_solaris_abi_version; |
|
142 int16_t uverbs_hca_cnt; |
|
143 int8_t uverbs_pad1[6]; /* Padding for alignment */ |
|
144 sol_uverbs_hca_infov3_t uverbs_hca_info[]; |
|
145 } sol_uverbs_infov3_t; |
|
146 |
|
147 #define SIZEOF_UVERBS_INFO (sizeof (sol_uverbs_infov3_t)) |
|
148 #define SIZEOF_HCA_INFO (sizeof (sol_uverbs_hca_infov3_t)) |
|
149 #define UVERBS_INFO(x) ((sol_uverbs_infov3_t *)x) |
|
150 #define HCA_INFO(x) ((sol_uverbs_hca_infov3_t *)x) |
|
151 |
|
152 #else /* (IB_USER_VERBS_SOLARIS_ABI_VERSION == 3) */ |
|
153 |
|
154 #define SIZEOF_UVERBS_INFO (sizeof (sol_uverbs_info_t)) |
99 #define SIZEOF_UVERBS_INFO (sizeof (sol_uverbs_info_t)) |
155 #define SIZEOF_HCA_INFO (sizeof (sol_uverbs_hca_info_t)) |
100 #define SIZEOF_HCA_INFO (sizeof (sol_uverbs_hca_info_t)) |
156 #define UVERBS_INFO(x) ((sol_uverbs_info_t *)x) |
101 #define UVERBS_INFO(x) ((sol_uverbs_info_t *)x) |
157 #define HCA_INFO(x) ((sol_uverbs_hca_info_t *)x) |
|
158 |
|
159 #endif /* END */ |
|
160 |
102 |
161 /* |
103 /* |
162 * check_path() prefixs |
104 * check_path() prefixs |
163 */ |
105 */ |
164 typedef enum cp_prefix_e { |
106 typedef enum cp_prefix_e { |
324 ibdev_cache_init() |
266 ibdev_cache_init() |
325 { |
267 { |
326 ibdev_cache_info_t *info; |
268 ibdev_cache_info_t *info; |
327 int fd, i, hca_cnt; |
269 int fd, i, hca_cnt; |
328 char uverbs_devpath[MAX_OFS_DEVPATH_LEN]; |
270 char uverbs_devpath[MAX_OFS_DEVPATH_LEN]; |
329 #ifdef __VERBS_COMPAT_MODE |
|
330 sol_uverbs_infov3_t *uverbs_infop; |
|
331 sol_uverbs_hca_infov3_t *hca_infop; |
|
332 #else |
|
333 sol_uverbs_info_t *uverbs_infop; |
271 sol_uverbs_info_t *uverbs_infop; |
334 sol_uverbs_hca_info_t *hca_infop; |
272 sol_uverbs_hca_info_t *hca_infop; |
335 #endif /* END __VERBS_COMPAT_MODE */ |
|
336 char *buf; |
273 char *buf; |
337 size_t bufsize; |
274 size_t bufsize; |
338 uint16_t major, minor, sub_minor; |
275 uint16_t major, minor, sub_minor; |
339 uint64_t raw_fw_ver; |
276 uint64_t raw_fw_ver; |
340 uint64_t guid; |
277 uint64_t guid; |