xref: /freebsd/contrib/ofed/opensm/include/opensm/osm_remote_sm.h (revision 59c8e88e72633afbc47a4ace0d2170d00d51f7dc)
1 /*
2  * Copyright (c) 2004-2009 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.
5  *
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:
11  *
12  *     Redistribution and use in source and binary forms, with or
13  *     without modification, are permitted provided that the following
14  *     conditions are met:
15  *
16  *      - Redistributions of source code must retain the above
17  *        copyright notice, this list of conditions and the following
18  *        disclaimer.
19  *
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.
24  *
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
32  * SOFTWARE.
33  *
34  */
35 
36 /*
37  * Abstract:
38  * 	Declaration of osm_sm_t, osm_remote_sm_t.
39  *	This object represents an IBA subnet.
40  *	This object is part of the OpenSM family of objects.
41  */
42 
43 #ifndef _OSM_REMOTE_SM_H_
44 #define _OSM_REMOTE_SM_H_
45 
46 #include <iba/ib_types.h>
47 #include <opensm/osm_base.h>
48 #include <opensm/osm_port.h>
49 
50 #ifdef __cplusplus
51 #  define BEGIN_C_DECLS extern "C" {
52 #  define END_C_DECLS   }
53 #else				/* !__cplusplus */
54 #  define BEGIN_C_DECLS
55 #  define END_C_DECLS
56 #endif				/* __cplusplus */
57 
58 BEGIN_C_DECLS
59 /****h* OpenSM/Remote SM
60 * NAME
61 *	Remote SM
62 *
63 * DESCRIPTION
64 *	The Remote SM object encapsulates the information tracked for
65 *	other SM ports on the subnet.
66 *
67 *	The Remote SM object is thread safe.
68 *
69 *	This object should be treated as opaque and should
70 *	be manipulated only through the provided functions.
71 *
72 * AUTHOR
73 *	Steve King, Intel
74 *
75 *********/
76 /****s* OpenSM: Remote SM/osm_remote_sm_t
77 * NAME
78 *	osm_remote_sm_t
79 *
80 * DESCRIPTION
81 *	Remote Subnet Manager structure.
82 *
83 *	This object should be treated as opaque and should
84 *	be manipulated only through the provided functions.
85 *
86 * SYNOPSIS
87 */
88 typedef struct osm_remote_sm {
89 	cl_map_item_t map_item;
90 	ib_sm_info_t smi;
91 } osm_remote_sm_t;
92 /*
93 * FIELDS
94 *	map_item
95 *		Linkage for the cl_qmap container.  MUST BE FIRST ELEMENT!!
96 *	p_port
97 *		Pointer to the port object for this SM.
98 *
99 *	smi
100 *		The SMInfo attribute for this SM.
101 *
102 * SEE ALSO
103 *********/
104 
105 /****f* OpenSM: SM/osm_remote_sm_construct
106 * NAME
107 *	osm_remote_sm_construct
108 *
109 * DESCRIPTION
110 *	This function constructs an Remote SM object.
111 *
112 * SYNOPSIS
113 */
114 void osm_remote_sm_construct(IN osm_remote_sm_t * p_sm);
115 /*
116 * PARAMETERS
117 *	p_sm
118 *		[in] Pointer to an Remote SM object to construct.
119 *
120 * RETURN VALUE
121 *	This function does not return a value.
122 *
123 * NOTES
124 *	Allows calling osm_remote_sm_init, osm_remote_sm_destroy
125 *
126 *	Calling osm_remote_sm_construct is a prerequisite to calling any other
127 *	method except osm_remote_sm_init.
128 *
129 * SEE ALSO
130 *	SM object, osm_remote_sm_init, osm_remote_sm_destroy
131 *********/
132 
133 /****f* OpenSM: SM/osm_remote_sm_destroy
134 * NAME
135 *	osm_remote_sm_destroy
136 *
137 * DESCRIPTION
138 *	The osm_remote_sm_destroy function destroys an SM, releasing
139 *	all resources.
140 *
141 * SYNOPSIS
142 */
143 void osm_remote_sm_destroy(IN osm_remote_sm_t * p_sm);
144 /*
145 * PARAMETERS
146 *	p_sm
147 *		[in] Pointer to an Remote SM object to destroy.
148 *
149 * RETURN VALUE
150 *	This function does not return a value.
151 *
152 * NOTES
153 *	Performs any necessary cleanup of the specified Remote SM object.
154 *	Further operations should not be attempted on the destroyed object.
155 *	This function should only be called after a call to
156 *	osm_remote_sm_construct or osm_remote_sm_init.
157 *
158 * SEE ALSO
159 *	Remote SM object, osm_remote_sm_construct, osm_remote_sm_init
160 *********/
161 
162 /****f* OpenSM: SM/osm_remote_sm_init
163 * NAME
164 *	osm_remote_sm_init
165 *
166 * DESCRIPTION
167 *	The osm_remote_sm_init function initializes an Remote SM object for use.
168 *
169 * SYNOPSIS
170 */
171 void osm_remote_sm_init(IN osm_remote_sm_t * p_sm, IN const ib_sm_info_t * p_smi);
172 /*
173 * PARAMETERS
174 *	p_sm
175 *		[in] Pointer to an osm_remote_sm_t object to initialize.
176 *
177 *	p_port
178 *		[in] Pointer to the Remote SM's port object.
179 *
180 *	p_smi
181 *		[in] Pointer to the SMInfo attribute for this SM.
182 *
183 * RETURN VALUES
184 *	This function does not return a value.
185 *
186 * NOTES
187 *	Allows calling other Remote SM methods.
188 *
189 * SEE ALSO
190 *	Remote SM object, osm_remote_sm_construct, osm_remote_sm_destroy
191 *********/
192 
193 END_C_DECLS
194 #endif				/* _OSM_REMOTE_SM_H_ */
195