1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_IB_IBNEX_IBNEX_DEVCTL_H
27 #define	_SYS_IB_IBNEX_IBNEX_DEVCTL_H
28 
29 #include <sys/ib/ib_types.h>
30 #include <sys/ib/ibtl/ibtl_types.h>
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * This file contains info for devctls issued by IB cfgadm plugin.
38  * The only devctl of interest is DEVCTL_AP_CONTROL which uses
39  * these defines and data structures.
40  */
41 
42 #define	IBNEX_HCAGUID_STRSZ	17
43 
44 /*
45  * types of attachment point Identifiers (APID)s supported
46  */
47 #define	IBNEX_BASE_APID		0x01	/* Base static attachment point */
48 #define	IBNEX_HCA_APID		0x02	/* HCA static attachment point */
49 #define	IBNEX_DYN_APID		0x04	/* Dynamic IOC/DLPI attachment point */
50 #define	IBNEX_UNKNOWN_APID	0x08	/* Unknown attachment point */
51 
52 
53 /* defines for dynamic APID handling */
54 #define	DYN_SEP		"::"
55 #define	GET_DYN(a)	(((a) != NULL) ? strstr((a), DYN_SEP) : (void *)0)
56 
57 #define	IBNEX_FABRIC		"fabric"
58 #define	IBNEX_VPPA_STR		"vppa"
59 #define	IBNEX_PORT_STR		"port"
60 #define	IBNEX_HCASVC_STR	"hca-svc"
61 
62 /* Enums while reading ib.conf file */
63 typedef enum ib_service_type_e {
64 	IB_NAME,		/* name = */
65 	IB_CLASS,		/* class = */
66 	IB_PORT_SERVICE,	/* port-svc-list = */
67 	IB_VPPA_SERVICE,	/* vppa-svc-list = */
68 	IB_HCASVC_SERVICE,	/* hca-svc-list = */
69 	IB_NONE
70 } ib_service_type_t;
71 
72 /*
73  * defines for nvlist types: (for PORT devices and IOCs)
74  * The first 6 are common to both IOC and PORT devices.
75  * The last 9 are used only for IOC devices.
76  */
77 #define	IBNEX_NODE_INFO_NVL		"node_info"
78 #define	IBNEX_NODE_APID_NVL		"node_apid"
79 #define	IBNEX_NODE_TYPE_NVL		"node_type"
80 #define	IBNEX_NODE_RSTATE_NVL		"node_rstate"
81 #define	IBNEX_NODE_OSTATE_NVL		"node_ostate"
82 #define	IBNEX_NODE_COND_NVL		"node_condition"
83 
84 /*
85  * This flag is passed from cfgadm to ib(7d) to convey that it
86  * need not attempt to probe the fabric.
87  *
88  * The value of these flags should be same as flags in enum
89  * ibdm_ibnex_get_ioclist_mtd_t.
90  */
91 #define	IBNEX_DONOT_PROBE_FLAG	1
92 #define	IBNEX_NORMAL_PROBE	0	/* flag used by ib(7d) only */
93 
94 /*
95  * The following are sub-commands to DEVCTL_AP_CONTROL.
96  * NOTE: IBNEX_NUM_DEVICE_NODES and IBNEX_NUM_HCA_NODES need to be
97  * separate. The former is used to figure out the dynamic ap_ids for
98  * the IB fabric. The latter is used for a HCA count on a given host only.
99  */
100 #define	IBNEX_NUM_DEVICE_NODES	0x00010	/* how many device nodes exist? */
101 #define	IBNEX_NUM_HCA_NODES	0x00020	/* how many HCAs exist in the host? */
102 #define	IBNEX_SNAPSHOT_SIZE	0x00040	/* What is the "snapshot" size? */
103 #define	IBNEX_GET_SNAPSHOT	0x00080	/* Get the actual dynamic "snapshot" */
104 #define	IBNEX_DEVICE_PATH_SZ	0x00100	/* Given APID's device path size */
105 #define	IBNEX_GET_DEVICE_PATH	0x00200	/* Get device path for a Dynamic APID */
106 #define	IBNEX_HCA_LIST_SZ	0x00400	/* -x list_clients size for HCA APID */
107 #define	IBNEX_HCA_LIST_INFO	0x00800	/* -x list_clients info for HCA APID */
108 #define	IBNEX_UNCFG_CLNTS_SZ	0x01000	/* -x unconfig_clients option size */
109 #define	IBNEX_UNCFG_CLNTS_INFO	0x02000	/* -x unconfig_clients option data */
110 #define	IBNEX_UPDATE_PKEY_TBLS	0x04000	/* -x update_pkey_tbls */
111 #define	IBNEX_CONF_ENTRY_ADD	0x08000	/* -x conf_file add_service */
112 #define	IBNEX_CONF_ENTRY_DEL	0x10000	/* -x conf_file delete_service */
113 #define	IBNEX_HCA_VERBOSE_SZ	0x20000	/* -alv hca_apid devctl size */
114 #define	IBNEX_HCA_VERBOSE_INFO	0x40000	/* -alv hca_apid devctl data */
115 #define	IBNEX_UPDATE_IOC_CONF	0x80000	/* -x update_ioc_conf */
116 
117 /*
118  * Data structure passed back and forth user/kernel w/ DEVCTL_AP_CONTROL
119  * devctl. Note that these are separate structures as some fields are pointers.
120  */
121 typedef struct ibnex_ioctl_data {
122 	uint_t		cmd;		/* one of the above commands */
123 	caddr_t		buf;		/* data buffer */
124 	uint_t		bufsiz;		/* data buffer size */
125 	caddr_t		ap_id;		/* Search based on this AP_ID name */
126 	uint_t		ap_id_len;	/* AP_ID name len */
127 	uint_t		misc_arg;	/* reserved */
128 } ibnex_ioctl_data_t;
129 
130 
131 /* For 32-bit app/64-bit kernel */
132 typedef struct ibnex_ioctl_data_32 {
133 	uint32_t	cmd;		/* one of the above commands */
134 	caddr32_t	buf;		/* data buffer */
135 	uint32_t	bufsiz;		/* data buffer size */
136 	caddr32_t	ap_id;		/* Search based on this AP_ID name */
137 	uint32_t	ap_id_len;	/* AP_ID name len */
138 	uint32_t	misc_arg;	/* reserved */
139 } ibnex_ioctl_data_32_t;
140 
141 /*
142  * General ibnex IOCTLs
143  *
144  * IBNEX_CTL_GET_API_VER
145  * ======================
146  *
147  * Gets the version number of the API that IB nexus currently supports.
148  *
149  * arg - pointer to a structure of type ibnex_ctl_api_ver_t
150  *
151  * Caller does not set any field of this structure. When this IOCTL is issued,
152  * ib nexus will set api_ver_num field to the currently supported API
153  * version number.
154  *
155  * The caller could issue this IOCTL prior to issuing any other general
156  * ibnex IOCTLs to detect incompatible changes to the API. The caller may
157  * call other IOCTLs only if the api_ver_num matches the API version number
158  * used by the caller.
159  *
160  *
161  * IBNEX_CTL_GET_HCA_LIST
162  * ======================
163  *
164  * Gets GUIDs for all HCAs in the system
165  *
166  * arg - pointer to a structure of type ibnex_ctl_get_hca_list_t
167  *
168  * Caller allocates memory for HCA GUIDs. Sets hca_guids field to point to the
169  * allocated memory. Sets hca_guids_alloc_sz to the number of GUIDs for which
170  * memory has been allocated.
171  *
172  * Upon successful return from the IOCTL, nhcas will contain the number of
173  * HCAs in the system. HCA GUIDs will be copied into hca_guids array.
174  * The number of GUIDs copied are nhcas or hca_guids_alloc_sz which ever is
175  * smaller.
176  *
177  *
178  * IBNEX_CTL_QUERY_HCA
179  * ===================
180  *
181  * Query HCA attributes
182  *
183  * arg - pointer to a structure of type ibnex_ctl_query_hca_t
184  *
185  * Caller sets hca_guid field of this structure.
186  *
187  * Caller allocates memory for hca device path. Sets hca_device_path to point
188  * to the allocated memory and hca_device_path_alloc_sz to the number of bytes
189  * allocated.
190  *
191  * Upon successful return from the IOCTL, hca_info will contain HCA attributes
192  * for the specified GUID. hca_info.hca_device_path_len will contain the actual
193  * string length of the hca device path plus the terminating null character.
194  * hca_info.hca_device_path will point to null terminated hca device path
195  * string if the caller allocated memory for the hca device path is large
196  * enough to hold the hca device path and the terminating null character.
197  * Otherwise hca_info.hca_device_path will be set to NULL.
198  *
199  *
200  * IBNEX_CTL_QUERY_HCA_PORT
201  * ========================
202  *
203  * Query HCA port attributes
204  *
205  * arg - pointer to a structure of type ibnex_ctl_query_hca_port_t
206  *
207  * Caller sets hca_guid and port_num fields.
208  *
209  * Caller allocates memory for sgid entries. Sets sgid_tbl to point to
210  * the allocated memory and sgid_tbl_alloc_sz to the number of sgid entries
211  * for which memory has been allocated.
212  *
213  * Caller allocates memory for pkey entries. Sets pkey_tbl to point to
214  * the allocated memory and pkey_tbl_alloc_sz to the number of pkey entries
215  * for which memory has been allocated.
216  *
217  * Upon successful return from the IOCTL, port_info will contain HCA port
218  * attributes for the specified HCA port. port_info.p_sgid_tbl_sz will contain
219  * the actual number of sgids associated with this port. port_info.p_pkey_tbl_sz
220  * will contain the actual number of pkeys associated with this port.
221  *
222  * port_info.p_sgid_tbl will point to an array containing sgids. The number of
223  * sgids in the array is sgid_tbl_alloc_sz or port_info.p_sgid_tbl_sz
224  * whichever is smaller.
225  *
226  * port_info.p_pkey_tbl will point to an array containing pkeys. The number of
227  * pkeys in the array is pkey_tbl_alloc_sz or port_info.p_pkey_tbl_sz
228  * whichever is smaller.
229  */
230 
231 
232 /*
233  * ibnex specific ioctls
234  *
235  * NOTE: The ioctl codes should not collide with generic devctl ioctls
236  * such as DEVCTL_AP_CONFIGURE.
237  */
238 #define	IBNEX_IOC		(1 << 16)
239 #define	IBNEX_CTL_GET_API_VER	(IBNEX_IOC + 1)	/* Get API version # */
240 #define	IBNEX_CTL_GET_HCA_LIST	(IBNEX_IOC + 2)	/* Get HCA GUID list */
241 #define	IBNEX_CTL_QUERY_HCA	(IBNEX_IOC + 3)	/* Query HCA attributes */
242 #define	IBNEX_CTL_QUERY_HCA_PORT (IBNEX_IOC + 4) /* Query HCA port attributes */
243 
244 /*
245  * The device to open for issuing ibnex IOCTLs
246  */
247 #define	IBNEX_DEVCTL_DEV		"/devices/ib:devctl"
248 
249 /*
250  * ibnex IOCTL API version number - to be incremented when making an
251  * incompatible change to the API.
252  */
253 #define	IBNEX_CTL_API_VERSION		1
254 
255 #define	MAX_HCA_DRVNAME_LEN		16
256 
257 /*
258  * Data structure for IBNEX_CTL_GET_API_VER
259  */
260 typedef struct ibnex_ctl_api_ver_s {
261 	uint_t		api_ver_num;		/* out: supported API version */
262 } ibnex_ctl_api_ver_t;
263 
264 /*
265  * Data structure for IBNEX_CTL_GET_HCA_LIST
266  */
267 typedef struct ibnex_ctl_get_hca_list_s {
268 	ib_guid_t	*hca_guids;		/* in/out: HCA GUID array */
269 	uint_t		hca_guids_alloc_sz;	/* in: # of HCA GUIDs for */
270 						/* which storage is allocated */
271 	uint_t		nhcas;			/* out: actual number of HCAs */
272 } ibnex_ctl_get_hca_list_t;
273 
274 typedef struct ibnex_ctl_get_hca_list_32_s {
275 	caddr32_t	hca_guids;		/* in/out: HCA GUID array */
276 	uint_t		hca_guids_alloc_sz;	/* in: # of HCA GUIDs for */
277 						/* which storage is allocated */
278 	uint_t		nhcas;			/* out: actual number of HCAs */
279 } ibnex_ctl_get_hca_list_32_t;
280 
281 /*
282  * HCA information structure
283  */
284 typedef struct ibnex_ctl_hca_info_s {
285 	ib_guid_t	hca_node_guid;		/* Node GUID */
286 	ib_guid_t	hca_si_guid;		/* Optional System Image GUID */
287 	uint_t		hca_nports;		/* Number of physical ports */
288 
289 	/* HCA driver name and instance number */
290 	char		hca_driver_name[MAX_HCA_DRVNAME_LEN];
291 	int		hca_driver_instance;
292 
293 	/*
294 	 * hca device path and the length.
295 	 * hca_device_path_len is string length of the actual hca device path
296 	 * plus the terminating null character.
297 	 */
298 	char		*hca_device_path;
299 	uint_t		hca_device_path_len;
300 
301 	ibt_hca_flags_t		hca_flags;	/* HCA capabilities etc */
302 	ibt_hca_flags2_t	hca_flags2;	/* HCA capabilities etc */
303 
304 	uint32_t	hca_vendor_id;		/* Vendor ID */
305 	uint16_t	hca_device_id;		/* Device ID */
306 	uint32_t	hca_version_id;		/* Version ID */
307 
308 	uint_t		hca_max_chans;		/* Max channels supported */
309 	uint_t		hca_max_chan_sz;	/* Max outstanding WRs on any */
310 						/* channel */
311 
312 	uint_t		hca_max_sgl;		/* Max SGL entries per WR */
313 
314 	uint_t		hca_max_cq;		/* Max num of CQs supported  */
315 	uint_t		hca_max_cq_sz;		/* Max capacity of each CQ */
316 
317 	ibt_page_sizes_t	hca_page_sz;	/* Bit mask of page sizes */
318 
319 	uint_t		hca_max_memr;		/* Max num of HCA mem regions */
320 	ib_memlen_t	hca_max_memr_len;	/* Largest block, in bytes of */
321 						/* mem that can be registered */
322 	uint_t		hca_max_mem_win;	/* Max Memory windows in HCA */
323 
324 	uint_t		hca_max_rsc; 		/* Max Responder Resources of */
325 						/* this HCA for RDMAR/Atomics */
326 						/* with this HCA as target. */
327 	uint8_t		hca_max_rdma_in_chan;	/* Max RDMAR/Atomics in per */
328 						/* chan this HCA as target. */
329 	uint8_t		hca_max_rdma_out_chan;	/* Max RDMA Reads/Atomics out */
330 						/* per channel by this HCA */
331 	uint_t		hca_max_ipv6_chan;	/* Max IPV6 channels in HCA */
332 	uint_t		hca_max_ether_chan;	/* Max Ether channels in HCA */
333 
334 	uint_t		hca_max_mcg_chans;	/* Max number of channels */
335 						/* that can join multicast */
336 						/* groups */
337 	uint_t		hca_max_mcg;		/* Max multicast groups */
338 	uint_t		hca_max_chan_per_mcg;	/* Max number of channels per */
339 						/* Multicast group in HCA */
340 	uint16_t	hca_max_partitions;	/* Max partitions in HCA */
341 
342 	ib_time_t	hca_local_ack_delay;
343 
344 	uint_t		hca_max_port_sgid_tbl_sz;
345 	uint16_t	hca_max_port_pkey_tbl_sz;
346 	uint_t		hca_max_pd;		/* Max# of Protection Domains */
347 
348 	uint_t		hca_max_ud_dest;
349 	uint_t		hca_max_srqs;		/* Max SRQs supported */
350 	uint_t		hca_max_srqs_sz;	/* Max outstanding WRs on any */
351 						/* SRQ */
352 	uint_t		hca_max_srq_sgl;	/* Max SGL entries per SRQ WR */
353 	uint_t		hca_max_cq_handlers;
354 	ibt_lkey_t	hca_reserved_lkey;	/* Reserved L_Key value */
355 	uint_t		hca_max_fmrs;		/* Max FMR Supported */
356 
357 	uint_t		hca_max_lso_size;
358 	uint_t		hca_max_lso_hdr_size;
359 	uint_t		hca_max_inline_size;
360 
361 	uint_t		hca_max_cq_mod_count;	/* CQ notify moderation */
362 	uint_t		hca_max_cq_mod_usec;
363 
364 	uint32_t	hca_fw_major_version;	/* firmware version */
365 	uint16_t	hca_fw_minor_version;
366 	uint16_t	hca_fw_micro_version;
367 
368 	/* detailed WQE size info */
369 	uint_t		hca_ud_send_inline_sz;	/* inline size in bytes */
370 	uint_t		hca_conn_send_inline_sz;
371 	uint_t		hca_conn_rdmaw_inline_overhead;
372 	uint_t		hca_recv_sgl_sz;	/* detailed SGL sizes */
373 	uint_t		hca_ud_send_sgl_sz;
374 	uint_t		hca_conn_send_sgl_sz;
375 	uint_t		hca_conn_rdma_sgl_overhead;
376 	int32_t		hca_pad;
377 } ibnex_ctl_hca_info_t;
378 
379 typedef struct ibnex_ctl_hca_info_32_s {
380 	ib_guid_t	hca_node_guid;		/* Node GUID */
381 	ib_guid_t	hca_si_guid;		/* Optional System Image GUID */
382 	uint_t		hca_nports;		/* Number of physical ports */
383 
384 	/* HCA driver name and instance number */
385 	char		hca_driver_name[MAX_HCA_DRVNAME_LEN];
386 	int		hca_driver_instance;
387 
388 	/*
389 	 * hca device path and the length.
390 	 * hca_device_path_len is string length of the actual hca device path
391 	 * plus the terminating null character.
392 	 */
393 	caddr32_t	hca_device_path;
394 	uint_t		hca_device_path_len;
395 
396 	ibt_hca_flags_t		hca_flags;	/* HCA capabilities etc */
397 	ibt_hca_flags2_t	hca_flags2;	/* HCA capabilities etc */
398 
399 	uint32_t	hca_vendor_id;		/* Vendor ID */
400 	uint16_t	hca_device_id;		/* Device ID */
401 	uint32_t	hca_version_id;		/* Version ID */
402 
403 	uint_t		hca_max_chans;		/* Max channels supported */
404 	uint_t		hca_max_chan_sz;	/* Max outstanding WRs on any */
405 						/* channel */
406 
407 	uint_t		hca_max_sgl;		/* Max SGL entries per WR */
408 
409 	uint_t		hca_max_cq;		/* Max num of CQs supported  */
410 	uint_t		hca_max_cq_sz;		/* Max capacity of each CQ */
411 
412 	ibt_page_sizes_t	hca_page_sz;	/* Bit mask of page sizes */
413 
414 	uint_t		hca_max_memr;		/* Max num of HCA mem regions */
415 	ib_memlen_t	hca_max_memr_len;	/* Largest block, in bytes of */
416 						/* mem that can be registered */
417 	uint_t		hca_max_mem_win;	/* Max Memory windows in HCA */
418 
419 	uint_t		hca_max_rsc; 		/* Max Responder Resources of */
420 						/* this HCA for RDMAR/Atomics */
421 						/* with this HCA as target. */
422 	uint8_t		hca_max_rdma_in_chan;	/* Max RDMAR/Atomics in per */
423 						/* chan this HCA as target. */
424 	uint8_t		hca_max_rdma_out_chan;	/* Max RDMA Reads/Atomics out */
425 						/* per channel by this HCA */
426 	uint_t		hca_max_ipv6_chan;	/* Max IPV6 channels in HCA */
427 	uint_t		hca_max_ether_chan;	/* Max Ether channels in HCA */
428 
429 	uint_t		hca_max_mcg_chans;	/* Max number of channels */
430 						/* that can join multicast */
431 						/* groups */
432 	uint_t		hca_max_mcg;		/* Max multicast groups */
433 	uint_t		hca_max_chan_per_mcg;	/* Max number of channels per */
434 						/* Multicast group in HCA */
435 	uint16_t	hca_max_partitions;	/* Max partitions in HCA */
436 
437 	ib_time_t	hca_local_ack_delay;
438 
439 	uint_t		hca_max_port_sgid_tbl_sz;
440 	uint16_t	hca_max_port_pkey_tbl_sz;
441 	uint_t		hca_max_pd;		/* Max# of Protection Domains */
442 
443 	uint_t		hca_max_ud_dest;
444 	uint_t		hca_max_srqs;		/* Max SRQs supported */
445 	uint_t		hca_max_srqs_sz;	/* Max outstanding WRs on any */
446 						/* SRQ */
447 	uint_t		hca_max_srq_sgl;	/* Max SGL entries per SRQ WR */
448 	uint_t		hca_max_cq_handlers;
449 	ibt_lkey_t	hca_reserved_lkey;	/* Reserved L_Key value */
450 	uint_t		hca_max_fmrs;		/* Max FMR Supported */
451 
452 	uint_t		hca_max_lso_size;
453 	uint_t		hca_max_lso_hdr_size;
454 	uint_t		hca_max_inline_size;
455 
456 	uint_t		hca_max_cq_mod_count;	/* CQ notify moderation */
457 	uint_t		hca_max_cq_mod_usec;
458 
459 	uint32_t	hca_fw_major_version;	/* firmware version */
460 	uint16_t	hca_fw_minor_version;
461 	uint16_t	hca_fw_micro_version;
462 
463 	/* detailed WQE size info */
464 	uint_t		hca_ud_send_inline_sz;	/* inline size in bytes */
465 	uint_t		hca_conn_send_inline_sz;
466 	uint_t		hca_conn_rdmaw_inline_overhead;
467 	uint_t		hca_recv_sgl_sz;	/* detailed SGL sizes */
468 	uint_t		hca_ud_send_sgl_sz;
469 	uint_t		hca_conn_send_sgl_sz;
470 	uint_t		hca_conn_rdma_sgl_overhead;
471 	int32_t		hca_pad;
472 } ibnex_ctl_hca_info_32_t;
473 
474 /*
475  * Data structure for IBNEX_CTL_QUERY_HCA
476  */
477 typedef struct ibnex_ctl_query_hca_s {
478 	ib_guid_t	hca_guid;	/* in: HCA GUID */
479 
480 	/*
481 	 * in: user allocated memory pointer for hca device path and number of
482 	 * bytes allocated for the hca device path.
483 	 */
484 	char		*hca_device_path;
485 	uint_t		hca_device_path_alloc_sz;
486 
487 	ibnex_ctl_hca_info_t	hca_info;	/* out: HCA information */
488 } ibnex_ctl_query_hca_t;
489 
490 typedef struct ibnex_ctl_query_hca_32_s {
491 	ib_guid_t	hca_guid;	/* in: HCA GUID */
492 
493 	/*
494 	 * in: user allocated memory pointer for hca device path and number of
495 	 * bytes allocated for the hca device path.
496 	 */
497 	caddr32_t	hca_device_path;
498 	uint_t		hca_device_path_alloc_sz;
499 
500 	ibnex_ctl_hca_info_32_t	hca_info;	/* out: HCA information */
501 } ibnex_ctl_query_hca_32_t;
502 
503 /*
504  * HCA port information structure
505  */
506 typedef struct ibnex_ctl_hca_port_info_s {
507 	ib_lid_t		p_lid;		/* Base LID of port */
508 	ib_qkey_cntr_t		p_qkey_violations; /* Bad Q_Key cnt */
509 	ib_pkey_cntr_t		p_pkey_violations; /* Optional bad P_Key cnt */
510 	uint8_t			p_sm_sl;	/* SM Service level */
511 	ib_port_phys_state_t	p_phys_state;
512 	ib_lid_t		p_sm_lid;	/* SM LID */
513 	ibt_port_state_t	p_linkstate;	/* Port state */
514 	uint8_t			p_port_num;	/* Port number */
515 
516 	ib_link_width_t		p_width_supported;
517 	ib_link_width_t		p_width_enabled;
518 	ib_link_width_t		p_width_active;
519 
520 	ib_mtu_t		p_mtu;		/* Max transfer unit - pkt */
521 	uint8_t			p_lmc;		/* LID mask control */
522 
523 	ib_link_speed_t		p_speed_supported;
524 	ib_link_speed_t		p_speed_enabled;
525 	ib_link_speed_t		p_speed_active;
526 
527 	ib_gid_t		*p_sgid_tbl;	/* SGID Table */
528 	uint_t			p_sgid_tbl_sz;	/* # of entries in SGID table */
529 
530 	ib_pkey_t		*p_pkey_tbl;	/* P_Key table */
531 	uint16_t		p_pkey_tbl_sz;	/* # of entries in P_Key tbl */
532 	uint16_t		p_def_pkey_ix;	/* default pkey index for TI */
533 
534 	uint8_t			p_max_vl;	/* Max num of virtual lanes */
535 	uint8_t			p_init_type_reply; /* Optional InitTypeReply */
536 	ib_time_t		p_subnet_timeout; /* Max Subnet Timeout */
537 	ibt_port_caps_t		p_capabilities;	/* Port Capabilities */
538 	uint32_t		p_msg_sz;	/* Max message size */
539 } ibnex_ctl_hca_port_info_t;
540 
541 typedef struct ibnex_ctl_hca_port_info_32_s {
542 	ib_lid_t		p_lid;		/* Base LID of port */
543 	ib_qkey_cntr_t		p_qkey_violations; /* Bad Q_Key cnt */
544 	ib_pkey_cntr_t		p_pkey_violations; /* Optional bad P_Key cnt */
545 	uint8_t			p_sm_sl;	/* SM Service level */
546 	ib_port_phys_state_t	p_phys_state;
547 	ib_lid_t		p_sm_lid;	/* SM LID */
548 	ibt_port_state_t	p_linkstate;	/* Port state */
549 	uint8_t			p_port_num;	/* Port number */
550 
551 	ib_link_width_t		p_width_supported;
552 	ib_link_width_t		p_width_enabled;
553 	ib_link_width_t		p_width_active;
554 
555 	ib_mtu_t		p_mtu;		/* Max transfer unit - pkt */
556 	uint8_t			p_lmc;		/* LID mask control */
557 
558 	ib_link_speed_t		p_speed_supported;
559 	ib_link_speed_t		p_speed_enabled;
560 	ib_link_speed_t		p_speed_active;
561 
562 	caddr32_t		p_sgid_tbl;	/* SGID Table */
563 	uint_t			p_sgid_tbl_sz;	/* # of entries in SGID table */
564 
565 	caddr32_t		p_pkey_tbl;	/* P_Key table */
566 	uint16_t		p_pkey_tbl_sz;	/* # of entries in P_Key tbl */
567 	uint16_t		p_def_pkey_ix;	/* default pkey index for TI */
568 
569 	uint8_t			p_max_vl;	/* Max num of virtual lanes */
570 	uint8_t			p_init_type_reply; /* Optional InitTypeReply */
571 	ib_time_t		p_subnet_timeout; /* Max Subnet Timeout */
572 	ibt_port_caps_t		p_capabilities;	/* Port Capabilities */
573 	uint32_t		p_msg_sz;	/* Max message size */
574 } ibnex_ctl_hca_port_info_32_t;
575 
576 /*
577  * Data structure for IBNEX_CTL_QUERY_HCA_PORT
578  */
579 typedef struct ibnex_ctl_query_hca_port_s {
580 	ib_guid_t	hca_guid;		/* in: HCA GUID */
581 	uint_t		port_num;		/* in: port number */
582 
583 	ib_gid_t	*sgid_tbl;		/* in: SGID Table */
584 	uint_t		sgid_tbl_alloc_sz; /* in: # of entries in SGID table */
585 
586 	ib_pkey_t	*pkey_tbl;		/* in: P_Key table */
587 	uint_t		pkey_tbl_alloc_sz; /* in: # of entries in P_Key table */
588 
589 	uint32_t	pad;
590 	ibnex_ctl_hca_port_info_t port_info;	/* out: port information */
591 } ibnex_ctl_query_hca_port_t;
592 
593 typedef struct ibnex_ctl_query_hca_port_32_s {
594 	ib_guid_t	hca_guid;		/* in: HCA GUID */
595 	uint_t		port_num;		/* in: port number */
596 
597 	caddr32_t	sgid_tbl;		/* in: SGID Table */
598 	uint_t		sgid_tbl_alloc_sz; /* in: # of entries in SGID table */
599 
600 	caddr32_t	pkey_tbl;		/* in: P_Key table */
601 	uint_t		pkey_tbl_alloc_sz; /* in: # of entries in P_Key table */
602 
603 	uint32_t	pad;
604 	ibnex_ctl_hca_port_info_32_t port_info;	/* out: port information */
605 } ibnex_ctl_query_hca_port_32_t;
606 
607 #ifdef _KERNEL
608 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_hca_info_s))
609 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_hca_port_info_s))
610 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_hca_port_info_32_s))
611 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_query_hca_port_s))
612 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_query_hca_port_32_s))
613 #endif
614 
615 
616 #ifdef __cplusplus
617 }
618 #endif
619 
620 #endif	/* _SYS_IB_IBNEX_IBNEX_DEVCTL_H */
621