1321936Shselasky/*
2321936Shselasky * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
3321936Shselasky * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved.
4321936Shselasky *
5321936Shselasky * This software is available to you under a choice of one of two
6321936Shselasky * licenses.  You may choose to be licensed under the terms of the GNU
7321936Shselasky * General Public License (GPL) Version 2, available from the file
8321936Shselasky * COPYING in the main directory of this source tree, or the
9321936Shselasky * OpenIB.org BSD license below:
10321936Shselasky *
11321936Shselasky *     Redistribution and use in source and binary forms, with or
12321936Shselasky *     without modification, are permitted provided that the following
13321936Shselasky *     conditions are met:
14321936Shselasky *
15321936Shselasky *      - Redistributions of source code must retain the above
16321936Shselasky *        copyright notice, this list of conditions and the following
17321936Shselasky *        disclaimer.
18321936Shselasky *
19321936Shselasky *      - Redistributions in binary form must reproduce the above
20321936Shselasky *        copyright notice, this list of conditions and the following
21321936Shselasky *        disclaimer in the documentation and/or other materials
22321936Shselasky *        provided with the distribution.
23321936Shselasky *
24321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31321936Shselasky * SOFTWARE.
32321936Shselasky *
33321936Shselasky */
34321936Shselasky
35321936Shselasky/*
36321936Shselasky * Abstract:
37321936Shselasky * 	Header file that describes Unicast Cache functions.
38321936Shselasky *
39321936Shselasky * Environment:
40321936Shselasky * 	Linux User Mode
41321936Shselasky *
42321936Shselasky * $Revision: 1.4 $
43321936Shselasky */
44321936Shselasky
45321936Shselasky#ifndef _OSM_UCAST_CACHE_H_
46321936Shselasky#define _OSM_UCAST_CACHE_H_
47321936Shselasky
48321936Shselasky#include <iba/ib_types.h>
49321936Shselasky#include <complib/cl_qmap.h>
50321936Shselasky#include <opensm/osm_switch.h>
51321936Shselasky
52321936Shselasky#ifdef __cplusplus
53321936Shselasky#  define BEGIN_C_DECLS extern "C" {
54321936Shselasky#  define END_C_DECLS   }
55321936Shselasky#else				/* !__cplusplus */
56321936Shselasky#  define BEGIN_C_DECLS
57321936Shselasky#  define END_C_DECLS
58321936Shselasky#endif				/* __cplusplus */
59321936Shselasky
60321936ShselaskyBEGIN_C_DECLS
61321936Shselasky
62321936Shselaskystruct osm_ucast_mgr;
63321936Shselasky
64321936Shselasky/****h* OpenSM/Unicast Manager/Unicast Cache
65321936Shselasky* NAME
66321936Shselasky*	Unicast Cache
67321936Shselasky*
68321936Shselasky* DESCRIPTION
69321936Shselasky*	The Unicast Cache object encapsulates the information
70321936Shselasky*	needed to cache and write unicast routing of the subnet.
71321936Shselasky*
72321936Shselasky*	The Unicast Cache object is NOT thread safe.
73321936Shselasky*
74321936Shselasky*	This object should be treated as opaque and should be
75321936Shselasky*	manipulated only through the provided functions.
76321936Shselasky*
77321936Shselasky* AUTHOR
78321936Shselasky*	Yevgeny Kliteynik, Mellanox
79321936Shselasky*
80321936Shselasky*********/
81321936Shselasky
82321936Shselasky/****f* OpenSM: Unicast Cache/osm_ucast_cache_invalidate
83321936Shselasky* NAME
84321936Shselasky*	osm_ucast_cache_invalidate
85321936Shselasky*
86321936Shselasky* DESCRIPTION
87321936Shselasky*	The osm_ucast_cache_invalidate function purges the
88321936Shselasky*	unicast cache and marks the cache as invalid.
89321936Shselasky*
90321936Shselasky* SYNOPSIS
91321936Shselasky*/
92321936Shselaskyvoid osm_ucast_cache_invalidate(struct osm_ucast_mgr *p_mgr);
93321936Shselasky/*
94321936Shselasky* PARAMETERS
95321936Shselasky*	p_mgr
96321936Shselasky*		[in] Pointer to the ucast mgr object.
97321936Shselasky*
98321936Shselasky* RETURN VALUE
99321936Shselasky*	This function does not return any value.
100321936Shselasky*
101321936Shselasky* NOTES
102321936Shselasky*
103321936Shselasky* SEE ALSO
104321936Shselasky*	Unicast Manager object
105321936Shselasky*********/
106321936Shselasky
107321936Shselasky/****f* OpenSM: Unicast Cache/osm_ucast_cache_check_new_link
108321936Shselasky* NAME
109321936Shselasky*	osm_ucast_cache_check_new_link
110321936Shselasky*
111321936Shselasky* DESCRIPTION
112321936Shselasky*	The osm_ucast_cache_check_new_link checks whether
113321936Shselasky*	the newly discovered link still allows us to use
114321936Shselasky*	cached unicast routing.
115321936Shselasky*
116321936Shselasky* SYNOPSIS
117321936Shselasky*/
118321936Shselaskyvoid osm_ucast_cache_check_new_link(struct osm_ucast_mgr *p_mgr,
119321936Shselasky				    osm_node_t * p_node_1, uint8_t port_num_1,
120321936Shselasky				    osm_node_t * p_node_2, uint8_t port_num_2);
121321936Shselasky/*
122321936Shselasky* PARAMETERS
123321936Shselasky*	p_mgr
124321936Shselasky*		[in] Pointer to the unicast manager object.
125321936Shselasky*
126321936Shselasky*	physp1
127321936Shselasky*		[in] Pointer to the first physical port of the link.
128321936Shselasky*
129321936Shselasky*	physp2
130321936Shselasky*		[in] Pointer to the second physical port of the link.
131321936Shselasky*
132321936Shselasky* RETURN VALUE
133321936Shselasky*	This function does not return any value.
134321936Shselasky*
135321936Shselasky* NOTES
136321936Shselasky*	The function checks whether the link was previously
137321936Shselasky*	cached/dropped or is this a completely new link.
138321936Shselasky*	If it decides that the new link makes cached routing
139321936Shselasky*	invalid, the cache is purged and marked as invalid.
140321936Shselasky*
141321936Shselasky* SEE ALSO
142321936Shselasky*	Unicast Cache object
143321936Shselasky*********/
144321936Shselasky
145321936Shselasky/****f* OpenSM: Unicast Cache/osm_ucast_cache_add_link
146321936Shselasky* NAME
147321936Shselasky*	osm_ucast_cache_add_link
148321936Shselasky*
149321936Shselasky* DESCRIPTION
150321936Shselasky*	The osm_ucast_cache_add_link adds link to the cache.
151321936Shselasky*
152321936Shselasky* SYNOPSIS
153321936Shselasky*/
154321936Shselaskyvoid osm_ucast_cache_add_link(struct osm_ucast_mgr *p_mgr,
155321936Shselasky			      osm_physp_t * physp1, osm_physp_t * physp2);
156321936Shselasky/*
157321936Shselasky* PARAMETERS
158321936Shselasky*	p_mgr
159321936Shselasky*		[in] Pointer to the unicast manager object.
160321936Shselasky*
161321936Shselasky*	physp1
162321936Shselasky*		[in] Pointer to the first physical port of the link.
163321936Shselasky*
164321936Shselasky*	physp2
165321936Shselasky*		[in] Pointer to the second physical port of the link.
166321936Shselasky*
167321936Shselasky* RETURN VALUE
168321936Shselasky*	This function does not return any value.
169321936Shselasky*
170321936Shselasky* NOTES
171321936Shselasky*	Since the cache operates with ports and not links,
172321936Shselasky*	the function adds two port entries (both sides of the
173321936Shselasky*	link) to the cache.
174321936Shselasky*	If it decides that the dropped link makes cached routing
175321936Shselasky*	invalid, the cache is purged and marked as invalid.
176321936Shselasky*
177321936Shselasky* SEE ALSO
178321936Shselasky*	Unicast Manager object
179321936Shselasky*********/
180321936Shselasky
181321936Shselasky/****f* OpenSM: Unicast Cache/osm_ucast_cache_add_node
182321936Shselasky* NAME
183321936Shselasky*	osm_ucast_cache_add_node
184321936Shselasky*
185321936Shselasky* DESCRIPTION
186321936Shselasky*	The osm_ucast_cache_add_node adds node and all
187321936Shselasky*	its links to the cache.
188321936Shselasky*
189321936Shselasky* SYNOPSIS
190321936Shselasky*/
191321936Shselaskyvoid osm_ucast_cache_add_node(struct osm_ucast_mgr *p_mgr, osm_node_t * p_node);
192321936Shselasky/*
193321936Shselasky* PARAMETERS
194321936Shselasky*	p_mgr
195321936Shselasky*		[in] Pointer to the unicast manager object.
196321936Shselasky*
197321936Shselasky*	p_node
198321936Shselasky*		[in] Pointer to the node object that should be cached.
199321936Shselasky*
200321936Shselasky* RETURN VALUE
201321936Shselasky*	This function does not return any value.
202321936Shselasky*
203321936Shselasky* NOTES
204321936Shselasky*	If the function decides that the dropped node makes cached
205321936Shselasky*	routing invalid, the cache is purged and marked as invalid.
206321936Shselasky*
207321936Shselasky* SEE ALSO
208321936Shselasky*	Unicast Manager object
209321936Shselasky*********/
210321936Shselasky
211321936Shselasky/****f* OpenSM: Unicast Cache/osm_ucast_cache_process
212321936Shselasky* NAME
213321936Shselasky*	osm_ucast_cache_process
214321936Shselasky*
215321936Shselasky* DESCRIPTION
216321936Shselasky*	The osm_ucast_cache_process function writes the
217321936Shselasky*	cached unicast routing on the subnet switches.
218321936Shselasky*
219321936Shselasky* SYNOPSIS
220321936Shselasky*/
221321936Shselaskyint osm_ucast_cache_process(struct osm_ucast_mgr *p_mgr);
222321936Shselasky/*
223321936Shselasky* PARAMETERS
224321936Shselasky*	p_mgr
225321936Shselasky*		[in] Pointer to the unicast manager object.
226321936Shselasky*
227321936Shselasky* RETURN VALUE
228321936Shselasky*	This function returns zero on sucess and non-zero
229321936Shselasky*	value otherwise.
230321936Shselasky*
231321936Shselasky* NOTES
232321936Shselasky*	Iterates through all the subnet switches and writes
233321936Shselasky*	the LFTs that were calculated during the last routing
234321936Shselasky*       engine execution to the switches.
235321936Shselasky*
236321936Shselasky* SEE ALSO
237321936Shselasky*	Unicast Manager object
238321936Shselasky*********/
239321936Shselasky
240321936ShselaskyEND_C_DECLS
241321936Shselasky#endif				/* _OSM_UCAST_CACHE_H_ */
242