1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved. 3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved. 4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5219820Sjeff * 6219820Sjeff * This software is available to you under a choice of one of two 7219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 8219820Sjeff * General Public License (GPL) Version 2, available from the file 9219820Sjeff * COPYING in the main directory of this source tree, or the 10219820Sjeff * OpenIB.org BSD license below: 11219820Sjeff * 12219820Sjeff * Redistribution and use in source and binary forms, with or 13219820Sjeff * without modification, are permitted provided that the following 14219820Sjeff * conditions are met: 15219820Sjeff * 16219820Sjeff * - Redistributions of source code must retain the above 17219820Sjeff * copyright notice, this list of conditions and the following 18219820Sjeff * disclaimer. 19219820Sjeff * 20219820Sjeff * - Redistributions in binary form must reproduce the above 21219820Sjeff * copyright notice, this list of conditions and the following 22219820Sjeff * disclaimer in the documentation and/or other materials 23219820Sjeff * provided with the distribution. 24219820Sjeff * 25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32219820Sjeff * SOFTWARE. 33219820Sjeff * 34219820Sjeff */ 35219820Sjeff 36219820Sjeff/* 37219820Sjeff * Abstract: 38219820Sjeff * Definition of interface for the MTL Vendor 39219820Sjeff * This object is part of the OpenSM family of objects. 40219820Sjeff */ 41219820Sjeff 42219820Sjeff#ifndef _OSM_VENDOR_MTL_H_ 43219820Sjeff#define _OSM_VENDOR_MTL_H_ 44219820Sjeff 45219820Sjeff#undef IN 46219820Sjeff#undef OUT 47219820Sjeff#include <vapi_types.h> 48219820Sjeff#include <evapi.h> 49219820Sjeff#include <ib_mgt.h> 50219820Sjeff#define IN 51219820Sjeff#define OUT 52219820Sjeff#include "iba/ib_types.h" 53219820Sjeff#include "iba/ib_al.h" 54219820Sjeff#include <complib/cl_thread.h> 55219820Sjeff#include <complib/cl_types_osd.h> 56219820Sjeff#include <opensm/osm_base.h> 57219820Sjeff 58219820Sjeff#ifdef __cplusplus 59219820Sjeff# define BEGIN_C_DECLS extern "C" { 60219820Sjeff# define END_C_DECLS } 61219820Sjeff#else /* !__cplusplus */ 62219820Sjeff# define BEGIN_C_DECLS 63219820Sjeff# define END_C_DECLS 64219820Sjeff#endif /* __cplusplus */ 65219820Sjeff 66219820SjeffBEGIN_C_DECLS 67219820Sjeff/****h* OpenSM/Vendor MTL 68219820Sjeff* NAME 69219820Sjeff* Vendor MTL 70219820Sjeff* 71219820Sjeff* DESCRIPTION 72219820Sjeff* 73219820Sjeff* The Vendor MTL object is thread safe. 74219820Sjeff* 75219820Sjeff* This object should be treated as opaque and should be 76219820Sjeff* manipulated only through the provided functions. 77219820Sjeff* 78219820Sjeff* 79219820Sjeff* AUTHOR 80219820Sjeff* 81219820Sjeff* 82219820Sjeff*********/ 83219820Sjeff/****s* OpenSM: Vendor MTL/osm_ca_info_t 84219820Sjeff* NAME 85219820Sjeff* osm_ca_info_t 86219820Sjeff* 87219820Sjeff* DESCRIPTION 88219820Sjeff* Structure containing information about local Channle Adapters. 89219820Sjeff* 90219820Sjeff* SYNOPSIS 91219820Sjeff*/ 92219820Sjefftypedef struct _osm_ca_info { 93219820Sjeff ib_net64_t guid; 94219820Sjeff size_t attr_size; 95219820Sjeff ib_ca_attr_t *p_attr; 96219820Sjeff 97219820Sjeff} osm_ca_info_t; 98219820Sjeff 99219820Sjeff/* 100219820Sjeff* FIELDS 101219820Sjeff* guid 102219820Sjeff* Node GUID of the local CA. 103219820Sjeff* 104219820Sjeff* attr_size 105219820Sjeff* Size of the CA attributes for this CA. 106219820Sjeff* 107219820Sjeff* p_attr 108219820Sjeff* Pointer to dynamicly allocated CA Attribute structure. 109219820Sjeff* 110219820Sjeff* SEE ALSO 111219820Sjeff*********/ 112219820Sjeff 113219820Sjeff#define OSM_DEFAULT_RETRY_COUNT 3 114219820Sjeff 115219820Sjeff/***** OpenSM: Vendor MTL/osm_vendor_t 116219820Sjeff* NAME 117219820Sjeff* osm_vendor_t 118219820Sjeff* 119219820Sjeff* DESCRIPTION 120219820Sjeff* The structure defining a vendor 121219820Sjeff* 122219820Sjeff* SYNOPSIS 123219820Sjeff*/ 124219820Sjefftypedef struct _osm_vendor { 125219820Sjeff ib_al_handle_t h_al; 126219820Sjeff osm_log_t *p_log; 127219820Sjeff uint32_t ca_count; 128219820Sjeff osm_ca_info_t *p_ca_info; 129219820Sjeff uint32_t timeout; 130219820Sjeff struct osm_transaction_mgr_t *p_transaction_mgr; 131219820Sjeff} osm_vendor_t; 132219820Sjeff 133219820Sjeff/* 134219820Sjeff* FIELDS 135219820Sjeff* h_al 136219820Sjeff* Handle returned by MTL open call (ib_open_al). 137219820Sjeff* 138219820Sjeff* p_log 139219820Sjeff* Pointer to the log object. 140219820Sjeff* 141219820Sjeff* ca_count 142219820Sjeff* Number of CA's in the array pointed to by p_ca_info. 143219820Sjeff* 144219820Sjeff* p_ca_info 145219820Sjeff* Pointer to dynamically allocated array of CA info objects. 146219820Sjeff* 147219820Sjeff* timeout 148219820Sjeff* Transaction timeout time in milliseconds. 149219820Sjeff* 150219820Sjeff* p_transaction_mgr 151219820Sjeff* Pointer to Transaction Manager. 152219820Sjeff* 153219820Sjeff* SEE ALSO 154219820Sjeff*********/ 155219820Sjeff 156219820Sjeff/****f* OpenSM: Vendor MTL/CA Info/osm_ca_info_get_port_guid 157219820Sjeff* NAME 158219820Sjeff* osm_ca_info_get_port_guid 159219820Sjeff* 160219820Sjeff* DESCRIPTION 161219820Sjeff* Returns the port GUID of the specified port owned by this CA. 162219820Sjeff* 163219820Sjeff* SYNOPSIS 164219820Sjeff*/ 165219820Sjeffstatic inline ib_net64_t 166219820Sjeffosm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info, 167219820Sjeff IN const uint8_t index) 168219820Sjeff{ 169219820Sjeff return (p_ca_info->p_attr->p_port_attr[index].port_guid); 170219820Sjeff} 171219820Sjeff 172219820Sjeff/* 173219820Sjeff* PARAMETERS 174219820Sjeff* p_ca_info 175219820Sjeff* [in] Pointer to a CA Info object. 176219820Sjeff* 177219820Sjeff* index 178219820Sjeff* [in] Port "index" for which to retrieve the port GUID. 179219820Sjeff* The index is the offset into the ca's internal array 180219820Sjeff* of port attributes. 181219820Sjeff* 182219820Sjeff* RETURN VALUE 183219820Sjeff* Returns the port GUID of the specified port owned by this CA. 184219820Sjeff* 185219820Sjeff* NOTES 186219820Sjeff* 187219820Sjeff* SEE ALSO 188219820Sjeff*********/ 189219820Sjeff 190219820Sjeff/****f* OpenSM: Vendor MTL/CA Info/osm_ca_info_get_num_ports 191219820Sjeff* NAME 192219820Sjeff* osm_ca_info_get_num_ports 193219820Sjeff* 194219820Sjeff* DESCRIPTION 195219820Sjeff* Returns the number of ports of the given ca_info 196219820Sjeff* 197219820Sjeff* SYNOPSIS 198219820Sjeff*/ 199219820Sjeffstatic inline uint8_t 200219820Sjeffosm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info) 201219820Sjeff{ 202219820Sjeff return (p_ca_info->p_attr->num_ports); 203219820Sjeff} 204219820Sjeff 205219820Sjeff/* 206219820Sjeff* PARAMETERS 207219820Sjeff* p_ca_info 208219820Sjeff* [in] Pointer to a CA Info object. 209219820Sjeff* 210219820Sjeff* RETURN VALUE 211219820Sjeff* Returns the number of CA ports 212219820Sjeff* 213219820Sjeff* NOTES 214219820Sjeff* 215219820Sjeff* SEE ALSO 216219820Sjeff*********/ 217219820Sjeff 218219820Sjeff/****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port 219219820Sjeff * NAME 220219820Sjeff * osm_vendor_get_guid_ca_and_port 221219820Sjeff * 222219820Sjeff * DESCRIPTION 223219820Sjeff * Given the vendor obj and a guid 224219820Sjeff * return the ca id and port number that have that guid 225219820Sjeff * 226219820Sjeff * SYNOPSIS 227219820Sjeff */ 228219820Sjeffib_api_status_t 229219820Sjeffosm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend, 230219820Sjeff IN ib_net64_t const guid, 231219820Sjeff OUT VAPI_hca_hndl_t * p_hca_hndl, 232219820Sjeff OUT VAPI_hca_id_t * p_hca_id, 233219820Sjeff OUT uint32_t * p_port_num); 234219820Sjeff 235219820Sjeff/* 236219820Sjeff* PARAMETERS 237219820Sjeff* p_vend 238219820Sjeff* [in] Pointer to an osm_vendor_t object. 239219820Sjeff* 240219820Sjeff* guid 241219820Sjeff* [in] The guid to search for. 242219820Sjeff* 243219820Sjeff* p_hca_id 244219820Sjeff* [out] The HCA Id (VAPI_hca_id_t *) that the port is found on. 245219820Sjeff* 246219820Sjeff* p_port_num 247219820Sjeff* [out] Pointer to a port number arg to be filled with the port number with the given guid. 248219820Sjeff* 249219820Sjeff* RETURN VALUES 250219820Sjeff* IB_SUCCESS on SUCCESS 251219820Sjeff* IB_INVALID_GUID if the guid is notfound on any Local HCA Port 252219820Sjeff* 253219820Sjeff* NOTES 254219820Sjeff* 255219820Sjeff* SEE ALSO 256219820Sjeff*********/ 257219820Sjeff 258219820Sjeff/****f* OpenSM: Vendor MTL/osm_vendor_get_all_port_attr 259219820Sjeff * NAME 260219820Sjeff * osm_vendor_get_all_port_attr 261219820Sjeff * 262219820Sjeff * DESCRIPTION 263219820Sjeff * Fill in the array of port_attr with all available ports on ALL the 264219820Sjeff * avilable CAs on this machine. 265219820Sjeff * ALSO - 266219820Sjeff * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS 267219820Sjeff * 268219820Sjeff * SYNOPSIS 269219820Sjeff */ 270219820Sjeffib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend, 271219820Sjeff IN ib_port_attr_t * 272219820Sjeff const p_attr_array, 273219820Sjeff IN uint32_t * const p_num_ports); 274219820Sjeff 275219820Sjeff/* 276219820Sjeff* PARAMETERS 277219820Sjeff* p_vend 278219820Sjeff* [in] Pointer to an osm_vendor_t object. 279219820Sjeff* 280219820Sjeff* p_attr_array 281219820Sjeff* [out] Pre-allocated array of port attributes to be filled in 282219820Sjeff* 283219820Sjeff* p_num_ports 284219820Sjeff* [out] The size of the given array. Filled in by the actual numberof ports found. 285219820Sjeff* 286219820Sjeff* RETURN VALUES 287219820Sjeff* IB_SUCCESS if OK 288219820Sjeff* IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided. 289219820Sjeff* 290219820Sjeff* NOTES 291219820Sjeff* 292219820Sjeff* SEE ALSO 293219820Sjeff*********/ 294219820Sjeff 295219820Sjeff#define OSM_BIND_INVALID_HANDLE 0 296219820Sjeff 297219820Sjeff/****s* OpenSM: Vendor MTL/osm_bind_handle_t 298219820Sjeff* NAME 299219820Sjeff* osm_bind_handle_t 300219820Sjeff* 301219820Sjeff* DESCRIPTION 302219820Sjeff* handle returned by the vendor transport bind call. 303219820Sjeff* 304219820Sjeff* SYNOPSIS 305219820Sjeff*/ 306219820Sjefftypedef void *osm_bind_handle_t; 307219820Sjeff 308219820Sjeff/***********/ 309219820Sjeff 310219820Sjeff/****s* OpenSM: Vendor MTL/osm_vend_wrap_t 311219820Sjeff* NAME 312219820Sjeff* MTL Vendor MAD Wrapper 313219820Sjeff* 314219820Sjeff* DESCRIPTION 315219820Sjeff* MTL specific MAD wrapper. MTL transport layer uses this for 316219820Sjeff* housekeeping. 317219820Sjeff* 318219820Sjeff* SYNOPSIS 319219820Sjeff*********/ 320219820Sjefftypedef struct _osm_vend_wrap_t { 321219820Sjeff uint32_t size; 322219820Sjeff osm_bind_handle_t h_bind; 323219820Sjeff // ib_av_handle_t h_av; 324219820Sjeff ib_mad_t *mad_buf_p; 325219820Sjeff void *p_resp_madw; 326219820Sjeff} osm_vend_wrap_t; 327219820Sjeff 328219820Sjeff/* 329219820Sjeff* FIELDS 330219820Sjeff* size 331219820Sjeff* Size of the allocated MAD 332219820Sjeff* 333219820Sjeff* h_bind 334219820Sjeff* Bind handle used on this transaction 335219820Sjeff* 336219820Sjeff* h_av 337219820Sjeff* Address vector handle used for this transaction. 338219820Sjeff* 339219820Sjeff* p_resp_madw 340219820Sjeff* Pointer to the mad wrapper structure used to hold the pending 341219820Sjeff* reponse to the mad, if any. If a response is expected, the 342219820Sjeff* wrapper for the reponse is allocated during the send call. 343219820Sjeff* 344219820Sjeff* SEE ALSO 345219820Sjeff*********/ 346219820Sjeff 347219820SjeffEND_C_DECLS 348219820Sjeff#endif /* _OSM_VENDOR_MTL_H_ */ 349