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(4D) 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(4D) 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 of 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 one (for the terminating null
194  * character). hca_info.hca_device_path will point to null terminated hca device
195  * path 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  * Error numbers for the above ioctls upon failure:
231  *   EINVAL	Invalid parameter passed
232  *   EFAULT	A fault occurred copying data to or from the user space
233  *		to the kernel space.
234  *   ENXIO	Specified HCA GUID does not exist
235  *   ENOENT	Specified HCA port does not exist
236  *
237  */
238 
239 
240 /*
241  * ibnex specific ioctls
242  *
243  * NOTE: The ioctl codes should not collide with generic devctl ioctls
244  * such as DEVCTL_AP_CONFIGURE.
245  */
246 #define	IBNEX_IOC		(1 << 16)
247 #define	IBNEX_CTL_GET_API_VER	(IBNEX_IOC + 1)	/* Get API version # */
248 #define	IBNEX_CTL_GET_HCA_LIST	(IBNEX_IOC + 2)	/* Get HCA GUID list */
249 #define	IBNEX_CTL_QUERY_HCA	(IBNEX_IOC + 3)	/* Query HCA attributes */
250 #define	IBNEX_CTL_QUERY_HCA_PORT (IBNEX_IOC + 4) /* Query HCA port attributes */
251 
252 /*
253  * The device to open for issuing ibnex IOCTLs
254  */
255 #define	IBNEX_DEVCTL_DEV		"/devices/ib:devctl"
256 
257 /*
258  * ibnex IOCTL API version number - to be incremented when making an
259  * incompatible change to the API.
260  */
261 #define	IBNEX_CTL_API_VERSION		1
262 
263 #define	MAX_HCA_DRVNAME_LEN		16
264 
265 /*
266  * Data structure for IBNEX_CTL_GET_API_VER
267  */
268 typedef struct ibnex_ctl_api_ver_s {
269 	uint_t		api_ver_num;		/* out: supported API version */
270 } ibnex_ctl_api_ver_t;
271 
272 /*
273  * Data structure for IBNEX_CTL_GET_HCA_LIST
274  */
275 typedef struct ibnex_ctl_get_hca_list_s {
276 	ib_guid_t	*hca_guids;		/* in/out: HCA GUID array */
277 	uint_t		hca_guids_alloc_sz;	/* in: # of HCA GUIDs for */
278 						/* which storage is allocated */
279 	uint_t		nhcas;			/* out: actual number of HCAs */
280 } ibnex_ctl_get_hca_list_t;
281 
282 typedef struct ibnex_ctl_get_hca_list_32_s {
283 	caddr32_t	hca_guids;		/* in/out: HCA GUID array */
284 	uint_t		hca_guids_alloc_sz;	/* in: # of HCA GUIDs for */
285 						/* which storage is allocated */
286 	uint_t		nhcas;			/* out: actual number of HCAs */
287 } ibnex_ctl_get_hca_list_32_t;
288 
289 /*
290  * HCA information structure
291  */
292 typedef struct ibnex_ctl_hca_info_s {
293 	ib_guid_t	hca_node_guid;		/* Node GUID */
294 	ib_guid_t	hca_si_guid;		/* Optional System Image GUID */
295 	uint_t		hca_nports;		/* Number of physical ports */
296 
297 	/* HCA driver name and instance number */
298 	char		hca_driver_name[MAX_HCA_DRVNAME_LEN];
299 	int		hca_driver_instance;
300 
301 	/*
302 	 * hca device path and the length.
303 	 * hca_device_path_len contains the string length of the actual hca
304 	 * device path plus one (for the terminating null character).
305 	 */
306 	char		*hca_device_path;
307 	uint_t		hca_device_path_len;
308 
309 	ibt_hca_flags_t		hca_flags;	/* HCA capabilities etc */
310 	ibt_hca_flags2_t	hca_flags2;	/* HCA capabilities etc */
311 
312 	uint32_t	hca_vendor_id;		/* Vendor ID */
313 	uint16_t	hca_device_id;		/* Device ID */
314 	uint32_t	hca_version_id;		/* Version ID */
315 
316 	uint_t		hca_max_chans;		/* Max channels supported */
317 	uint_t		hca_max_chan_sz;	/* Max outstanding WRs on any */
318 						/* channel */
319 
320 	uint_t		hca_max_sgl;		/* Max SGL entries per WR */
321 
322 	uint_t		hca_max_cq;		/* Max num of CQs supported  */
323 	uint_t		hca_max_cq_sz;		/* Max capacity of each CQ */
324 
325 	ibt_page_sizes_t	hca_page_sz;	/* Bit mask of page sizes */
326 
327 	uint_t		hca_max_memr;		/* Max num of HCA mem regions */
328 	ib_memlen_t	hca_max_memr_len;	/* Largest block, in bytes of */
329 						/* mem that can be registered */
330 	uint_t		hca_max_mem_win;	/* Max Memory windows in HCA */
331 
332 	uint_t		hca_max_rsc; 		/* Max Responder Resources of */
333 						/* this HCA for RDMAR/Atomics */
334 						/* with this HCA as target. */
335 	uint8_t		hca_max_rdma_in_chan;	/* Max RDMAR/Atomics in per */
336 						/* chan this HCA as target. */
337 	uint8_t		hca_max_rdma_out_chan;	/* Max RDMA Reads/Atomics out */
338 						/* per channel by this HCA */
339 	uint_t		hca_max_ipv6_chan;	/* Max IPV6 channels in HCA */
340 	uint_t		hca_max_ether_chan;	/* Max Ether channels in HCA */
341 
342 	uint_t		hca_max_mcg_chans;	/* Max number of channels */
343 						/* that can join multicast */
344 						/* groups */
345 	uint_t		hca_max_mcg;		/* Max multicast groups */
346 	uint_t		hca_max_chan_per_mcg;	/* Max number of channels per */
347 						/* Multicast group in HCA */
348 	uint16_t	hca_max_partitions;	/* Max partitions in HCA */
349 
350 	ib_time_t	hca_local_ack_delay;
351 
352 	uint_t		hca_max_port_sgid_tbl_sz;
353 	uint16_t	hca_max_port_pkey_tbl_sz;
354 	uint_t		hca_max_pd;		/* Max# of Protection Domains */
355 
356 	uint_t		hca_max_ud_dest;
357 	uint_t		hca_max_srqs;		/* Max SRQs supported */
358 	uint_t		hca_max_srqs_sz;	/* Max outstanding WRs on any */
359 						/* SRQ */
360 	uint_t		hca_max_srq_sgl;	/* Max SGL entries per SRQ WR */
361 	uint_t		hca_max_cq_handlers;
362 	ibt_lkey_t	hca_reserved_lkey;	/* Reserved L_Key value */
363 	uint_t		hca_max_fmrs;		/* Max FMR Supported */
364 
365 	uint_t		hca_max_lso_size;
366 	uint_t		hca_max_lso_hdr_size;
367 	uint_t		hca_max_inline_size;
368 
369 	uint_t		hca_max_cq_mod_count;	/* CQ notify moderation */
370 	uint_t		hca_max_cq_mod_usec;
371 
372 	uint32_t	hca_fw_major_version;	/* firmware version */
373 	uint16_t	hca_fw_minor_version;
374 	uint16_t	hca_fw_micro_version;
375 
376 	/* detailed WQE size info */
377 	uint_t		hca_ud_send_inline_sz;	/* inline size in bytes */
378 	uint_t		hca_conn_send_inline_sz;
379 	uint_t		hca_conn_rdmaw_inline_overhead;
380 	uint_t		hca_recv_sgl_sz;	/* detailed SGL sizes */
381 	uint_t		hca_ud_send_sgl_sz;
382 	uint_t		hca_conn_send_sgl_sz;
383 	uint_t		hca_conn_rdma_sgl_overhead;
384 	int32_t		hca_pad;
385 } ibnex_ctl_hca_info_t;
386 
387 typedef struct ibnex_ctl_hca_info_32_s {
388 	ib_guid_t	hca_node_guid;		/* Node GUID */
389 	ib_guid_t	hca_si_guid;		/* Optional System Image GUID */
390 	uint_t		hca_nports;		/* Number of physical ports */
391 
392 	/* HCA driver name and instance number */
393 	char		hca_driver_name[MAX_HCA_DRVNAME_LEN];
394 	int		hca_driver_instance;
395 
396 	/*
397 	 * hca device path and the length.
398 	 * hca_device_path_len contains the string length of the actual hca
399 	 * device path plus one (for the terminating null character).
400 	 */
401 	caddr32_t	hca_device_path;
402 	uint_t		hca_device_path_len;
403 
404 	ibt_hca_flags_t		hca_flags;	/* HCA capabilities etc */
405 	ibt_hca_flags2_t	hca_flags2;	/* HCA capabilities etc */
406 
407 	uint32_t	hca_vendor_id;		/* Vendor ID */
408 	uint16_t	hca_device_id;		/* Device ID */
409 	uint32_t	hca_version_id;		/* Version ID */
410 
411 	uint_t		hca_max_chans;		/* Max channels supported */
412 	uint_t		hca_max_chan_sz;	/* Max outstanding WRs on any */
413 						/* channel */
414 
415 	uint_t		hca_max_sgl;		/* Max SGL entries per WR */
416 
417 	uint_t		hca_max_cq;		/* Max num of CQs supported  */
418 	uint_t		hca_max_cq_sz;		/* Max capacity of each CQ */
419 
420 	ibt_page_sizes_t	hca_page_sz;	/* Bit mask of page sizes */
421 
422 	uint_t		hca_max_memr;		/* Max num of HCA mem regions */
423 	ib_memlen_t	hca_max_memr_len;	/* Largest block, in bytes of */
424 						/* mem that can be registered */
425 	uint_t		hca_max_mem_win;	/* Max Memory windows in HCA */
426 
427 	uint_t		hca_max_rsc; 		/* Max Responder Resources of */
428 						/* this HCA for RDMAR/Atomics */
429 						/* with this HCA as target. */
430 	uint8_t		hca_max_rdma_in_chan;	/* Max RDMAR/Atomics in per */
431 						/* chan this HCA as target. */
432 	uint8_t		hca_max_rdma_out_chan;	/* Max RDMA Reads/Atomics out */
433 						/* per channel by this HCA */
434 	uint_t		hca_max_ipv6_chan;	/* Max IPV6 channels in HCA */
435 	uint_t		hca_max_ether_chan;	/* Max Ether channels in HCA */
436 
437 	uint_t		hca_max_mcg_chans;	/* Max number of channels */
438 						/* that can join multicast */
439 						/* groups */
440 	uint_t		hca_max_mcg;		/* Max multicast groups */
441 	uint_t		hca_max_chan_per_mcg;	/* Max number of channels per */
442 						/* Multicast group in HCA */
443 	uint16_t	hca_max_partitions;	/* Max partitions in HCA */
444 
445 	ib_time_t	hca_local_ack_delay;
446 
447 	uint_t		hca_max_port_sgid_tbl_sz;
448 	uint16_t	hca_max_port_pkey_tbl_sz;
449 	uint_t		hca_max_pd;		/* Max# of Protection Domains */
450 
451 	uint_t		hca_max_ud_dest;
452 	uint_t		hca_max_srqs;		/* Max SRQs supported */
453 	uint_t		hca_max_srqs_sz;	/* Max outstanding WRs on any */
454 						/* SRQ */
455 	uint_t		hca_max_srq_sgl;	/* Max SGL entries per SRQ WR */
456 	uint_t		hca_max_cq_handlers;
457 	ibt_lkey_t	hca_reserved_lkey;	/* Reserved L_Key value */
458 	uint_t		hca_max_fmrs;		/* Max FMR Supported */
459 
460 	uint_t		hca_max_lso_size;
461 	uint_t		hca_max_lso_hdr_size;
462 	uint_t		hca_max_inline_size;
463 
464 	uint_t		hca_max_cq_mod_count;	/* CQ notify moderation */
465 	uint_t		hca_max_cq_mod_usec;
466 
467 	uint32_t	hca_fw_major_version;	/* firmware version */
468 	uint16_t	hca_fw_minor_version;
469 	uint16_t	hca_fw_micro_version;
470 
471 	/* detailed WQE size info */
472 	uint_t		hca_ud_send_inline_sz;	/* inline size in bytes */
473 	uint_t		hca_conn_send_inline_sz;
474 	uint_t		hca_conn_rdmaw_inline_overhead;
475 	uint_t		hca_recv_sgl_sz;	/* detailed SGL sizes */
476 	uint_t		hca_ud_send_sgl_sz;
477 	uint_t		hca_conn_send_sgl_sz;
478 	uint_t		hca_conn_rdma_sgl_overhead;
479 	int32_t		hca_pad;
480 } ibnex_ctl_hca_info_32_t;
481 
482 /*
483  * Data structure for IBNEX_CTL_QUERY_HCA
484  */
485 typedef struct ibnex_ctl_query_hca_s {
486 	ib_guid_t	hca_guid;	/* in: HCA GUID */
487 
488 	/*
489 	 * in: user allocated memory pointer for hca device path and number of
490 	 * bytes allocated for the hca device path.
491 	 */
492 	char		*hca_device_path;
493 	uint_t		hca_device_path_alloc_sz;
494 
495 	ibnex_ctl_hca_info_t	hca_info;	/* out: HCA information */
496 } ibnex_ctl_query_hca_t;
497 
498 typedef struct ibnex_ctl_query_hca_32_s {
499 	ib_guid_t	hca_guid;	/* in: HCA GUID */
500 
501 	/*
502 	 * in: user allocated memory pointer for hca device path and number of
503 	 * bytes allocated for the hca device path.
504 	 */
505 	caddr32_t	hca_device_path;
506 	uint_t		hca_device_path_alloc_sz;
507 
508 	ibnex_ctl_hca_info_32_t	hca_info;	/* out: HCA information */
509 } ibnex_ctl_query_hca_32_t;
510 
511 /*
512  * HCA port information structure
513  */
514 typedef struct ibnex_ctl_hca_port_info_s {
515 	ib_lid_t		p_lid;		/* Base LID of port */
516 	ib_qkey_cntr_t		p_qkey_violations; /* Bad Q_Key cnt */
517 	ib_pkey_cntr_t		p_pkey_violations; /* Optional bad P_Key cnt */
518 	uint8_t			p_sm_sl;	/* SM Service level */
519 	ib_port_phys_state_t	p_phys_state;
520 	ib_lid_t		p_sm_lid;	/* SM LID */
521 	ibt_port_state_t	p_linkstate;	/* Port state */
522 	uint8_t			p_port_num;	/* Port number */
523 
524 	ib_link_width_t		p_width_supported;
525 	ib_link_width_t		p_width_enabled;
526 	ib_link_width_t		p_width_active;
527 
528 	ib_mtu_t		p_mtu;		/* Max transfer unit - pkt */
529 	uint8_t			p_lmc;		/* LID mask control */
530 
531 	ib_link_speed_t		p_speed_supported;
532 	ib_link_speed_t		p_speed_enabled;
533 	ib_link_speed_t		p_speed_active;
534 
535 	ib_gid_t		*p_sgid_tbl;	/* SGID Table */
536 	uint_t			p_sgid_tbl_sz;	/* # of entries in SGID table */
537 
538 	ib_pkey_t		*p_pkey_tbl;	/* P_Key table */
539 	uint16_t		p_pkey_tbl_sz;	/* # of entries in P_Key tbl */
540 	uint16_t		p_def_pkey_ix;	/* default pkey index for TI */
541 
542 	uint8_t			p_max_vl;	/* Max num of virtual lanes */
543 	uint8_t			p_init_type_reply; /* Optional InitTypeReply */
544 	ib_time_t		p_subnet_timeout; /* Max Subnet Timeout */
545 	ibt_port_caps_t		p_capabilities;	/* Port Capabilities */
546 	uint32_t		p_msg_sz;	/* Max message size */
547 } ibnex_ctl_hca_port_info_t;
548 
549 typedef struct ibnex_ctl_hca_port_info_32_s {
550 	ib_lid_t		p_lid;		/* Base LID of port */
551 	ib_qkey_cntr_t		p_qkey_violations; /* Bad Q_Key cnt */
552 	ib_pkey_cntr_t		p_pkey_violations; /* Optional bad P_Key cnt */
553 	uint8_t			p_sm_sl;	/* SM Service level */
554 	ib_port_phys_state_t	p_phys_state;
555 	ib_lid_t		p_sm_lid;	/* SM LID */
556 	ibt_port_state_t	p_linkstate;	/* Port state */
557 	uint8_t			p_port_num;	/* Port number */
558 
559 	ib_link_width_t		p_width_supported;
560 	ib_link_width_t		p_width_enabled;
561 	ib_link_width_t		p_width_active;
562 
563 	ib_mtu_t		p_mtu;		/* Max transfer unit - pkt */
564 	uint8_t			p_lmc;		/* LID mask control */
565 
566 	ib_link_speed_t		p_speed_supported;
567 	ib_link_speed_t		p_speed_enabled;
568 	ib_link_speed_t		p_speed_active;
569 
570 	caddr32_t		p_sgid_tbl;	/* SGID Table */
571 	uint_t			p_sgid_tbl_sz;	/* # of entries in SGID table */
572 
573 	caddr32_t		p_pkey_tbl;	/* P_Key table */
574 	uint16_t		p_pkey_tbl_sz;	/* # of entries in P_Key tbl */
575 	uint16_t		p_def_pkey_ix;	/* default pkey index for TI */
576 
577 	uint8_t			p_max_vl;	/* Max num of virtual lanes */
578 	uint8_t			p_init_type_reply; /* Optional InitTypeReply */
579 	ib_time_t		p_subnet_timeout; /* Max Subnet Timeout */
580 	ibt_port_caps_t		p_capabilities;	/* Port Capabilities */
581 	uint32_t		p_msg_sz;	/* Max message size */
582 } ibnex_ctl_hca_port_info_32_t;
583 
584 /*
585  * Data structure for IBNEX_CTL_QUERY_HCA_PORT
586  */
587 typedef struct ibnex_ctl_query_hca_port_s {
588 	ib_guid_t	hca_guid;		/* in: HCA GUID */
589 	uint_t		port_num;		/* in: port number */
590 
591 	ib_gid_t	*sgid_tbl;		/* in: SGID Table */
592 	uint_t		sgid_tbl_alloc_sz; /* in: # of entries in SGID table */
593 
594 	ib_pkey_t	*pkey_tbl;		/* in: P_Key table */
595 	uint_t		pkey_tbl_alloc_sz; /* in: # of entries in P_Key table */
596 
597 	uint32_t	pad;
598 	ibnex_ctl_hca_port_info_t port_info;	/* out: port information */
599 } ibnex_ctl_query_hca_port_t;
600 
601 typedef struct ibnex_ctl_query_hca_port_32_s {
602 	ib_guid_t	hca_guid;		/* in: HCA GUID */
603 	uint_t		port_num;		/* in: port number */
604 
605 	caddr32_t	sgid_tbl;		/* in: SGID Table */
606 	uint_t		sgid_tbl_alloc_sz; /* in: # of entries in SGID table */
607 
608 	caddr32_t	pkey_tbl;		/* in: P_Key table */
609 	uint_t		pkey_tbl_alloc_sz; /* in: # of entries in P_Key table */
610 
611 	uint32_t	pad;
612 	ibnex_ctl_hca_port_info_32_t port_info;	/* out: port information */
613 } ibnex_ctl_query_hca_port_32_t;
614 
615 #ifdef _KERNEL
616 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_hca_info_s))
617 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_hca_port_info_s))
618 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_hca_port_info_32_s))
619 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_query_hca_port_s))
620 _NOTE(SCHEME_PROTECTS_DATA("", ibnex_ctl_query_hca_port_32_s))
621 #endif
622 
623 
624 #ifdef __cplusplus
625 }
626 #endif
627 
628 #endif	/* _SYS_IB_IBNEX_IBNEX_DEVCTL_H */
629