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_lid_mgr_t.
39 * This object represents the LID Manager object.
40 * This object is part of the OpenSM family of objects.
43 #ifndef _OSM_LID_MGR_H_
44 #define _OSM_LID_MGR_H_
46 #include <complib/cl_passivelock.h>
47 #include <opensm/osm_base.h>
48 #include <opensm/osm_madw.h>
49 #include <opensm/osm_subnet.h>
50 #include <opensm/osm_db.h>
51 #include <opensm/osm_log.h>
54 # define BEGIN_C_DECLS extern "C" {
55 # define END_C_DECLS }
56 #else /* !__cplusplus */
57 # define BEGIN_C_DECLS
59 #endif /* __cplusplus */
62 #define OSM_LID_MGR_LIST_SIZE_MIN 256
63 /****h* OpenSM/LID Manager
68 * The LID Manager object encapsulates the information
69 * needed to control LID assignments on the subnet.
71 * The LID Manager object is thread safe.
73 * This object should be treated as opaque and should be
74 * manipulated only through the provided functions.
81 /****s* OpenSM: LID Manager/osm_lid_mgr_t
86 * LID Manager structure.
88 * This object should be treated as opaque and should
89 * be manipulated only through the provided functions.
93 typedef struct osm_lid_mgr {
99 boolean_t send_set_reqs;
100 osm_db_domain_t *p_g2l;
101 cl_ptr_vector_t used_lids;
102 cl_qlist_t free_ranges;
107 * Pointer to the SM object.
110 * Pointer to the Subnet object for this subnet.
113 * Pointer to the database (persistency) object
116 * Pointer to the log object.
119 * Pointer to the serializing lock.
122 * Boolean to indicate whether any set requests sent.
125 * Pointer to the database domain storing guid to lid mapping.
128 * A vector the maps from the lid to its guid. keeps track of
129 * existing and non existing mapping of guid->lid
132 * A list of available free lid ranges. The list is initialized
133 * by the code that initializes the lid assignment and is consumed
134 * by the procedure that finds a free range. It holds elements of
135 * type osm_lid_mgr_range_t
141 /****f* OpenSM: LID Manager/osm_lid_mgr_construct
143 * osm_lid_mgr_construct
146 * This function constructs a LID Manager object.
150 void osm_lid_mgr_construct(IN osm_lid_mgr_t * const p_mgr);
154 * [in] Pointer to a LID Manager object to construct.
157 * This function does not return a value.
160 * Allows osm_lid_mgr_destroy
162 * Calling osm_lid_mgr_construct is a prerequisite to calling any other
163 * method except osm_lid_mgr_init.
166 * LID Manager object, osm_lid_mgr_init,
167 * osm_lid_mgr_destroy
170 /****f* OpenSM: LID Manager/osm_lid_mgr_destroy
172 * osm_lid_mgr_destroy
175 * The osm_lid_mgr_destroy function destroys the object, releasing
180 void osm_lid_mgr_destroy(IN osm_lid_mgr_t * const p_mgr);
184 * [in] Pointer to the object to destroy.
187 * This function does not return a value.
190 * Performs any necessary cleanup of the specified
191 * LID Manager object.
192 * Further operations should not be attempted on the destroyed object.
193 * This function should only be called after a call to
194 * osm_lid_mgr_construct or osm_lid_mgr_init.
197 * LID Manager object, osm_lid_mgr_construct,
201 /****f* OpenSM: LID Manager/osm_lid_mgr_init
206 * The osm_lid_mgr_init function initializes a
207 * LID Manager object for use.
212 osm_lid_mgr_init(IN osm_lid_mgr_t * const p_mgr, IN struct osm_sm * sm);
216 * [in] Pointer to an osm_lid_mgr_t object to initialize.
219 * [in] Pointer to the SM object for this subnet.
222 * CL_SUCCESS if the LID Manager object was initialized
226 * Allows calling other LID Manager methods.
229 * LID Manager object, osm_lid_mgr_construct,
230 * osm_lid_mgr_destroy
233 /****f* OpenSM: LID Manager/osm_lid_mgr_process_sm
235 * osm_lid_mgr_process_sm
238 * Configures the SM's port with its designated LID values.
242 osm_signal_t osm_lid_mgr_process_sm(IN osm_lid_mgr_t * const p_mgr);
246 * [in] Pointer to an osm_lid_mgr_t object.
249 * Returns the appropriate signal to the caller:
250 * OSM_SIGNAL_DONE - operation is complete
251 * OSM_SIGNAL_DONE_PENDING - local operations are complete, but
252 * transactions are still pending on the wire.
260 /****f* OpenSM: LID Manager/osm_lid_mgr_process_subnet
262 * osm_lid_mgr_process_subnet
265 * Configures subnet ports (except the SM port itself) with their
266 * designated LID values.
270 osm_signal_t osm_lid_mgr_process_subnet(IN osm_lid_mgr_t * const p_mgr);
274 * [in] Pointer to an osm_lid_mgr_t object.
277 * Returns the appropriate signal to the caller:
278 * OSM_SIGNAL_DONE - operation is complete
279 * OSM_SIGNAL_DONE_PENDING - local operations are complete, but
280 * transactions are still pending on the wire.
289 #endif /* _OSM_LID_MGR_H_ */