/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_IB_IBNEX_IBNEX_DEVCTL_H
#define _SYS_IB_IBNEX_IBNEX_DEVCTL_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* This file contains info for devctls issued by IB cfgadm plugin.
* The only devctl of interest is DEVCTL_AP_CONTROL which uses
* these defines and data structures.
*/
/*
* types of attachment point Identifiers (APID)s supported
*/
/* defines for dynamic APID handling */
/* Enums while reading ib.conf file */
typedef enum ib_service_type_e {
/*
* defines for nvlist types: (for PORT devices and IOCs)
* The first 6 are common to both IOC and PORT devices.
* The last 9 are used only for IOC devices.
*/
/*
* This flag is passed from cfgadm to ib(7d) to convey that it
* need not attempt to probe the fabric.
*
* The value of these flags should be same as flags in enum
* ibdm_ibnex_get_ioclist_mtd_t.
*/
/*
* The following are sub-commands to DEVCTL_AP_CONTROL.
* NOTE: IBNEX_NUM_DEVICE_NODES and IBNEX_NUM_HCA_NODES need to be
* separate. The former is used to figure out the dynamic ap_ids for
* the IB fabric. The latter is used for a HCA count on a given host only.
*/
/*
* devctl. Note that these are separate structures as some fields are pointers.
*/
typedef struct ibnex_ioctl_data {
/* For 32-bit app/64-bit kernel */
typedef struct ibnex_ioctl_data_32 {
/*
* General ibnex IOCTLs
*
* IBNEX_CTL_GET_API_VER
* ======================
*
* Gets the version number of the API that IB nexus currently supports.
*
* arg - pointer to a structure of type ibnex_ctl_api_ver_t
*
* Caller does not set any field of this structure. When this IOCTL is issued,
* ib nexus will set api_ver_num field to the currently supported API
* version number.
*
* The caller could issue this IOCTL prior to issuing any other general
* ibnex IOCTLs to detect incompatible changes to the API. The caller may
* call other IOCTLs only if the api_ver_num matches the API version number
* used by the caller.
*
*
* IBNEX_CTL_GET_HCA_LIST
* ======================
*
* Gets GUIDs of all HCAs in the system
*
* arg - pointer to a structure of type ibnex_ctl_get_hca_list_t
*
* Caller allocates memory for HCA GUIDs. Sets hca_guids field to point to the
* allocated memory. Sets hca_guids_alloc_sz to the number of GUIDs for which
* memory has been allocated.
*
* Upon successful return from the IOCTL, nhcas will contain the number of
* HCAs in the system. HCA GUIDs will be copied into hca_guids array.
* The number of GUIDs copied are nhcas or hca_guids_alloc_sz which ever is
* smaller.
*
*
* IBNEX_CTL_QUERY_HCA
* ===================
*
* Query HCA attributes
*
* arg - pointer to a structure of type ibnex_ctl_query_hca_t
*
* Caller sets hca_guid field of this structure.
*
* Caller allocates memory for hca device path. Sets hca_device_path to point
* to the allocated memory and hca_device_path_alloc_sz to the number of bytes
* allocated.
*
* Upon successful return from the IOCTL, hca_info will contain HCA attributes
* for the specified GUID. hca_info.hca_device_path_len will contain the actual
* string length of the hca device path plus one (for the terminating null
* character). hca_info.hca_device_path will point to null terminated hca device
* path string if the caller allocated memory for the hca device path is large
* enough to hold the hca device path and the terminating null character.
* Otherwise hca_info.hca_device_path will be set to NULL.
*
*
* IBNEX_CTL_QUERY_HCA_PORT
* ========================
*
* Query HCA port attributes
*
* arg - pointer to a structure of type ibnex_ctl_query_hca_port_t
*
* Caller sets hca_guid and port_num fields.
*
* Caller allocates memory for sgid entries. Sets sgid_tbl to point to
* the allocated memory and sgid_tbl_alloc_sz to the number of sgid entries
* for which memory has been allocated.
*
* Caller allocates memory for pkey entries. Sets pkey_tbl to point to
* the allocated memory and pkey_tbl_alloc_sz to the number of pkey entries
* for which memory has been allocated.
*
* Upon successful return from the IOCTL, port_info will contain HCA port
* attributes for the specified HCA port. port_info.p_sgid_tbl_sz will contain
* the actual number of sgids associated with this port. port_info.p_pkey_tbl_sz
* will contain the actual number of pkeys associated with this port.
*
* port_info.p_sgid_tbl will point to an array containing sgids. The number of
* sgids in the array is sgid_tbl_alloc_sz or port_info.p_sgid_tbl_sz
* whichever is smaller.
*
* port_info.p_pkey_tbl will point to an array containing pkeys. The number of
* pkeys in the array is pkey_tbl_alloc_sz or port_info.p_pkey_tbl_sz
* whichever is smaller.
*
* Error numbers for the above ioctls upon failure:
* EINVAL Invalid parameter passed
* EFAULT A fault occurred copying data to or from the user space
* to the kernel space.
* ENXIO Specified HCA GUID does not exist
* ENOENT Specified HCA port does not exist
*
*/
/*
* ibnex specific ioctls
*
* NOTE: The ioctl codes should not collide with generic devctl ioctls
* such as DEVCTL_AP_CONFIGURE.
*/
/*
* The device to open for issuing ibnex IOCTLs
*/
/*
* ibnex IOCTL API version number - to be incremented when making an
* incompatible change to the API.
*/
/*
* Data structure for IBNEX_CTL_GET_API_VER
*/
typedef struct ibnex_ctl_api_ver_s {
/*
* Data structure for IBNEX_CTL_GET_HCA_LIST
*/
typedef struct ibnex_ctl_get_hca_list_s {
/* which storage is allocated */
typedef struct ibnex_ctl_get_hca_list_32_s {
/* which storage is allocated */
/*
* HCA information structure
*/
typedef struct ibnex_ctl_hca_info_s {
/* HCA driver name and instance number */
int hca_driver_instance;
/*
* hca device path and the length.
* hca_device_path_len contains the string length of the actual hca
* device path plus one (for the terminating null character).
*/
char *hca_device_path;
/* channel */
/* mem that can be registered */
/* with this HCA as target. */
/* chan this HCA as target. */
/* per channel by this HCA */
/* that can join multicast */
/* groups */
/* Multicast group in HCA */
/* SRQ */
/* detailed WQE size info */
typedef struct ibnex_ctl_hca_info_32_s {
/* HCA driver name and instance number */
int hca_driver_instance;
/*
* hca device path and the length.
* hca_device_path_len contains the string length of the actual hca
* device path plus one (for the terminating null character).
*/
/* channel */
/* mem that can be registered */
/* with this HCA as target. */
/* chan this HCA as target. */
/* per channel by this HCA */
/* that can join multicast */
/* groups */
/* Multicast group in HCA */
/* SRQ */
/* detailed WQE size info */
/*
* Data structure for IBNEX_CTL_QUERY_HCA
*/
typedef struct ibnex_ctl_query_hca_s {
/*
* in: user allocated memory pointer for hca device path and number of
* bytes allocated for the hca device path.
*/
char *hca_device_path;
typedef struct ibnex_ctl_query_hca_32_s {
/*
* in: user allocated memory pointer for hca device path and number of
* bytes allocated for the hca device path.
*/
/*
* HCA port information structure
*/
typedef struct ibnex_ctl_hca_port_info_s {
typedef struct ibnex_ctl_hca_port_info_32_s {
/*
* Data structure for IBNEX_CTL_QUERY_HCA_PORT
*/
typedef struct ibnex_ctl_query_hca_port_s {
typedef struct ibnex_ctl_query_hca_port_32_s {
#ifdef _KERNEL
#endif
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_IBNEX_IBNEX_DEVCTL_H */