ibdm_ibnex.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_IB_MGT_IBDM_IBDM_IBNEX_H
#define _SYS_IB_MGT_IBDM_IBDM_IBNEX_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* This file contains the definitions of private interfaces
* and data structures used between IB nexus and IBDM.
*/
#ifdef __cplusplus
extern "C" {
#endif
/* DM return status codes from private interfaces */
typedef enum ibdm_status_e {
IBDM_SUCCESS = 0,
IBDM_FAILURE = 1
/*
* IBDM events that are passed to IB nexus driver
* NOTE: These are different from ibt_async_code_t
*/
typedef enum ibdm_events_e {
/*
* Flags for ibdm_ibnex_get_ioc_list.
* The flags determine the functioning of ibdm_ibnex_get_ioc_list.
*
* IBDM_IBNEX_NORMAL_PROBE
* Sweep fabric and discover new GIDs only
* This value should be same as IBNEX_PROBE_ALLOWED_FLAG
* IBDM_IBNEX_DONOT_PROBE
* Do not probe, just get the current ioc_list.
* This value should be same as IBNEX_DONOT_PROBE_FLAG
* IBDM_IBNEX_REPROBE_ALL
* Sweep fabric, discover new GIDs. For GIDs
* discovered before, reprobe the IOCs on it.
*/
typedef enum ibdm_ibnex_get_ioclist_mtd_e {
/*
* Private data structure called from IBDM timeout handler
*/
typedef struct ibdm_timeout_cb_args_s {
struct ibdm_dp_gidinfo_s *cb_gid_info;
int cb_req_type;
int cb_ioc_num; /* IOC# */
int cb_retry_count;
int cb_srvents_start;
int cb_srvents_end;
/*
* Service entry structure
*/
typedef struct ibdm_srvents_info_s {
int se_state;
/* values for "se_state" */
#define IBDM_SE_VALID 0x1
#define IBDM_SE_INVALID 0x0
/* I/O Controller information */
typedef struct ibdm_ioc_info_s {
int ioc_state;
struct ibdm_gid_s *ioc_gid_list;
struct ibdm_iou_info_s *ioc_iou_info;
struct ibdm_ioc_info_s *ioc_next;
/* Previous fields for reprobe */
struct ibdm_gid_s *ioc_prev_gid_list;
/* Flag indicating which IOC info has changed */
/*
* List of HCAs through which IOC is accessible
* This field will be initialized in ibdm_ibnex_probe_ioc
* and ibdm_get_ioc_list for all IOCs in the fabric.
*
* HCAs could have been added or deleted from the list,
* on calls to ibdm_ibnex_get_ioc_list & ibdm_ibnex_probe_ioc.
*
* Updates to HCAs in the list will be reported by
* IBDM_EVENT_HCA_DOWN and IBDM_EVENT_IOC_HCA_UNREACHABLE events
* in the IBDM<->IBDM callback.
*
* IOC not visible to the host system(because all HCAs cannot
* reach the IOC) will be reported in the same manner as TCA
* ports getting to 0 (using IOC_PROP_UPDATE event).
*/
struct ibdm_hca_list_s *ioc_hca_list;
/* values for "ioc_state */
#define IBDM_IOC_STATE_PROBE_SUCCESS 0x0
#define IBDM_IOC_STATE_PROBE_INVALID 0x1
#define IBDM_IOC_STATE_PROBE_FAILED 0x2
#define IBDM_IOC_STATE_REPROBE_PROGRESS 0x4
/* I/O Unit Information */
typedef struct ibdm_iou_info_s {
/* P_Key table related info */
typedef struct ibdm_pkey_tbl_s {
/*
* Port Attributes structure
*/
typedef struct ibdm_port_attr_s {
/*
* HCA list structure.
*/
typedef struct ibdm_hca_list_s {
/* for HCA node */
/*
* The DM callback definitions
*
* ibdm_callback_t
* Pointer to DM callback function
* IBDM notifies IB nexus of ibdm_event_t using this callback.
* Arguments
* arg : The value of "arg" depends on the "event"
* IBDM_EVENT_CREATE_HCA_NODE (pointer to HCA GUID)
* IBDM_EVENT_REMOVE_HCA_NODE (pointer to HCA GUID)
* IBDM_EVENT_IOC_PROP_UPDATE (ibdm_ioc_info_t *)
*
* event : ibdm_event_t values
*
* Returns : None
*
*/
/*
* DM interface functions
*/
/*
* ibdm_ibnex_register_callback
* Register the IB nexus IBDM callback routine
*
* Arguments : IB nexus IBDM callback routine
* Return Values : None
*/
/*
* ibdm_ibnex_unregister_callback
* Unregister IB nexus DM callback with IBDM
*
* Arguments : None
* Return Values : None
*/
void ibdm_ibnex_unregister_callback();
/*
* PORT devices handling interfaces.
*
* ibdm_ibnex_probe_hcaport
* Probes the HCA port. If found, returns the port attributes.
* Caller is responsible for freeing the memory for the port
* attribute structure by calling ibdm_ibnex_free_port_attr()
*
* Arguments : GUID of the HCA and port number
* Return Values : ibdm_port_attr_t on SUCCESS, NULL on FAILURE.
*/
/*
* ibdm_ibnex_get_port_attrs
* Scans the HCA ports for a matching port_guid. If found,
* returns the port attributes.
* Caller is responsible for freeing the memory for the port
* attribute structure by calling ibdm_ibnex_free_port_attr()
*
* Arguments : GUID of the port
* Return Values : ibdm_port_attr_t on SUCCESS, NULL on FAILURE.
*/
/*
* ibdm_ibnex_free_port_attr()
* Deallocates the memory from ibnex_get_dip_from_port_guid() and
* ibdm_ibnex_get_port_attrs() functions.
*/
/*
* IOC devices handling interfaces.
*
* ibdm_ibnex_probe_ioc
* Probes the IOC device on the fabric. If found, allocates and
* returns pointer to the ibdm_ioc_info_t. Caller is responsible
* to free the memory for the ioc attribute structure by calling
* ibdm_ibnex_free_ioc_list.
*
* Arguments :
* GUID of the IOU and GUID of the IOC
* reprobe_flag - Set if IOC information has to be reprobed.
* Return Values : ibdm_ioc_info_t on SUCCESS, NULL on FAILURE.
*/
int reprobe_flag);
/*
* ibdm_ibnex_get_ioc_count
* Returns number of IOCs currently discovered in the fabric.
* Arguments : NONE
* Return Values : number of IOCs seen
*/
int ibdm_ibnex_get_ioc_count(void);
/*
* ibdm_ibnex_get_ioc_list
* Returns linked list of ibdm_ioc_info_t structures for all the
* IOCs present on the fabric. Caller is responsible for freeing
* the memory allocated for the ioc attribute structure(s) by
* calling ibdm_ibnex_free_ioc_list().
*
* Arguments : list_flag :
* Get list according to ibdm_ibnex_get_ioclist_mtd_t defination.
* Return Values : IOC list based containing "ibdm_ioc_info_t"s if
* successful, otherwise NULL.
*/
/*
* ibdm_ibnex_get_ioc_info
* Returns pointer ibdm_ioc_info_t structures for the request
* "ioc_guid". Caller is responsible to free the memory by
* calling ibdm_ibnex_free_ioc_list() when the return value is
* not NULL.
*
* Arguments : GUID of the IOC
* Return Values : Address of kmem_alloc'ed memory if the IOC exists,
* otherwise NULL.
*/
/*
* ibdm_ibnex_free_ioc_list()
* Deallocates the memory from ibdm_ibnex_probe_ioc(),
* ibdm_ibnex_get_ioc_list() and ibdm_ibnex_get_ioc_info()
*/
void ibdm_ibnex_free_ioc_list(ibdm_ioc_info_t *);
/*
* HCA handling interfaces.
*
* ibdm_ibnex_get_hca_list
* Returns linked list of ibdm_hca_list_t structures for all
* the HCAs present on the fabric. Caller is responsible for
* freeing the memory for the hca attribute structure(s) by
* calling ibdm_ibnex_free_hca_list().
*
* Arguments : "hca" contains pointer to pointer of ibdm_hca_list_t
* : "cnt" contains pointer to number of hca's
* Return Values : None
*/
/*
* ibdm_ibnex_get_hca_info_by_guid
* Returns a linked list of ibdm_hca_list_t structure that matches the
* given argument. The caller is responsible for freeing the memory for
* the hca attribute structure by calling ibdm_ibnex_free_hca_list().
*
* Arguments : HCA GUID
* Return Values : Linked list of ibdm_hca_list_t(s)
*/
/*
* ibdm_ibnex_free_hca_list()
* Deallocates the memory from ibdm_ibnex_get_hca_list() and
* ibdm_ibnex_get_hca_info_by_guid() functions.
*/
void ibdm_ibnex_free_hca_list(ibdm_hca_list_t *);
/*
* ibdm_ibnex_update_pkey_tbls
* Updates the DM P_Key database.
*
* Arguments : NONE
* Return Values : NONE
*/
void ibdm_ibnex_update_pkey_tbls(void);
/*
* ibdm_ibnex_get_waittime
* Figure out how much to delay for a given port to come up
*
* Return Values : default wait time from IB nexus
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IB_MGT_IBDM_IBDM_IBNEX_H */