Blame include/vendor/osm_vendor_sa_api.h

Packit 13e616
/*
Packit 13e616
 * Copyright (c) 2004-2006 Voltaire, Inc. All rights reserved.
Packit 13e616
 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
Packit 13e616
 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
Packit 13e616
 *
Packit 13e616
 * This software is available to you under a choice of one of two
Packit 13e616
 * licenses.  You may choose to be licensed under the terms of the GNU
Packit 13e616
 * General Public License (GPL) Version 2, available from the file
Packit 13e616
 * COPYING in the main directory of this source tree, or the
Packit 13e616
 * OpenIB.org BSD license below:
Packit 13e616
 *
Packit 13e616
 *     Redistribution and use in source and binary forms, with or
Packit 13e616
 *     without modification, are permitted provided that the following
Packit 13e616
 *     conditions are met:
Packit 13e616
 *
Packit 13e616
 *      - Redistributions of source code must retain the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer.
Packit 13e616
 *
Packit 13e616
 *      - Redistributions in binary form must reproduce the above
Packit 13e616
 *        copyright notice, this list of conditions and the following
Packit 13e616
 *        disclaimer in the documentation and/or other materials
Packit 13e616
 *        provided with the distribution.
Packit 13e616
 *
Packit 13e616
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
Packit 13e616
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
Packit 13e616
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Packit 13e616
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
Packit 13e616
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
Packit 13e616
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit 13e616
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Packit 13e616
 * SOFTWARE.
Packit 13e616
 *
Packit 13e616
 */
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * Abstract:
Packit 13e616
 * 	Specification of the OpenSM SA Client API. This API uses the basic osm
Packit 13e616
 *    vendor API to provide SA Client interface.
Packit 13e616
 */
Packit 13e616
Packit 13e616
#ifndef _OSM_VENDOR_SA_API_H_
Packit 13e616
#define _OSM_VENDOR_SA_API_H_
Packit 13e616
Packit 13e616
#include <iba/ib_types.h>
Packit 13e616
Packit 13e616
#ifdef __cplusplus
Packit 13e616
#  define BEGIN_C_DECLS extern "C" {
Packit 13e616
#  define END_C_DECLS   }
Packit 13e616
#else				/* !__cplusplus */
Packit 13e616
#  define BEGIN_C_DECLS
Packit 13e616
#  define END_C_DECLS
Packit 13e616
#endif				/* __cplusplus */
Packit 13e616
Packit 13e616
BEGIN_C_DECLS
Packit 13e616
/****d* OpenSM Vendor SA Client/osmv_flags_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_flags_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Access layer flags used to direct the operation of various calls.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef uint32_t osmv_flags_t;
Packit 13e616
#define OSM_SA_FLAGS_SYNC				0x00000001
Packit 13e616
/*
Packit 13e616
* VALUES
Packit 13e616
*	OSM_SA_FLAGS_SYNC
Packit 13e616
*		Indicates that the given operation should be performed synchronously.
Packit 13e616
*		The call will block until it completes.  Callbacks will still be
Packit 13e616
*		invoked.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*  osmv_query_sa
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****d* OpenSM Vendor SA Client/osmv_query_type_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_query_type_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Abstracted queries supported by the access layer.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef enum _osmv_query_type {
Packit 13e616
	OSMV_QUERY_USER_DEFINED,
Packit 13e616
Packit 13e616
	OSMV_QUERY_ALL_SVC_RECS,
Packit 13e616
	OSMV_QUERY_SVC_REC_BY_NAME,
Packit 13e616
	OSMV_QUERY_SVC_REC_BY_ID,
Packit 13e616
Packit 13e616
	OSMV_QUERY_CLASS_PORT_INFO,
Packit 13e616
Packit 13e616
	OSMV_QUERY_NODE_REC_BY_NODE_GUID,
Packit 13e616
	OSMV_QUERY_PORT_REC_BY_LID,
Packit 13e616
	OSMV_QUERY_PORT_REC_BY_LID_AND_NUM,
Packit 13e616
Packit 13e616
	OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK,
Packit 13e616
	OSMV_QUERY_SLVL_BY_LID_AND_PORTS,
Packit 13e616
Packit 13e616
	OSMV_QUERY_PATH_REC_BY_PORT_GUIDS,
Packit 13e616
	OSMV_QUERY_PATH_REC_BY_GIDS,
Packit 13e616
	OSMV_QUERY_PATH_REC_BY_LIDS,
Packit 13e616
Packit 13e616
	OSMV_QUERY_UD_MULTICAST_SET,
Packit 13e616
	OSMV_QUERY_UD_MULTICAST_DELETE,
Packit 13e616
Packit 13e616
	OSMV_QUERY_MULTIPATH_REC,
Packit 13e616
Packit 13e616
} osmv_query_type_t;
Packit 13e616
/*
Packit 13e616
* VALUES
Packit 13e616
*	OSMV_QUERY_USER_DEFINED
Packit 13e616
*		Query the SA based on user-defined input.  Queries of this type
Packit 13e616
*		should reference an osmv_user_query_t structure as input to the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_SVC_REC_BY_NAME
Packit 13e616
*		Query for service records based on the service name.  Queries of
Packit 13e616
*		this type should reference an ib_svc_name_t structure as input
Packit 13e616
*		to the query.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_SVC_REC_BY_ID
Packit 13e616
*		Query for service records based on the service ID.  Queries of
Packit 13e616
*		this type should reference an ib_net64_t value that indicates
Packit 13e616
*		the ID of the service being requested.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_NODE_REC_BY_NODE_GUID
Packit 13e616
*		Query for node information based on the node's GUID.  Queries of
Packit 13e616
*		this type should reference an ib_net64_t value that indicates
Packit 13e616
*		the GUID of the node being requested.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_PORT_REC_BY_LID
Packit 13e616
*		Query for port information based on the port's base LID. Queries
Packit 13e616
*		of this type should reference an ib_net16_t value that indicates
Packit 13e616
*		the base LID of the port being requested.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_PORT_REC_BY_LID_AND_NUM
Packit 13e616
*		Query for port information based on the port's LID and port num.
Packit 13e616
*		Queries of this type should reference an osmv_user_query_t
Packit 13e616
*		structure as input to the query. The port num and lid should
Packit 13e616
*		be provided by it.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_PATH_REC_BY_PORT_GUIDS
Packit 13e616
*		Query for path records between the specified pair of port GUIDs.
Packit 13e616
*		Queries of this type should reference an osmv_guid_pair_t
Packit 13e616
*		structure that indicates the GUIDs of the path being requested.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_PATH_REC_BY_GIDS
Packit 13e616
*		Query for path records between the specified pair of port GIDs.
Packit 13e616
*		Queries of this type should reference an osmv_gid_pair_t
Packit 13e616
*		structure that indicates the GIDs of the path being requested.
Packit 13e616
*
Packit 13e616
*	OSMV_QUERY_PATH_REC_BY_LIDS
Packit 13e616
*		Query for path records between the specified pair of port LIDs.
Packit 13e616
*		Queries of this type should reference an osmv_lid_pair_t
Packit 13e616
*		structure that indicates the LIDs of the path being requested.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This enum is used to define abstracted queries provided by the access
Packit 13e616
*	layer.  Users may issue queries not listed here by sending MADs directly
Packit 13e616
*	to subnet administration or a class manager.  These queries are
Packit 13e616
*	intended to represent those most often used by clients.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query, osmv_query_req_t, osmv_user_query_t, osmv_gid_pair_t,
Packit 13e616
*	osmv_lid_pair_t osmv_guid_pair_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****s* OpenSM Vendor SA Client/osmv_user_query_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_user_query_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	User-defined query information.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct _osmv_user_query {
Packit 13e616
	uint8_t method;
Packit 13e616
	ib_net16_t attr_id;
Packit 13e616
	ib_net16_t attr_offset;
Packit 13e616
	ib_net32_t attr_mod;
Packit 13e616
	ib_net64_t comp_mask;
Packit 13e616
	void *p_attr;
Packit 13e616
} osmv_user_query_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*
Packit 13e616
*	method
Packit 13e616
*		Method to be used
Packit 13e616
*
Packit 13e616
*	attr_id
Packit 13e616
*		Attribute identifier of query data.
Packit 13e616
*
Packit 13e616
*	attr_offset
Packit 13e616
*		Size of the query attribute, in 8-byte words.  Users can set
Packit 13e616
*		this value by passing in the sizeof( attribute ) into the
Packit 13e616
*		ib_get_attr_offset() routine.
Packit 13e616
*
Packit 13e616
*	attr_mod
Packit 13e616
*		Attribute modifier for query request.
Packit 13e616
*
Packit 13e616
*	comp_mask
Packit 13e616
*		Indicates the attribute components that are specified for the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	p_attr
Packit 13e616
*		References the attribute structure used as input into the query.
Packit 13e616
*		This field is ignored if comp_mask is set to 0.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This structure is used to describe a user-defined query.  The attribute
Packit 13e616
*	ID, attribute offset, component mask, and attribute structure must match
Packit 13e616
*	those defined by the IBA specification.  Users should refer to chapter
Packit 13e616
*	15 of the IBA specification for additional details.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_type_t, ib_get_attr_offset, ib_get_attr_size, osmv_query_sa
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****s* OpenSM Vendor SA Client/osmv_gid_pair_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_gid_pair_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Source and destination GIDs.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct _osmv_gid_pair {
Packit 13e616
	ib_gid_t src_gid;
Packit 13e616
	ib_gid_t dest_gid;
Packit 13e616
} osmv_gid_pair_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	src_gid
Packit 13e616
*		Source GID of a path.
Packit 13e616
*
Packit 13e616
*	dest_gid
Packit 13e616
*		Destination GID of a path.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This structure is used to describe the endpoints of a path.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	ib_gid_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****s* OpenSM Vendor SA Client/osmv_lid_pair_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_lid_pair_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Source and destination LIDs.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct _osmv_lid_pair {
Packit 13e616
	ib_net16_t src_lid;
Packit 13e616
	ib_net16_t dest_lid;
Packit 13e616
} osmv_lid_pair_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	src_lid
Packit 13e616
*		Source LID of a path.
Packit 13e616
*
Packit 13e616
*	dest_lid
Packit 13e616
*		Destination LID of a path.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This structure is used to describe the endpoints of a path.
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****s* OpenSM Vendor SA Client/osmv_guid_pair_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_guid_pair_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Source and destination GUIDs.  These may be port or channel adapter
Packit 13e616
*	GUIDs, depending on the context in which this structure is used.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct _osmv_guid_pair {
Packit 13e616
	ib_net64_t src_guid;
Packit 13e616
	ib_net64_t dest_guid;
Packit 13e616
} osmv_guid_pair_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	src_guid
Packit 13e616
*		Source GUID of a path.
Packit 13e616
*
Packit 13e616
*	dest_guid
Packit 13e616
*		Destination GUID of a path.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This structure is used to describe the endpoints of a path.  The given
Packit 13e616
*	GUID pair may belong to either ports or channel adapters.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	ib_guid_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****s* OpenSM Vendor SA Client/osmv_multipath_req_t
Packit 13e616
* NAME
Packit 13e616
*       osmv_multipath_req_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*       Fields from which to generate a MultiPathRecord request.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct _osmv_multipath_req_t {
Packit 13e616
	ib_net64_t comp_mask;
Packit 13e616
	uint16_t pkey;
Packit 13e616
	boolean_t reversible;
Packit 13e616
	uint8_t num_path;
Packit 13e616
	uint8_t sl;
Packit 13e616
	uint8_t independence;
Packit 13e616
	uint8_t sgid_count;
Packit 13e616
	uint8_t dgid_count;
Packit 13e616
	ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];
Packit 13e616
} osmv_multipath_req_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*       This structure is used to describe a multipath request.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****s* OpenSM Vendor SA Client/osmv_query_res_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_query_res_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Contains the results of a subnet administration query.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct _osmv_query_res {
Packit 13e616
	const void *query_context;
Packit 13e616
	ib_api_status_t status;
Packit 13e616
	osmv_query_type_t query_type;
Packit 13e616
	uint32_t result_cnt;
Packit 13e616
	osm_madw_t *p_result_madw;
Packit 13e616
} osmv_query_res_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	query_context
Packit 13e616
*		User-defined context information associated with the query
Packit 13e616
*		through the osm_vendor_query_sa call.
Packit 13e616
*
Packit 13e616
*	status
Packit 13e616
*		Indicates the success of the query operation.
Packit 13e616
*
Packit 13e616
*	query_type
Packit 13e616
*		Indicates the type of query for which the results are being
Packit 13e616
*		returned.  This matches the query_type specified through the
Packit 13e616
*               osm_vendor_query_sa call.
Packit 13e616
*
Packit 13e616
*	result_cnt
Packit 13e616
*		The number of result structures that were returned by the query.
Packit 13e616
*
Packit 13e616
*	p_result_madw
Packit 13e616
*		For queries returning IB_SUCCESS or IB_REMOTE_ERROR, this
Packit 13e616
*		references the MAD wrapper returned by subnet administration
Packit 13e616
*		containing the list of results or the returned error code.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	A query result structure is returned to a client through their
Packit 13e616
*	osmv_pfn_query_cb_t routine to notify them of the results of a subnet
Packit 13e616
*	administration query.  If the query was successful or received an error
Packit 13e616
*	from subnet administration, p_result_madw will reference a MAD wrapper
Packit 13e616
*	containing the results.  The MAD referenced by p_result_madw is owned by
Packit 13e616
*	the user and remains available even after their callback returns.  Users
Packit 13e616
*	must call osm_mad_pool_put() to return the MAD wrapper back to the
Packit 13e616
*	mad pool when they are done accessing the results.
Packit 13e616
*
Packit 13e616
*	To retrieve individual result structures from the p_result_madw, users
Packit 13e616
*	may call osmv_get_query_result().
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_sa, osmv_pfn_query_cb_t, ib_api_status_t,
Packit 13e616
*	osmv_query_status_t, osmv_query_type_t,
Packit 13e616
*	osmv_get_query_result
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_get_query_result
Packit 13e616
* NAME
Packit 13e616
*	osmv_get_query_result
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieves a result structure from a MADW returned by a call to
Packit 13e616
*	osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline void *osmv_get_query_result(IN osm_madw_t * p_result_madw,
Packit 13e616
					  IN uint32_t result_index)
Packit 13e616
{
Packit 13e616
	ib_sa_mad_t *p_sa_mad;
Packit 13e616
Packit 13e616
	CL_ASSERT(p_result_madw);
Packit 13e616
	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
Packit 13e616
	CL_ASSERT(p_sa_mad);
Packit 13e616
	CL_ASSERT(ib_get_attr_size(p_sa_mad->attr_offset) * (result_index + 1) +
Packit 13e616
		  IB_SA_MAD_HDR_SIZE <= p_result_madw->mad_size);
Packit 13e616
Packit 13e616
	return (p_sa_mad->data +
Packit 13e616
		(ib_get_attr_size(p_sa_mad->attr_offset) * result_index));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_result_madw
Packit 13e616
*		[in] This is a reference to the MAD returned as a result of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	result_index
Packit 13e616
*		[in] A zero-based index indicating which result to return.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This call returns a pointer to the start of a result structure from a
Packit 13e616
*	call to osmv_query_sa().  The type of result structure must be known to
Packit 13e616
*	the user either through the user's context or the query_type returned as
Packit 13e616
*	part of the osmv_query_res_t structure.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t, osm_madw_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_get_query_path_rec
Packit 13e616
* NAME
Packit 13e616
*	osmv_get_query_path_rec
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieves a path record result from a MAD returned by a call to
Packit 13e616
*	osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_path_rec_t *osmv_get_query_path_rec(IN osm_madw_t *
Packit 13e616
						     p_result_madw,
Packit 13e616
						     IN uint32_t result_index)
Packit 13e616
{
Packit 13e616
	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
Packit 13e616
Packit 13e616
	CL_ASSERT(p_result_madw);
Packit 13e616
	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
Packit 13e616
	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD);
Packit 13e616
Packit 13e616
	return ((ib_path_rec_t *)
Packit 13e616
		osmv_get_query_result(p_result_madw, result_index));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_result_madw
Packit 13e616
*		[in] This is a reference to the MAD returned as a result of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	result_index
Packit 13e616
*		[in] A zero-based index indicating which result to return.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This call returns a pointer to the start of a path record result from
Packit 13e616
*	a call to osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_path_rec_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_get_query_portinfo_rec
Packit 13e616
* NAME
Packit 13e616
*	osmv_get_query_portinfo_rec
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieves a port info record result from a MAD returned by a call to
Packit 13e616
*	osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_portinfo_record_t *osmv_get_query_portinfo_rec(IN osm_madw_t *
Packit 13e616
								p_result_madw,
Packit 13e616
								IN uint32_t
Packit 13e616
								result_index)
Packit 13e616
{
Packit 13e616
	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
Packit 13e616
Packit 13e616
	CL_ASSERT(p_result_madw);
Packit 13e616
	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
Packit 13e616
	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD);
Packit 13e616
Packit 13e616
	return ((ib_portinfo_record_t *) osmv_get_query_result(p_result_madw,
Packit 13e616
							       result_index));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_result_madw
Packit 13e616
*		[in] This is a reference to the MAD returned as a result of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	result_index
Packit 13e616
*		[in] A zero-based index indicating which result to return.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This call returns a pointer to the start of a port info record result
Packit 13e616
*	from a call to osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_portinfo_record_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_get_query_node_rec
Packit 13e616
* NAME
Packit 13e616
*	osmv_get_query_node_rec
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieves a node record result from a MAD returned by a call to
Packit 13e616
*	osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_node_record_t *osmv_get_query_node_rec(IN osm_madw_t *
Packit 13e616
							p_result_madw,
Packit 13e616
							IN uint32_t
Packit 13e616
							result_index)
Packit 13e616
{
Packit 13e616
	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
Packit 13e616
Packit 13e616
	CL_ASSERT(p_result_madw);
Packit 13e616
	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
Packit 13e616
	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_NODE_RECORD);
Packit 13e616
Packit 13e616
	return ((ib_node_record_t *) osmv_get_query_result(p_result_madw,
Packit 13e616
							   result_index));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_result_madw
Packit 13e616
*		[in] This is a reference to the MAD returned as a result of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	result_index
Packit 13e616
*		[in] A zero-based index indicating which result to return.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This call returns a pointer to the start of a node record result from
Packit 13e616
*	a call to osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_node_record_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_get_query_svc_rec
Packit 13e616
* NAME
Packit 13e616
*	osmv_get_query_svc_rec
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieves a service record result from a MAD returned by a call to
Packit 13e616
*	osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_service_record_t *osmv_get_query_svc_rec(IN osm_madw_t *
Packit 13e616
							  p_result_madw,
Packit 13e616
							  IN uint32_t
Packit 13e616
							  result_index)
Packit 13e616
{
Packit 13e616
	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
Packit 13e616
Packit 13e616
	CL_ASSERT(p_result_madw);
Packit 13e616
	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
Packit 13e616
	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD);
Packit 13e616
Packit 13e616
	return ((ib_service_record_t *) osmv_get_query_result(p_result_madw,
Packit 13e616
							      result_index));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_result_madw
Packit 13e616
*		[in] This is a reference to the MAD returned as a result of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	result_index
Packit 13e616
*		[in] A zero-based index indicating which result to return.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This call returns a pointer to the start of a service record result from
Packit 13e616
*	a call to osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_service_record_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_get_query_mc_rec
Packit 13e616
* NAME
Packit 13e616
*	osmv_get_query_mc_rec
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieves a multicast record result from a MAD returned by a call to
Packit 13e616
*	osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_member_rec_t *osmv_get_query_mc_rec(IN osm_madw_t *
Packit 13e616
						     p_result_madw,
Packit 13e616
						     IN uint32_t result_index)
Packit 13e616
{
Packit 13e616
	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
Packit 13e616
Packit 13e616
	CL_ASSERT(p_result_madw);
Packit 13e616
	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
Packit 13e616
	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD);
Packit 13e616
Packit 13e616
	return ((ib_member_rec_t *) osmv_get_query_result(p_result_madw,
Packit 13e616
							  result_index));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_result_madw
Packit 13e616
*		[in] This is a reference to the MAD returned as a result of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	result_index
Packit 13e616
*		[in] A zero-based index indicating which result to return.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This call returns a pointer to the start of a service record result from
Packit 13e616
*	a call to osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_member_rec_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_get_query_inform_info_rec
Packit 13e616
* NAME
Packit 13e616
*	osmv_get_query_inform_info_rec
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Retrieves an InformInfo record result from a MAD returned by
Packit 13e616
*	a call to osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
static inline ib_inform_info_record_t *osmv_get_query_inform_info_rec(IN
Packit 13e616
								      osm_madw_t
Packit 13e616
								      *
Packit 13e616
								      p_result_madw,
Packit 13e616
								      IN
Packit 13e616
								      uint32_t
Packit 13e616
								      result_index)
Packit 13e616
{
Packit 13e616
	ib_sa_mad_t __attribute__((__unused__)) *p_sa_mad;
Packit 13e616
Packit 13e616
	CL_ASSERT(p_result_madw);
Packit 13e616
	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
Packit 13e616
	CL_ASSERT(p_sa_mad
Packit 13e616
		  && p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD);
Packit 13e616
Packit 13e616
	return ((ib_inform_info_record_t *) osmv_get_query_result(p_result_madw,
Packit 13e616
								  result_index));
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_result_madw
Packit 13e616
*		[in] This is a reference to the MAD returned as a result of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	result_index
Packit 13e616
*		[in] A zero-based index indicating which result to return.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This call returns a pointer to the start of a service record result from
Packit 13e616
*	a call to osmv_query_sa().
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_inform_info_record_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_pfn_query_cb_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_pfn_query_cb_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	User-defined callback invoked on completion of subnet administration
Packit 13e616
*	query.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef void
Packit 13e616
 (*osmv_pfn_query_cb_t) (IN osmv_query_res_t * p_query_res);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*	p_query_res
Packit 13e616
*		[in] This is a reference to a structure containing the result of
Packit 13e616
*		the query.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This routine is invoked to notify a client of the result of a subnet
Packit 13e616
*	administration query.  The p_query_rec parameter references the result
Packit 13e616
*	of the query and, in the case of a successful query, any information
Packit 13e616
*	returned by subnet administration.
Packit 13e616
*
Packit 13e616
*	In the kernel, this callback is usually invoked using a tasklet,
Packit 13e616
*	dependent on the implementation of the underlying verbs provider driver.
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_res_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****s* OpenSM Vendor SA Client/osmv_query_req_t
Packit 13e616
* NAME
Packit 13e616
*	osmv_query_req_t
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Information used to request an access layer provided query of subnet
Packit 13e616
*	administration.
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
typedef struct _osmv_query_req {
Packit 13e616
	osmv_query_type_t query_type;
Packit 13e616
	const void *p_query_input;
Packit 13e616
	ib_net64_t sm_key;
Packit 13e616
Packit 13e616
	uint32_t timeout_ms;
Packit 13e616
	uint32_t retry_cnt;
Packit 13e616
	osmv_flags_t flags;
Packit 13e616
Packit 13e616
	const void *query_context;
Packit 13e616
	osmv_pfn_query_cb_t pfn_query_cb;
Packit 13e616
	int with_grh;
Packit 13e616
	ib_gid_t gid;
Packit 13e616
} osmv_query_req_t;
Packit 13e616
/*
Packit 13e616
* FIELDS
Packit 13e616
*	query_type
Packit 13e616
*		Indicates the type of query that the access layer should
Packit 13e616
*		perform.
Packit 13e616
*
Packit 13e616
*	p_query_input
Packit 13e616
*		A pointer to the input for the query.  The data referenced by
Packit 13e616
*		this structure is dependent on the type of query being requested
Packit 13e616
*		and is determined by the specified query_type.
Packit 13e616
*
Packit 13e616
*	sm_key
Packit 13e616
*		The SM_Key to be provided with the SA MAD for authentication.
Packit 13e616
*		Normally 0 is used.
Packit 13e616
*
Packit 13e616
*	timeout_ms
Packit 13e616
*		Specifies the number of milliseconds to wait for a response for
Packit 13e616
*		this query until retrying or timing out the request.
Packit 13e616
*
Packit 13e616
*	retry_cnt
Packit 13e616
*		Specifies the number of times that the query will be retried
Packit 13e616
*		before failing the request.
Packit 13e616
*
Packit 13e616
*	flags
Packit 13e616
*		Used to describe the mode of operation.  Set to IB_FLAGS_SYNC to
Packit 13e616
*		process the called routine synchronously.
Packit 13e616
*
Packit 13e616
*	query_context
Packit 13e616
*		User-defined context information associated with this query.
Packit 13e616
*		The context data is returned to the user as a part of their
Packit 13e616
*		query callback.
Packit 13e616
*
Packit 13e616
*	pfn_query_cb
Packit 13e616
*		A user-defined callback that is invoked upon completion of the
Packit 13e616
*		query.
Packit 13e616
*
Packit 13e616
*	with_grh
Packit 13e616
*		Indicates that SA queries should be sent with GRH.
Packit 13e616
*
Packit 13e616
*	gid
Packit 13e616
*		Used to store the SM/SA GID.
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*	This structure is used when requesting an osm vendor provided query
Packit 13e616
*	of subnet administration.  Clients specify the type of query through
Packit 13e616
*	the query_type field.  Based on the type of query, the p_query_input
Packit 13e616
*	field is set to reference the appropriate data structure.
Packit 13e616
*
Packit 13e616
*	The information referenced by the p_query_input field is one of the
Packit 13e616
*	following:
Packit 13e616
*
Packit 13e616
*		-- a NULL terminated service name
Packit 13e616
*		-- a service id
Packit 13e616
*		-- a single GUID
Packit 13e616
*		-- a pair of GUIDs specified through an osmv_guid_pair_t structure
Packit 13e616
*		-- a pair of GIDs specified through an osmv_gid_pair_t structure
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
*	osmv_query_type_t, osmv_pfn_query_cb_t, osmv_guid_pair_t,
Packit 13e616
*	osmv_gid_pair_t
Packit 13e616
*****/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_bind_sa
Packit 13e616
* NAME
Packit 13e616
*   osmv_bind_sa
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*	Bind to the SA service and return a handle to be used for later
Packit 13e616
*  queries.
Packit 13e616
*
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
osm_bind_handle_t
Packit 13e616
osmv_bind_sa(IN osm_vendor_t * const p_vend,
Packit 13e616
	     IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*   p_vend
Packit 13e616
*	[in] an osm_vendor object to work with
Packit 13e616
*
Packit 13e616
*   p_mad_pool
Packit 13e616
*	[in] mad pool to obtain madw from
Packit 13e616
*
Packit 13e616
*   port_guid
Packit 13e616
*	[in] the port guid to attach to.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	Bind handle to be used for later SA queries or OSM_BIND_INVALID_HANDLE
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
* osmv_query_sa
Packit 13e616
*********/
Packit 13e616
Packit 13e616
/****f* OpenSM Vendor SA Client/osmv_query_sa
Packit 13e616
* NAME
Packit 13e616
*   osmv_query_sa
Packit 13e616
*
Packit 13e616
* DESCRIPTION
Packit 13e616
*   Query the SA given an SA query request (similar to IBAL ib_query).
Packit 13e616
*
Packit 13e616
* SYNOPSIS
Packit 13e616
*/
Packit 13e616
ib_api_status_t
Packit 13e616
osmv_query_sa(IN osm_bind_handle_t h_bind,
Packit 13e616
	      IN const osmv_query_req_t * const p_query_req);
Packit 13e616
/*
Packit 13e616
* PARAMETERS
Packit 13e616
*   h_bind
Packit 13e616
*	[in] bind handle for this port. Should be previously
Packit 13e616
*       obtained by calling osmv_bind_sa
Packit 13e616
*
Packit 13e616
*   p_query_req
Packit 13e616
*	[in] an SA query request structure.
Packit 13e616
*
Packit 13e616
* RETURN VALUE
Packit 13e616
*	IB_SUCCESS if completed successfuly (or in ASYNC mode
Packit 13e616
*	if the request was sent).
Packit 13e616
*
Packit 13e616
* NOTES
Packit 13e616
*
Packit 13e616
* SEE ALSO
Packit 13e616
* osmv_bind_sa
Packit 13e616
*********/
Packit 13e616
Packit 13e616
END_C_DECLS
Packit 13e616
#endif				/* _OSM_VENDOR_SA_API_H_ */