1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004-2006 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_sm_t, osm_remote_sm_t.
39219820Sjeff *	This object represents an IBA subnet.
40219820Sjeff *	This object is part of the OpenSM family of objects.
41219820Sjeff */
42219820Sjeff
43219820Sjeff#ifndef _OSM_REMOTE_SM_H_
44219820Sjeff#define _OSM_REMOTE_SM_H_
45219820Sjeff
46219820Sjeff#include <iba/ib_types.h>
47219820Sjeff#include <opensm/osm_base.h>
48219820Sjeff#include <opensm/osm_port.h>
49219820Sjeff
50219820Sjeff#ifdef __cplusplus
51219820Sjeff#  define BEGIN_C_DECLS extern "C" {
52219820Sjeff#  define END_C_DECLS   }
53219820Sjeff#else				/* !__cplusplus */
54219820Sjeff#  define BEGIN_C_DECLS
55219820Sjeff#  define END_C_DECLS
56219820Sjeff#endif				/* __cplusplus */
57219820Sjeff
58219820SjeffBEGIN_C_DECLS
59219820Sjeff/****h* OpenSM/Remote SM
60219820Sjeff* NAME
61219820Sjeff*	Remote SM
62219820Sjeff*
63219820Sjeff* DESCRIPTION
64219820Sjeff*	The Remote SM object encapsulates the information tracked for
65219820Sjeff*	other SM ports on the subnet.
66219820Sjeff*
67219820Sjeff*	The Remote SM object is thread safe.
68219820Sjeff*
69219820Sjeff*	This object should be treated as opaque and should
70219820Sjeff*	be manipulated only through the provided functions.
71219820Sjeff*
72219820Sjeff* AUTHOR
73219820Sjeff*	Steve King, Intel
74219820Sjeff*
75219820Sjeff*********/
76219820Sjeff/****s* OpenSM: Remote SM/osm_remote_sm_t
77219820Sjeff* NAME
78219820Sjeff*	osm_remote_sm_t
79219820Sjeff*
80219820Sjeff* DESCRIPTION
81219820Sjeff*	Remote Subnet Manager structure.
82219820Sjeff*
83219820Sjeff*	This object should be treated as opaque and should
84219820Sjeff*	be manipulated only through the provided functions.
85219820Sjeff*
86219820Sjeff* SYNOPSIS
87219820Sjeff*/
88219820Sjefftypedef struct osm_remote_sm {
89219820Sjeff	cl_map_item_t map_item;
90219820Sjeff	const osm_port_t *p_port;
91219820Sjeff	ib_sm_info_t smi;
92219820Sjeff} osm_remote_sm_t;
93219820Sjeff/*
94219820Sjeff* FIELDS
95219820Sjeff*	map_item
96219820Sjeff*		Linkage for the cl_qmap container.  MUST BE FIRST ELEMENT!!
97219820Sjeff*	p_port
98219820Sjeff*		Pointer to the port object for this SM.
99219820Sjeff*
100219820Sjeff*	smi
101219820Sjeff*		The SMInfo attribute for this SM.
102219820Sjeff*
103219820Sjeff* SEE ALSO
104219820Sjeff*********/
105219820Sjeff
106219820Sjeff/****f* OpenSM: SM/osm_remote_sm_construct
107219820Sjeff* NAME
108219820Sjeff*	osm_remote_sm_construct
109219820Sjeff*
110219820Sjeff* DESCRIPTION
111219820Sjeff*	This function constructs an Remote SM object.
112219820Sjeff*
113219820Sjeff* SYNOPSIS
114219820Sjeff*/
115219820Sjeffvoid osm_remote_sm_construct(IN osm_remote_sm_t * const p_sm);
116219820Sjeff/*
117219820Sjeff* PARAMETERS
118219820Sjeff*	p_sm
119219820Sjeff*		[in] Pointer to an Remote SM object to construct.
120219820Sjeff*
121219820Sjeff* RETURN VALUE
122219820Sjeff*	This function does not return a value.
123219820Sjeff*
124219820Sjeff* NOTES
125219820Sjeff*	Allows calling osm_remote_sm_init, osm_remote_sm_destroy
126219820Sjeff*
127219820Sjeff*	Calling osm_remote_sm_construct is a prerequisite to calling any other
128219820Sjeff*	method except osm_remote_sm_init.
129219820Sjeff*
130219820Sjeff* SEE ALSO
131219820Sjeff*	SM object, osm_remote_sm_init, osm_remote_sm_destroy
132219820Sjeff*********/
133219820Sjeff
134219820Sjeff/****f* OpenSM: SM/osm_remote_sm_destroy
135219820Sjeff* NAME
136219820Sjeff*	osm_remote_sm_destroy
137219820Sjeff*
138219820Sjeff* DESCRIPTION
139219820Sjeff*	The osm_remote_sm_destroy function destroys an SM, releasing
140219820Sjeff*	all resources.
141219820Sjeff*
142219820Sjeff* SYNOPSIS
143219820Sjeff*/
144219820Sjeffvoid osm_remote_sm_destroy(IN osm_remote_sm_t * const p_sm);
145219820Sjeff/*
146219820Sjeff* PARAMETERS
147219820Sjeff*	p_sm
148219820Sjeff*		[in] Pointer to an Remote SM object to destroy.
149219820Sjeff*
150219820Sjeff* RETURN VALUE
151219820Sjeff*	This function does not return a value.
152219820Sjeff*
153219820Sjeff* NOTES
154219820Sjeff*	Performs any necessary cleanup of the specified Remote SM object.
155219820Sjeff*	Further operations should not be attempted on the destroyed object.
156219820Sjeff*	This function should only be called after a call to
157219820Sjeff*	osm_remote_sm_construct or osm_remote_sm_init.
158219820Sjeff*
159219820Sjeff* SEE ALSO
160219820Sjeff*	Remote SM object, osm_remote_sm_construct, osm_remote_sm_init
161219820Sjeff*********/
162219820Sjeff
163219820Sjeff/****f* OpenSM: SM/osm_remote_sm_init
164219820Sjeff* NAME
165219820Sjeff*	osm_remote_sm_init
166219820Sjeff*
167219820Sjeff* DESCRIPTION
168219820Sjeff*	The osm_remote_sm_init function initializes an Remote SM object for use.
169219820Sjeff*
170219820Sjeff* SYNOPSIS
171219820Sjeff*/
172219820Sjeffvoid
173219820Sjeffosm_remote_sm_init(IN osm_remote_sm_t * const p_sm,
174219820Sjeff		   IN const osm_port_t * const p_port,
175219820Sjeff		   IN const ib_sm_info_t * const p_smi);
176219820Sjeff/*
177219820Sjeff* PARAMETERS
178219820Sjeff*	p_sm
179219820Sjeff*		[in] Pointer to an osm_remote_sm_t object to initialize.
180219820Sjeff*
181219820Sjeff*	p_port
182219820Sjeff*		[in] Pointer to the Remote SM's port object.
183219820Sjeff*
184219820Sjeff*	p_smi
185219820Sjeff*		[in] Pointer to the SMInfo attribute for this SM.
186219820Sjeff*
187219820Sjeff* RETURN VALUES
188219820Sjeff*	This function does not return a value.
189219820Sjeff*
190219820Sjeff* NOTES
191219820Sjeff*	Allows calling other Remote SM methods.
192219820Sjeff*
193219820Sjeff* SEE ALSO
194219820Sjeff*	Remote SM object, osm_remote_sm_construct, osm_remote_sm_destroy
195219820Sjeff*********/
196219820Sjeff
197219820SjeffEND_C_DECLS
198219820Sjeff#endif				/* _OSM_REMOTE_SM_H_ */
199