2 * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 * Declaration of osm_sa_mad_ctrl_t.
39 * This object represents a controller that receives the IBA SA
40 * attributes from a node.
41 * This object is part of the OpenSM family of objects.
44 #ifndef _OSM_SA_MAD_CTRL_H_
45 #define _OSM_SA_MAD_CTRL_H_
47 #include <complib/cl_dispatcher.h>
48 #include <opensm/osm_stats.h>
49 #include <opensm/osm_subnet.h>
50 #include <opensm/osm_madw.h>
51 #include <opensm/osm_mad_pool.h>
52 #include <opensm/osm_log.h>
55 # define BEGIN_C_DECLS extern "C" {
56 # define END_C_DECLS }
57 #else /* !__cplusplus */
58 # define BEGIN_C_DECLS
60 #endif /* __cplusplus */
63 /****h* OpenSM/SA MAD Controller
68 * The SA MAD Controller object encapsulates
69 * the information needed to receive MADs from the transport layer.
71 * The SA MAD Controller object is thread safe.
73 * This object should be treated as opaque and should be
74 * manipulated only through the provided functions.
77 * Ranjit Pandit, Intel
82 /****s* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_t
87 * SA MAD Controller structure.
89 * This object should be treated as opaque and should
90 * be manipulated only through the provided functions.
94 typedef struct osm_sa_mad_ctrl {
97 osm_mad_pool_t *p_mad_pool;
98 osm_vendor_t *p_vendor;
99 osm_bind_handle_t h_bind;
100 cl_dispatcher_t *p_disp;
101 cl_disp_reg_handle_t h_disp;
102 osm_stats_t *p_stats;
108 * Pointer to the SA object.
111 * Pointer to the log object.
114 * Pointer to the MAD pool.
117 * Pointer to the vendor specific interfaces object.
120 * Bind handle returned by the transport layer.
123 * Pointer to the Dispatcher.
126 * Handle returned from dispatcher registration.
129 * Pointer to the OpenSM statistics block.
132 * SA MAD Controller object
136 /****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_construct
138 * osm_sa_mad_ctrl_construct
141 * This function constructs a SA MAD Controller object.
145 void osm_sa_mad_ctrl_construct(IN osm_sa_mad_ctrl_t * const p_ctrl);
149 * [in] Pointer to a SA MAD Controller
150 * object to construct.
153 * This function does not return a value.
156 * Allows calling osm_sa_mad_ctrl_init, and osm_sa_mad_ctrl_destroy.
158 * Calling osm_sa_mad_ctrl_construct is a prerequisite to calling any other
159 * method except osm_sa_mad_ctrl_init.
162 * SA MAD Controller object, osm_sa_mad_ctrl_init,
163 * osm_sa_mad_ctrl_destroy
166 /****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_destroy
168 * osm_sa_mad_ctrl_destroy
171 * The osm_sa_mad_ctrl_destroy function destroys the object, releasing
176 void osm_sa_mad_ctrl_destroy(IN osm_sa_mad_ctrl_t * const p_ctrl);
180 * [in] Pointer to the object to destroy.
183 * This function does not return a value.
186 * Performs any necessary cleanup of the specified
187 * SA MAD Controller object.
188 * Further operations should not be attempted on the destroyed object.
189 * This function should only be called after a call to
190 * osm_sa_mad_ctrl_construct or osm_sa_mad_ctrl_init.
193 * SA MAD Controller object, osm_sa_mad_ctrl_construct,
194 * osm_sa_mad_ctrl_init
197 /****f* OpenSM: SA MAD Controller/osm_sa_mad_ctrl_init
199 * osm_sa_mad_ctrl_init
202 * The osm_sa_mad_ctrl_init function initializes a
203 * SA MAD Controller object for use.
207 ib_api_status_t osm_sa_mad_ctrl_init(IN osm_sa_mad_ctrl_t * const p_ctrl,
208 IN struct osm_sa * sa,
209 IN osm_mad_pool_t * const p_mad_pool,
210 IN osm_vendor_t * const p_vendor,
211 IN osm_subn_t * const p_subn,
212 IN osm_log_t * const p_log,
213 IN osm_stats_t * const p_stats,
214 IN cl_dispatcher_t * const p_disp);
218 * [in] Pointer to an osm_sa_mad_ctrl_t object to initialize.
221 * [in] Pointer to the SA object.
224 * [in] Pointer to the MAD pool.
227 * [in] Pointer to the vendor specific interfaces object.
230 * [in] Pointer to the log object.
233 * [in] Pointer to the OpenSM stastics block.
236 * [in] Pointer to the OpenSM central Dispatcher.
239 * IB_SUCCESS if the SA MAD Controller object was initialized
243 * Allows calling other SA MAD Controller methods.
246 * SA MAD Controller object, osm_sa_mad_ctrl_construct,
247 * osm_sa_mad_ctrl_destroy
250 /****f* OpenSM: SA/osm_sa_mad_ctrl_bind
252 * osm_sa_mad_ctrl_bind
255 * Binds the SA MAD Controller object to a port guid.
260 osm_sa_mad_ctrl_bind(IN osm_sa_mad_ctrl_t * const p_ctrl,
261 IN const ib_net64_t port_guid);
265 * [in] Pointer to an osm_sa_mad_ctrl_t object to initialize.
268 * [in] Local port GUID with which to bind.
275 * A given SA MAD Controller object can only be bound to one
281 /****f* OpenSM: SA/osm_sa_mad_ctrl_unbind
283 * osm_sa_mad_ctrl_unbind
286 * Un-Binds the SA MAD Controller object from the IB port
290 ib_api_status_t osm_sa_mad_ctrl_unbind(IN osm_sa_mad_ctrl_t * const p_ctrl);
294 * [in] Pointer to an osm_sa_mad_ctrl_t object to initialize.
300 * A given SA MAD Controller should be previously bound to IB
306 /****f* OpenSM: SA/osm_sa_mad_ctrl_get_bind_handle
308 * osm_sa_mad_ctrl_get_bind_handle
311 * Returns the bind handle.
315 static inline osm_bind_handle_t
316 osm_sa_mad_ctrl_get_bind_handle(IN const osm_sa_mad_ctrl_t * const p_ctrl)
318 return (p_ctrl->h_bind);
324 * [in] Pointer to an osm_sa_mad_ctrl_t object.
327 * Returns the bind handle, which may be OSM_BIND_INVALID_HANDLE
328 * if no port has been bound.
331 * A given SA MAD Controller object can only be bound to one
338 #endif /* _OSM_SA_MAD_CTRL_H_ */