1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004-2008 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 * Declaration of osm_sa_mad_ctrl_t. 39219820Sjeff * This object represents a controller that receives the IBA SA 40219820Sjeff * attributes from a node. 41219820Sjeff * This object is part of the OpenSM family of objects. 42219820Sjeff */ 43219820Sjeff 44219820Sjeff#ifndef _OSM_SA_MAD_CTRL_H_ 45219820Sjeff#define _OSM_SA_MAD_CTRL_H_ 46219820Sjeff 47219820Sjeff#include <complib/cl_dispatcher.h> 48219820Sjeff#include <opensm/osm_stats.h> 49219820Sjeff#include <opensm/osm_subnet.h> 50219820Sjeff#include <opensm/osm_madw.h> 51219820Sjeff#include <opensm/osm_mad_pool.h> 52219820Sjeff#include <opensm/osm_log.h> 53219820Sjeff 54219820Sjeff#ifdef __cplusplus 55219820Sjeff# define BEGIN_C_DECLS extern "C" { 56219820Sjeff# define END_C_DECLS } 57219820Sjeff#else /* !__cplusplus */ 58219820Sjeff# define BEGIN_C_DECLS 59219820Sjeff# define END_C_DECLS 60219820Sjeff#endif /* __cplusplus */ 61219820Sjeff 62219820SjeffBEGIN_C_DECLS 63219820Sjeff/****h* OpenSM/SA MAD Controller 64219820Sjeff* NAME 65219820Sjeff* SA MAD Controller 66219820Sjeff* 67219820Sjeff* DESCRIPTION 68219820Sjeff* The SA MAD Controller object encapsulates 69219820Sjeff* the information needed to receive MADs from the transport layer. 70219820Sjeff* 71219820Sjeff* The SA MAD Controller object is thread safe. 72219820Sjeff* 73219820Sjeff* This object should be treated as opaque and should be 74219820Sjeff* manipulated only through the provided functions. 75219820Sjeff* 76219820Sjeff* AUTHOR 77219820Sjeff* Ranjit Pandit, Intel 78219820Sjeff* 79219820Sjeff*********/ 80219820Sjeff 81219820Sjeffstruct osm_sa; 82219820Sjeff/****s* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_t 83219820Sjeff* NAME 84219820Sjeff* osm_sa_mad_ctrl_t 85219820Sjeff* 86219820Sjeff* DESCRIPTION 87219820Sjeff* SA MAD Controller structure. 88219820Sjeff* 89219820Sjeff* This object should be treated as opaque and should 90219820Sjeff* be manipulated only through the provided functions. 91219820Sjeff* 92219820Sjeff* SYNOPSIS 93219820Sjeff*/ 94219820Sjefftypedef struct osm_sa_mad_ctrl { 95219820Sjeff struct osm_sa *sa; 96219820Sjeff osm_log_t *p_log; 97219820Sjeff osm_mad_pool_t *p_mad_pool; 98219820Sjeff osm_vendor_t *p_vendor; 99219820Sjeff osm_bind_handle_t h_bind; 100219820Sjeff cl_dispatcher_t *p_disp; 101219820Sjeff cl_disp_reg_handle_t h_disp; 102219820Sjeff osm_stats_t *p_stats; 103219820Sjeff osm_subn_t *p_subn; 104219820Sjeff} osm_sa_mad_ctrl_t; 105219820Sjeff/* 106219820Sjeff* FIELDS 107219820Sjeff* sa 108219820Sjeff* Pointer to the SA object. 109219820Sjeff* 110219820Sjeff* p_log 111219820Sjeff* Pointer to the log object. 112219820Sjeff* 113219820Sjeff* p_mad_pool 114219820Sjeff* Pointer to the MAD pool. 115219820Sjeff* 116219820Sjeff* p_vendor 117219820Sjeff* Pointer to the vendor specific interfaces object. 118219820Sjeff* 119219820Sjeff* h_bind 120219820Sjeff* Bind handle returned by the transport layer. 121219820Sjeff* 122219820Sjeff* p_disp 123219820Sjeff* Pointer to the Dispatcher. 124219820Sjeff* 125219820Sjeff* h_disp 126219820Sjeff* Handle returned from dispatcher registration. 127219820Sjeff* 128219820Sjeff* p_stats 129219820Sjeff* Pointer to the OpenSM statistics block. 130219820Sjeff* 131219820Sjeff* SEE ALSO 132219820Sjeff* SA MAD Controller object 133219820Sjeff* SA MADr object 134219820Sjeff*********/ 135219820Sjeff 136219820Sjeff/****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_construct 137219820Sjeff* NAME 138219820Sjeff* osm_sa_mad_ctrl_construct 139219820Sjeff* 140219820Sjeff* DESCRIPTION 141219820Sjeff* This function constructs a SA MAD Controller object. 142219820Sjeff* 143219820Sjeff* SYNOPSIS 144219820Sjeff*/ 145219820Sjeffvoid osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * const p_ctrl); 146219820Sjeff/* 147219820Sjeff* PARAMETERS 148219820Sjeff* p_ctrl 149219820Sjeff* [in] Pointer to a SA MAD Controller 150219820Sjeff* object to construct. 151219820Sjeff* 152219820Sjeff* RETURN VALUE 153219820Sjeff* This function does not return a value. 154219820Sjeff* 155219820Sjeff* NOTES 156219820Sjeff* Allows calling osm_sa_mad_ctrl_init, and osm_sa_mad_ctrl_destroy. 157219820Sjeff* 158219820Sjeff* Calling osm_sa_mad_ctrl_construct is a prerequisite to calling any other 159219820Sjeff* method except osm_sa_mad_ctrl_init. 160219820Sjeff* 161219820Sjeff* SEE ALSO 162219820Sjeff* SA MAD Controller object, osm_sa_mad_ctrl_init, 163219820Sjeff* osm_sa_mad_ctrl_destroy 164219820Sjeff*********/ 165219820Sjeff 166219820Sjeff/****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_destroy 167219820Sjeff* NAME 168219820Sjeff* osm_sa_mad_ctrl_destroy 169219820Sjeff* 170219820Sjeff* DESCRIPTION 171219820Sjeff* The osm_sa_mad_ctrl_destroy function destroys the object, releasing 172219820Sjeff* all resources. 173219820Sjeff* 174219820Sjeff* SYNOPSIS 175219820Sjeff*/ 176219820Sjeffvoid osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * const p_ctrl); 177219820Sjeff/* 178219820Sjeff* PARAMETERS 179219820Sjeff* p_ctrl 180219820Sjeff* [in] Pointer to the object to destroy. 181219820Sjeff* 182219820Sjeff* RETURN VALUE 183219820Sjeff* This function does not return a value. 184219820Sjeff* 185219820Sjeff* NOTES 186219820Sjeff* Performs any necessary cleanup of the specified 187219820Sjeff* SA MAD Controller object. 188219820Sjeff* Further operations should not be attempted on the destroyed object. 189219820Sjeff* This function should only be called after a call to 190219820Sjeff* osm_sa_mad_ctrl_construct or osm_sa_mad_ctrl_init. 191219820Sjeff* 192219820Sjeff* SEE ALSO 193219820Sjeff* SA MAD Controller object, osm_sa_mad_ctrl_construct, 194219820Sjeff* osm_sa_mad_ctrl_init 195219820Sjeff*********/ 196219820Sjeff 197219820Sjeff/****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_init 198219820Sjeff* NAME 199219820Sjeff* osm_sa_mad_ctrl_init 200219820Sjeff* 201219820Sjeff* DESCRIPTION 202219820Sjeff* The osm_sa_mad_ctrl_init function initializes a 203219820Sjeff* SA MAD Controller object for use. 204219820Sjeff* 205219820Sjeff* SYNOPSIS 206219820Sjeff*/ 207219820Sjeffib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl, 208219820Sjeff IN struct osm_sa * sa, 209219820Sjeff IN osm_mad_pool_t * const p_mad_pool, 210219820Sjeff IN osm_vendor_t * const p_vendor, 211219820Sjeff IN osm_subn_t * const p_subn, 212219820Sjeff IN osm_log_t * const p_log, 213219820Sjeff IN osm_stats_t * const p_stats, 214219820Sjeff IN cl_dispatcher_t * const p_disp); 215219820Sjeff/* 216219820Sjeff* PARAMETERS 217219820Sjeff* p_ctrl 218219820Sjeff* [in] Pointer to an osm_sa_mad_ctrl_t object to initialize. 219219820Sjeff* 220219820Sjeff* sa 221219820Sjeff* [in] Pointer to the SA object. 222219820Sjeff* 223219820Sjeff* p_mad_pool 224219820Sjeff* [in] Pointer to the MAD pool. 225219820Sjeff* 226219820Sjeff* p_vendor 227219820Sjeff* [in] Pointer to the vendor specific interfaces object. 228219820Sjeff* 229219820Sjeff* p_log 230219820Sjeff* [in] Pointer to the log object. 231219820Sjeff* 232219820Sjeff* p_stats 233219820Sjeff* [in] Pointer to the OpenSM stastics block. 234219820Sjeff* 235219820Sjeff* p_disp 236219820Sjeff* [in] Pointer to the OpenSM central Dispatcher. 237219820Sjeff* 238219820Sjeff* RETURN VALUES 239219820Sjeff* IB_SUCCESS if the SA MAD Controller object was initialized 240219820Sjeff* successfully. 241219820Sjeff* 242219820Sjeff* NOTES 243219820Sjeff* Allows calling other SA MAD Controller methods. 244219820Sjeff* 245219820Sjeff* SEE ALSO 246219820Sjeff* SA MAD Controller object, osm_sa_mad_ctrl_construct, 247219820Sjeff* osm_sa_mad_ctrl_destroy 248219820Sjeff*********/ 249219820Sjeff 250219820Sjeff/****f* OpenSM: SA/osm_sa_mad_ctrl_bind 251219820Sjeff* NAME 252219820Sjeff* osm_sa_mad_ctrl_bind 253219820Sjeff* 254219820Sjeff* DESCRIPTION 255219820Sjeff* Binds the SA MAD Controller object to a port guid. 256219820Sjeff* 257219820Sjeff* SYNOPSIS 258219820Sjeff*/ 259219820Sjeffib_api_status_t 260219820Sjeffosm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl, 261219820Sjeff IN const ib_net64_t port_guid); 262219820Sjeff/* 263219820Sjeff* PARAMETERS 264219820Sjeff* p_ctrl 265219820Sjeff* [in] Pointer to an osm_sa_mad_ctrl_t object to initialize. 266219820Sjeff* 267219820Sjeff* port_guid 268219820Sjeff* [in] Local port GUID with which to bind. 269219820Sjeff* 270219820Sjeff* 271219820Sjeff* RETURN VALUES 272219820Sjeff* None 273219820Sjeff* 274219820Sjeff* NOTES 275219820Sjeff* A given SA MAD Controller object can only be bound to one 276219820Sjeff* port at a time. 277219820Sjeff* 278219820Sjeff* SEE ALSO 279219820Sjeff*********/ 280219820Sjeff 281219820Sjeff/****f* OpenSM: SA/osm_sa_mad_ctrl_unbind 282219820Sjeff* NAME 283219820Sjeff* osm_sa_mad_ctrl_unbind 284219820Sjeff* 285219820Sjeff* DESCRIPTION 286219820Sjeff* Un-Binds the SA MAD Controller object from the IB port 287219820Sjeff* 288219820Sjeff* SYNOPSIS 289219820Sjeff*/ 290219820Sjeffib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * const p_ctrl); 291219820Sjeff/* 292219820Sjeff* PARAMETERS 293219820Sjeff* p_ctrl 294219820Sjeff* [in] Pointer to an osm_sa_mad_ctrl_t object to initialize. 295219820Sjeff* 296219820Sjeff* RETURN VALUES 297219820Sjeff* None 298219820Sjeff* 299219820Sjeff* NOTES 300219820Sjeff* A given SA MAD Controller should be previously bound to IB 301219820Sjeff* port. 302219820Sjeff* 303219820Sjeff* SEE ALSO 304219820Sjeff*********/ 305219820Sjeff 306219820Sjeff/****f* OpenSM: SA/osm_sa_mad_ctrl_get_bind_handle 307219820Sjeff* NAME 308219820Sjeff* osm_sa_mad_ctrl_get_bind_handle 309219820Sjeff* 310219820Sjeff* DESCRIPTION 311219820Sjeff* Returns the bind handle. 312219820Sjeff* 313219820Sjeff* SYNOPSIS 314219820Sjeff*/ 315219820Sjeffstatic inline osm_bind_handle_t 316219820Sjeffosm_sa_mad_ctrl_get_bind_handle(IN const osm_sa_mad_ctrl_t * const p_ctrl) 317219820Sjeff{ 318219820Sjeff return (p_ctrl->h_bind); 319219820Sjeff} 320219820Sjeff 321219820Sjeff/* 322219820Sjeff* PARAMETERS 323219820Sjeff* p_ctrl 324219820Sjeff* [in] Pointer to an osm_sa_mad_ctrl_t object. 325219820Sjeff* 326219820Sjeff* RETURN VALUES 327219820Sjeff* Returns the bind handle, which may be OSM_BIND_INVALID_HANDLE 328219820Sjeff* if no port has been bound. 329219820Sjeff* 330219820Sjeff* NOTES 331219820Sjeff* A given SA MAD Controller object can only be bound to one 332219820Sjeff* port at a time. 333219820Sjeff* 334219820Sjeff* SEE ALSO 335219820Sjeff*********/ 336219820Sjeff 337219820SjeffEND_C_DECLS 338219820Sjeff#endif /* _OSM_SA_MAD_CTRL_H_ */ 339