1321936Shselasky/*
2321936Shselasky * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3321936Shselasky * Copyright (c) 2002-2009 Mellanox Technologies LTD. All rights reserved.
4321936Shselasky * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5321936Shselasky *
6321936Shselasky * This software is available to you under a choice of one of two
7321936Shselasky * licenses.  You may choose to be licensed under the terms of the GNU
8321936Shselasky * General Public License (GPL) Version 2, available from the file
9321936Shselasky * COPYING in the main directory of this source tree, or the
10321936Shselasky * OpenIB.org BSD license below:
11321936Shselasky *
12321936Shselasky *     Redistribution and use in source and binary forms, with or
13321936Shselasky *     without modification, are permitted provided that the following
14321936Shselasky *     conditions are met:
15321936Shselasky *
16321936Shselasky *      - Redistributions of source code must retain the above
17321936Shselasky *        copyright notice, this list of conditions and the following
18321936Shselasky *        disclaimer.
19321936Shselasky *
20321936Shselasky *      - Redistributions in binary form must reproduce the above
21321936Shselasky *        copyright notice, this list of conditions and the following
22321936Shselasky *        disclaimer in the documentation and/or other materials
23321936Shselasky *        provided with the distribution.
24321936Shselasky *
25321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32321936Shselasky * SOFTWARE.
33321936Shselasky *
34321936Shselasky */
35321936Shselasky
36321936Shselasky/*
37321936Shselasky * Abstract:
38321936Shselasky * 	Declaration of osm_ucast_mgr_t.
39321936Shselasky *	This object represents the Unicast Manager object.
40321936Shselasky *	This object is part of the OpenSM family of objects.
41321936Shselasky */
42321936Shselasky
43321936Shselasky#ifndef _OSM_UCAST_MGR_H_
44321936Shselasky#define _OSM_UCAST_MGR_H_
45321936Shselasky
46321936Shselasky#include <complib/cl_passivelock.h>
47321936Shselasky#include <complib/cl_qlist.h>
48321936Shselasky#include <opensm/osm_madw.h>
49321936Shselasky#include <opensm/osm_subnet.h>
50321936Shselasky#include <opensm/osm_switch.h>
51321936Shselasky#include <opensm/osm_log.h>
52321936Shselasky#include <opensm/osm_ucast_cache.h>
53321936Shselasky
54321936Shselasky#ifdef __cplusplus
55321936Shselasky#  define BEGIN_C_DECLS extern "C" {
56321936Shselasky#  define END_C_DECLS   }
57321936Shselasky#else				/* !__cplusplus */
58321936Shselasky#  define BEGIN_C_DECLS
59321936Shselasky#  define END_C_DECLS
60321936Shselasky#endif				/* __cplusplus */
61321936Shselasky
62321936ShselaskyBEGIN_C_DECLS
63321936Shselasky/****h* OpenSM/Unicast Manager
64321936Shselasky* NAME
65321936Shselasky*	Unicast Manager
66321936Shselasky*
67321936Shselasky* DESCRIPTION
68321936Shselasky*	The Unicast Manager object encapsulates the information
69321936Shselasky*	needed to control unicast LID forwarding on the subnet.
70321936Shselasky*
71321936Shselasky*	The Unicast Manager object is thread safe.
72321936Shselasky*
73321936Shselasky*	This object should be treated as opaque and should be
74321936Shselasky*	manipulated only through the provided functions.
75321936Shselasky*
76321936Shselasky* AUTHOR
77321936Shselasky*	Steve King, Intel
78321936Shselasky*
79321936Shselasky*********/
80321936Shselaskystruct osm_sm;
81321936Shselasky/****s* OpenSM: Unicast Manager/osm_ucast_mgr_t
82321936Shselasky* NAME
83321936Shselasky*	osm_ucast_mgr_t
84321936Shselasky*
85321936Shselasky* DESCRIPTION
86321936Shselasky*	Unicast Manager structure.
87321936Shselasky*
88321936Shselasky*	This object should be treated as opaque and should
89321936Shselasky*	be manipulated only through the provided functions.
90321936Shselasky*
91321936Shselasky* SYNOPSIS
92321936Shselasky*/
93321936Shselaskytypedef struct osm_ucast_mgr {
94321936Shselasky	struct osm_sm *sm;
95321936Shselasky	osm_subn_t *p_subn;
96321936Shselasky	osm_log_t *p_log;
97321936Shselasky	cl_plock_t *p_lock;
98321936Shselasky	uint16_t max_lid;
99321936Shselasky	cl_qlist_t port_order_list;
100321936Shselasky	boolean_t is_dor;
101321936Shselasky	boolean_t some_hop_count_set;
102321936Shselasky	cl_qmap_t cache_sw_tbl;
103321936Shselasky	boolean_t cache_valid;
104321936Shselasky} osm_ucast_mgr_t;
105321936Shselasky/*
106321936Shselasky* FIELDS
107321936Shselasky*	sm
108321936Shselasky*		Pointer to the SM object.
109321936Shselasky*
110321936Shselasky*	p_subn
111321936Shselasky*		Pointer to the Subnet object for this subnet.
112321936Shselasky*
113321936Shselasky*	p_log
114321936Shselasky*		Pointer to the log object.
115321936Shselasky*
116321936Shselasky*	p_lock
117321936Shselasky*		Pointer to the serializing lock.
118321936Shselasky*
119321936Shselasky*	is_dor
120321936Shselasky*		Dimension Order Routing (DOR) will be done
121321936Shselasky*
122321936Shselasky*	port_order_list
123321936Shselasky*		List of ports ordered for routing.
124321936Shselasky*
125321936Shselasky*	some_hop_count_set
126321936Shselasky*		Initialized to FALSE at the beginning of each the min hop
127321936Shselasky*		tables calculation iteration cycle, set to TRUE to indicate
128321936Shselasky*		that some hop count changes were done.
129321936Shselasky*
130321936Shselasky*	cache_sw_tbl
131321936Shselasky*		Cached switches table.
132321936Shselasky*
133321936Shselasky*	cache_valid
134321936Shselasky*		TRUE if the unicast cache is valid.
135321936Shselasky*
136321936Shselasky* SEE ALSO
137321936Shselasky*	Unicast Manager object
138321936Shselasky*********/
139321936Shselasky
140321936Shselasky/****f* OpenSM: Unicast Manager/osm_ucast_mgr_construct
141321936Shselasky* NAME
142321936Shselasky*	osm_ucast_mgr_construct
143321936Shselasky*
144321936Shselasky* DESCRIPTION
145321936Shselasky*	This function constructs a Unicast Manager object.
146321936Shselasky*
147321936Shselasky* SYNOPSIS
148321936Shselasky*/
149321936Shselaskyvoid osm_ucast_mgr_construct(IN osm_ucast_mgr_t * p_mgr);
150321936Shselasky/*
151321936Shselasky* PARAMETERS
152321936Shselasky*	p_mgr
153321936Shselasky*		[in] Pointer to a Unicast Manager object to construct.
154321936Shselasky*
155321936Shselasky* RETURN VALUE
156321936Shselasky*	This function does not return a value.
157321936Shselasky*
158321936Shselasky* NOTES
159321936Shselasky*	Allows osm_ucast_mgr_destroy
160321936Shselasky*
161321936Shselasky*	Calling osm_ucast_mgr_construct is a prerequisite to calling any other
162321936Shselasky*	method except osm_ucast_mgr_init.
163321936Shselasky*
164321936Shselasky* SEE ALSO
165321936Shselasky*	Unicast Manager object, osm_ucast_mgr_init,
166321936Shselasky*	osm_ucast_mgr_destroy
167321936Shselasky*********/
168321936Shselasky
169321936Shselasky/****f* OpenSM: Unicast Manager/osm_ucast_mgr_destroy
170321936Shselasky* NAME
171321936Shselasky*	osm_ucast_mgr_destroy
172321936Shselasky*
173321936Shselasky* DESCRIPTION
174321936Shselasky*	The osm_ucast_mgr_destroy function destroys the object, releasing
175321936Shselasky*	all resources.
176321936Shselasky*
177321936Shselasky* SYNOPSIS
178321936Shselasky*/
179321936Shselaskyvoid osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * p_mgr);
180321936Shselasky/*
181321936Shselasky* PARAMETERS
182321936Shselasky*	p_mgr
183321936Shselasky*		[in] Pointer to the object to destroy.
184321936Shselasky*
185321936Shselasky* RETURN VALUE
186321936Shselasky*	This function does not return a value.
187321936Shselasky*
188321936Shselasky* NOTES
189321936Shselasky*	Performs any necessary cleanup of the specified
190321936Shselasky*	Unicast Manager object.
191321936Shselasky*	Further operations should not be attempted on the destroyed object.
192321936Shselasky*	This function should only be called after a call to
193321936Shselasky*	osm_ucast_mgr_construct or osm_ucast_mgr_init.
194321936Shselasky*
195321936Shselasky* SEE ALSO
196321936Shselasky*	Unicast Manager object, osm_ucast_mgr_construct,
197321936Shselasky*	osm_ucast_mgr_init
198321936Shselasky*********/
199321936Shselasky
200321936Shselasky/****f* OpenSM: Unicast Manager/osm_ucast_mgr_init
201321936Shselasky* NAME
202321936Shselasky*	osm_ucast_mgr_init
203321936Shselasky*
204321936Shselasky* DESCRIPTION
205321936Shselasky*	The osm_ucast_mgr_init function initializes a
206321936Shselasky*	Unicast Manager object for use.
207321936Shselasky*
208321936Shselasky* SYNOPSIS
209321936Shselasky*/
210321936Shselaskyib_api_status_t osm_ucast_mgr_init(IN osm_ucast_mgr_t * p_mgr,
211321936Shselasky				   IN struct osm_sm * sm);
212321936Shselasky/*
213321936Shselasky* PARAMETERS
214321936Shselasky*	p_mgr
215321936Shselasky*		[in] Pointer to an osm_ucast_mgr_t object to initialize.
216321936Shselasky*
217321936Shselasky*	sm
218321936Shselasky*		[in] Pointer to the SM object.
219321936Shselasky*
220321936Shselasky* RETURN VALUES
221321936Shselasky*	IB_SUCCESS if the Unicast Manager object was initialized
222321936Shselasky*	successfully.
223321936Shselasky*
224321936Shselasky* NOTES
225321936Shselasky*	Allows calling other Unicast Manager methods.
226321936Shselasky*
227321936Shselasky* SEE ALSO
228321936Shselasky*	Unicast Manager object, osm_ucast_mgr_construct,
229321936Shselasky*	osm_ucast_mgr_destroy
230321936Shselasky*********/
231321936Shselasky
232321936Shselasky/****f* OpenSM: Unicast Manager/osm_ucast_mgr_set_fwd_tables
233321936Shselasky* NAME
234321936Shselasky*	osm_ucast_mgr_set_fwd_tables
235321936Shselasky*
236321936Shselasky* DESCRIPTION
237321936Shselasky*	Setup forwarding table for the switch (from prepared new_lft).
238321936Shselasky*
239321936Shselasky* SYNOPSIS
240321936Shselasky*/
241321936Shselaskyvoid osm_ucast_mgr_set_fwd_tables(IN osm_ucast_mgr_t * p_mgr);
242321936Shselasky/*
243321936Shselasky* PARAMETERS
244321936Shselasky*	p_mgr
245321936Shselasky*		[in] Pointer to an osm_ucast_mgr_t object.
246321936Shselasky*
247321936Shselasky* SEE ALSO
248321936Shselasky*	Unicast Manager
249321936Shselasky*********/
250321936Shselasky
251321936Shselasky/****f* OpenSM: Unicast Manager/osm_ucast_mgr_build_lid_matrices
252321936Shselasky* NAME
253321936Shselasky*	osm_ucast_mgr_build_lid_matrices
254321936Shselasky*
255321936Shselasky* DESCRIPTION
256321936Shselasky*	Build switches's lid matrices.
257321936Shselasky*
258321936Shselasky* SYNOPSIS
259321936Shselasky*/
260321936Shselaskyint osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * p_mgr);
261321936Shselasky/*
262321936Shselasky* PARAMETERS
263321936Shselasky*	p_mgr
264321936Shselasky*		[in] Pointer to an osm_ucast_mgr_t object.
265321936Shselasky*
266321936Shselasky* NOTES
267321936Shselasky*	This function processes the subnet, configuring switches'
268321936Shselasky*	min hops tables (aka lid matrices).
269321936Shselasky*
270321936Shselasky* SEE ALSO
271321936Shselasky*	Unicast Manager
272321936Shselasky*********/
273321936Shselasky
274321936Shselasky/****f* OpenSM: Unicast Manager/osm_ucast_mgr_process
275321936Shselasky* NAME
276321936Shselasky*	osm_ucast_mgr_process
277321936Shselasky*
278321936Shselasky* DESCRIPTION
279321936Shselasky*	Process and configure the subnet's unicast forwarding tables.
280321936Shselasky*
281321936Shselasky* SYNOPSIS
282321936Shselasky*/
283321936Shselaskyint osm_ucast_mgr_process(IN osm_ucast_mgr_t * p_mgr);
284321936Shselasky/*
285321936Shselasky* PARAMETERS
286321936Shselasky*	p_mgr
287321936Shselasky*		[in] Pointer to an osm_ucast_mgr_t object.
288321936Shselasky*
289321936Shselasky* RETURN VALUES
290321936Shselasky*	Returns zero on success and negative value on failure.
291321936Shselasky*
292321936Shselasky* NOTES
293321936Shselasky*	This function processes the subnet, configuring switch
294321936Shselasky*	unicast forwarding tables.
295321936Shselasky*
296321936Shselasky* SEE ALSO
297321936Shselasky*	Unicast Manager, Node Info Response Controller
298321936Shselasky*********/
299321936Shselasky
300321936Shselaskyint ucast_dummy_build_lid_matrices(void *context);
301321936ShselaskyEND_C_DECLS
302321936Shselasky#endif				/* _OSM_UCAST_MGR_H_ */
303