2 * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2008 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_ucast_mgr_t.
39 * This object represents the Unicast Manager object.
40 * This object is part of the OpenSM family of objects.
43 #ifndef _OSM_UCAST_MGR_H_
44 #define _OSM_UCAST_MGR_H_
46 #include <complib/cl_passivelock.h>
47 #include <complib/cl_qlist.h>
48 #include <opensm/osm_madw.h>
49 #include <opensm/osm_subnet.h>
50 #include <opensm/osm_switch.h>
51 #include <opensm/osm_log.h>
52 #include <opensm/osm_ucast_cache.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/Unicast Manager
68 * The Unicast Manager object encapsulates the information
69 * needed to control unicast LID forwarding on the subnet.
71 * The Unicast 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: Unicast Manager/osm_ucast_mgr_t
86 * Unicast Manager structure.
88 * This object should be treated as opaque and should
89 * be manipulated only through the provided functions.
93 typedef struct osm_ucast_mgr {
98 cl_qlist_t port_order_list;
100 boolean_t some_hop_count_set;
101 cl_qmap_t cache_sw_tbl;
102 boolean_t cache_valid;
107 * Pointer to the SM object.
110 * Pointer to the Subnet object for this subnet.
113 * Pointer to the log object.
116 * Pointer to the serializing lock.
119 * Dimension Order Routing (DOR) will be done
122 * List of ports ordered for routing.
125 * Initialized to FALSE at the beginning of the algorithm,
126 * set to TRUE by osm_ucast_mgr_set_fwd_table() if any mad
130 * Initialized to FALSE at the beginning of each the min hop
131 * tables calculation iteration cycle, set to TRUE to indicate
132 * that some hop count changes were done.
135 * Cached switches table.
138 * TRUE if the unicast cache is valid.
141 * Unicast Manager object
144 /****f* OpenSM: Unicast Manager/osm_ucast_mgr_construct
146 * osm_ucast_mgr_construct
149 * This function constructs a Unicast Manager object.
153 void osm_ucast_mgr_construct(IN osm_ucast_mgr_t * const p_mgr);
157 * [in] Pointer to a Unicast Manager object to construct.
160 * This function does not return a value.
163 * Allows osm_ucast_mgr_destroy
165 * Calling osm_ucast_mgr_construct is a prerequisite to calling any other
166 * method except osm_ucast_mgr_init.
169 * Unicast Manager object, osm_ucast_mgr_init,
170 * osm_ucast_mgr_destroy
173 /****f* OpenSM: Unicast Manager/osm_ucast_mgr_destroy
175 * osm_ucast_mgr_destroy
178 * The osm_ucast_mgr_destroy function destroys the object, releasing
183 void osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr);
187 * [in] Pointer to the object to destroy.
190 * This function does not return a value.
193 * Performs any necessary cleanup of the specified
194 * Unicast Manager object.
195 * Further operations should not be attempted on the destroyed object.
196 * This function should only be called after a call to
197 * osm_ucast_mgr_construct or osm_ucast_mgr_init.
200 * Unicast Manager object, osm_ucast_mgr_construct,
204 /****f* OpenSM: Unicast Manager/osm_ucast_mgr_init
209 * The osm_ucast_mgr_init function initializes a
210 * Unicast Manager object for use.
215 osm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN struct osm_sm * sm);
219 * [in] Pointer to an osm_ucast_mgr_t object to initialize.
222 * [in] Pointer to the SM object.
225 * IB_SUCCESS if the Unicast Manager object was initialized
229 * Allows calling other Unicast Manager methods.
232 * Unicast Manager object, osm_ucast_mgr_construct,
233 * osm_ucast_mgr_destroy
236 /****f* OpenSM: Unicast Manager/osm_ucast_mgr_set_fwd_table
238 * osm_ucast_mgr_set_fwd_table
241 * Setup forwarding table for the switch (from prepared new_lft).
245 int osm_ucast_mgr_set_fwd_table(IN osm_ucast_mgr_t * const p_mgr,
246 IN osm_switch_t * const p_sw);
250 * [in] Pointer to an osm_ucast_mgr_t object.
253 * [in] Pointer to an osm_switch_t object.
259 /****f* OpenSM: Unicast Manager/osm_ucast_mgr_build_lid_matrices
261 * osm_ucast_mgr_build_lid_matrices
264 * Build switches's lid matrices.
268 int osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr);
272 * [in] Pointer to an osm_ucast_mgr_t object.
275 * This function processes the subnet, configuring switches'
276 * min hops tables (aka lid matrices).
282 /****f* OpenSM: Unicast Manager/osm_ucast_mgr_process
284 * osm_ucast_mgr_process
287 * Process and configure the subnet's unicast forwarding tables.
291 int osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr);
295 * [in] Pointer to an osm_ucast_mgr_t object.
298 * Returns zero on success and negative value on failure.
301 * This function processes the subnet, configuring switch
302 * unicast forwarding tables.
305 * Unicast Manager, Node Info Response Controller
308 #endif /* _OSM_UCAST_MGR_H_ */