Blame include/vendor/osm_vendor_ts.h

Packit 13e616
/*
Packit 13e616
 * Copyright (c) 2004, 2005 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
 * 	Definition of interface for the TS Vendor
Packit 13e616
 *	   This object is part of the OpenSM family of objects.
Packit 13e616
 */
Packit 13e616
Packit 13e616
#ifndef _OSM_VENDOR_TS_H_
Packit 13e616
#define _OSM_VENDOR_TS_H_
Packit 13e616
Packit 13e616
#undef IN
Packit 13e616
#undef OUT
Packit 13e616
#include <vapi_types.h>
Packit 13e616
#include <evapi.h>
Packit 13e616
#include <ib/ts_api_ng/useraccess/include/ts_ib_useraccess.h>
Packit 13e616
#define IN
Packit 13e616
#define OUT
Packit 13e616
#include "iba/ib_types.h"
Packit 13e616
#include "iba/ib_al.h"
Packit 13e616
#include <complib/cl_thread.h>
Packit 13e616
#include <complib/cl_types_osd.h>
Packit 13e616
#include <opensm/osm_base.h>
Packit 13e616
#include <opensm/osm_log.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
/****s* OpenSM: Vendor TS/osm_bind_handle_t
Packit 13e616
 * NAME
Packit 13e616
 *   osm_bind_handle_t
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 * 	handle returned by the vendor transport bind call.
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
typedef void *osm_bind_handle_t;
Packit 13e616
/*
Packit 13e616
**********/
Packit 13e616
#define OSM_DEFAULT_RETRY_COUNT 3
Packit 13e616
Packit 13e616
/****s* OpenSM: Vendor osm_ts_bind_info_t
Packit 13e616
 * NAME
Packit 13e616
 *   osm_ts_bind_info_t
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 * 	Handle to the result of binding a class callbacks .
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
typedef struct _osm_ts_bind_info {
Packit 13e616
	int ul_dev_fd;
Packit 13e616
	VAPI_hca_hndl_t hca_hndl;
Packit 13e616
	struct _osm_vendor *p_vend;
Packit 13e616
	void *client_context;
Packit 13e616
	uint8_t port_num;
Packit 13e616
	void *rcv_callback;
Packit 13e616
	void *send_err_callback;
Packit 13e616
	struct _osm_mad_pool *p_osm_pool;
Packit 13e616
	cl_thread_t poller;
Packit 13e616
} osm_ts_bind_info_t;
Packit 13e616
/*
Packit 13e616
 * FIELDS
Packit 13e616
 *	ul_dev_file_hdl
Packit 13e616
 *		the file handle to be used for sending the MADs
Packit 13e616
 *
Packit 13e616
 * hca_hndl
Packit 13e616
 *     Handle to the HCA provided by the underlying VAPI
Packit 13e616
 *
Packit 13e616
 *	p_vend
Packit 13e616
 *		Pointer to the vendor object.
Packit 13e616
 *
Packit 13e616
 *	client_context
Packit 13e616
 *		User's context passed during osm_bind
Packit 13e616
 *
Packit 13e616
 *  hca_id
Packit 13e616
 *     HCA Id we bind to.
Packit 13e616
 *
Packit 13e616
 *	port_num
Packit 13e616
 *		Port number (within the HCA) of the bound port.
Packit 13e616
 *
Packit 13e616
 *	rcv_callback
Packit 13e616
 *		OSM Callback function to be called on receive of MAD.
Packit 13e616
 *
Packit 13e616
 *  send_err_callback
Packit 13e616
 *     OSM Callback to be called on send error.
Packit 13e616
 *
Packit 13e616
 *  p_osm_pool
Packit 13e616
 *     Points to the MAD pool used by OSM
Packit 13e616
 *
Packit 13e616
 *  poller
Packit 13e616
 *     A thread reading from the device file handle
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
/****h* OpenSM/Vendor TS
Packit 13e616
 * NAME
Packit 13e616
 *	Vendor TS
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 *
Packit 13e616
 *	The Vendor TS object is thread safe.
Packit 13e616
 *
Packit 13e616
 *	This object should be treated as opaque and should be
Packit 13e616
 *	manipulated only through the provided functions.
Packit 13e616
 *
Packit 13e616
 *
Packit 13e616
 * AUTHOR
Packit 13e616
 *
Packit 13e616
 *
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
/****s* OpenSM: Vendor TS/osm_ca_info_t
Packit 13e616
 * NAME
Packit 13e616
 *   osm_ca_info_t
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 * 	Structure containing information about local Channle Adapters.
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
typedef struct _osm_ca_info {
Packit 13e616
	ib_net64_t guid;
Packit 13e616
	size_t attr_size;
Packit 13e616
	ib_ca_attr_t *p_attr;
Packit 13e616
Packit 13e616
} osm_ca_info_t;
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * FIELDS
Packit 13e616
 *	guid
Packit 13e616
 *		Node GUID of the local CA.
Packit 13e616
 *
Packit 13e616
 *	attr_size
Packit 13e616
 *		Size of the CA attributes for this CA.
Packit 13e616
 *
Packit 13e616
 *	p_attr
Packit 13e616
 *		Pointer to dynamicly allocated CA Attribute structure.
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
/***** OpenSM: Vendor TS/osm_vendor_t
Packit 13e616
 * NAME
Packit 13e616
 *  osm_vendor_t
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 * 	The structure defining a TS vendor
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
typedef struct _osm_vendor {
Packit 13e616
	osm_log_t *p_log;
Packit 13e616
	uint32_t ca_count;
Packit 13e616
	osm_ca_info_t *p_ca_info;
Packit 13e616
	uint32_t timeout;
Packit 13e616
	struct _osm_transaction_mgr *p_transaction_mgr;
Packit 13e616
	osm_ts_bind_info_t smi_bind;
Packit 13e616
	osm_ts_bind_info_t gsi_bind;
Packit 13e616
} osm_vendor_t;
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * FIELDS
Packit 13e616
 *	h_al
Packit 13e616
 *		Handle returned by TS open call .
Packit 13e616
 *
Packit 13e616
 *	p_log
Packit 13e616
 *		Pointer to the log object.
Packit 13e616
 *
Packit 13e616
 *	ca_count
Packit 13e616
 *		Number of CA's in the array pointed to by p_ca_info.
Packit 13e616
 *
Packit 13e616
 *	p_ca_info
Packit 13e616
 *		Pointer to dynamically allocated array of CA info objects.
Packit 13e616
 *
Packit 13e616
 *	timeout
Packit 13e616
 *		Transaction timeout time in milliseconds.
Packit 13e616
 *
Packit 13e616
 *  p_transaction_mgr
Packit 13e616
 *     Pointer to Transaction Manager.
Packit 13e616
 *
Packit 13e616
 *  smi_bind
Packit 13e616
 *     Bind information for handling SMI MADs
Packit 13e616
 *
Packit 13e616
 *  gsi_bind
Packit 13e616
 *     Bind information for GSI MADs
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Vendor TS/CA Info/osm_ca_info_get_port_guid
Packit 13e616
 * NAME
Packit 13e616
 *	osm_ca_info_get_port_guid
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 *	Returns the port GUID of the specified port owned by this CA.
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
static inline ib_net64_t
Packit 13e616
osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,
Packit 13e616
			  IN const uint8_t index)
Packit 13e616
{
Packit 13e616
	return (p_ca_info->p_attr->p_port_attr[index].port_guid);
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * PARAMETERS
Packit 13e616
 *	p_ca_info
Packit 13e616
 *		[in] Pointer to a CA Info object.
Packit 13e616
 *
Packit 13e616
 *	index
Packit 13e616
 *		[in] Port "index" for which to retrieve the port GUID.
Packit 13e616
 *		The index is the offset into the ca's internal array
Packit 13e616
 *		of port attributes.
Packit 13e616
 *
Packit 13e616
 * RETURN VALUE
Packit 13e616
 *	Returns the port GUID of the specified port owned by this CA.
Packit 13e616
 *
Packit 13e616
 * NOTES
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Vendor TS/CA Info/osm_ca_info_get_num_ports
Packit 13e616
 * NAME
Packit 13e616
 *	osm_ca_info_get_num_ports
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 *	Returns the number of ports of the given ca_info
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
static inline uint8_t
Packit 13e616
osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)
Packit 13e616
{
Packit 13e616
	return (p_ca_info->p_attr->num_ports);
Packit 13e616
}
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * PARAMETERS
Packit 13e616
 *	p_ca_info
Packit 13e616
 *		[in] Pointer to a CA Info object.
Packit 13e616
 *
Packit 13e616
 * RETURN VALUE
Packit 13e616
 *	Returns the number of CA ports
Packit 13e616
 *
Packit 13e616
 * NOTES
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
/****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port
Packit 13e616
 * NAME
Packit 13e616
 *	osm_vendor_get_guid_ca_and_port
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 * Given the vendor obj and a guid
Packit 13e616
 * return the ca id and port number that have that guid
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
ib_api_status_t
Packit 13e616
osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,
Packit 13e616
				IN ib_net64_t const guid,
Packit 13e616
				OUT VAPI_hca_hndl_t * p_hca_hndl,
Packit 13e616
				OUT VAPI_hca_id_t * p_hca_id,
Packit 13e616
				OUT uint32_t * p_port_num);
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * PARAMETERS
Packit 13e616
 *	p_vend
Packit 13e616
 *		[in] Pointer to an osm_vendor_t object.
Packit 13e616
 *
Packit 13e616
 *	guid
Packit 13e616
 *		[in] The guid to search for.
Packit 13e616
 *
Packit 13e616
 *	p_hca_id
Packit 13e616
 *		[out] The HCA Id (VAPI_hca_id_t *) that the port is found on.
Packit 13e616
 *
Packit 13e616
 *	p_port_num
Packit 13e616
 *		[out] Pointer to a port number arg to be filled with the port number with the given guid.
Packit 13e616
 *
Packit 13e616
 * RETURN VALUES
Packit 13e616
 *	IB_SUCCESS on SUCCESS
Packit 13e616
 *  IB_INVALID_GUID if the guid is notfound on any Local HCA Port
Packit 13e616
 *
Packit 13e616
 * NOTES
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
/****f* OpenSM: Vendor TS/osm_vendor_get_all_port_attr
Packit 13e616
 * NAME
Packit 13e616
 *	osm_vendor_get_all_port_attr
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 * Fill in the array of port_attr with all available ports on ALL the
Packit 13e616
 * avilable CAs on this machine.
Packit 13e616
 * ALSO -
Packit 13e616
 * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 */
Packit 13e616
ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
Packit 13e616
					     IN ib_port_attr_t *
Packit 13e616
					     const p_attr_array,
Packit 13e616
					     IN uint32_t * const p_num_ports);
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * PARAMETERS
Packit 13e616
 *	p_vend
Packit 13e616
 *		[in] Pointer to an osm_vendor_t object.
Packit 13e616
 *
Packit 13e616
 *	p_attr_array
Packit 13e616
 *		[out] Pre-allocated array of port attributes to be filled in
Packit 13e616
 *
Packit 13e616
 *	p_num_ports
Packit 13e616
 *		[out] The size of the given array. Filled in by the actual numberof ports found.
Packit 13e616
 *
Packit 13e616
 * RETURN VALUES
Packit 13e616
 *	IB_SUCCESS if OK
Packit 13e616
 *  IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided.
Packit 13e616
 *
Packit 13e616
 * NOTES
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
#define OSM_BIND_INVALID_HANDLE 0
Packit 13e616
Packit 13e616
/****s* OpenSM: Vendor TS/osm_vend_wrap_t
Packit 13e616
 * NAME
Packit 13e616
 *   TS Vendor MAD Wrapper
Packit 13e616
 *
Packit 13e616
 * DESCRIPTION
Packit 13e616
 *	TS specific MAD wrapper. TS transport layer uses this for
Packit 13e616
 *	housekeeping.
Packit 13e616
 *
Packit 13e616
 * SYNOPSIS
Packit 13e616
 *********/
Packit 13e616
typedef struct _osm_vend_wrap_t {
Packit 13e616
	uint32_t size;
Packit 13e616
	osm_bind_handle_t h_bind;
Packit 13e616
	ib_mad_t *p_mad_buf;
Packit 13e616
	void *p_resp_madw;
Packit 13e616
} osm_vend_wrap_t;
Packit 13e616
Packit 13e616
/*
Packit 13e616
 * FIELDS
Packit 13e616
 *	size
Packit 13e616
 *		Size of the allocated MAD
Packit 13e616
 *
Packit 13e616
 *	h_bind
Packit 13e616
 *		Bind handle used on this transaction
Packit 13e616
 *
Packit 13e616
 *	h_av
Packit 13e616
 *		Address vector handle used for this transaction.
Packit 13e616
 *
Packit 13e616
 *	p_resp_madw
Packit 13e616
 *		Pointer to the mad wrapper structure used to hold the pending
Packit 13e616
 *		reponse to the mad, if any.  If a response is expected, the
Packit 13e616
 *		wrapper for the reponse is allocated during the send call.
Packit 13e616
 *
Packit 13e616
 * SEE ALSO
Packit 13e616
 *********/
Packit 13e616
Packit 13e616
END_C_DECLS
Packit 13e616
#endif				/* _OSM_VENDOR_TS_H_ */