xref: /freebsd/contrib/ofed/opensm/include/opensm/osm_ucast_cache.h (revision bdd1243df58e60e85101c09001d9812a789b6bc4)
1 /*
2  * Copyright (c) 2008 Voltaire, Inc. All rights reserved.
3  * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved.
4  *
5  * This software is available to you under a choice of one of two
6  * licenses.  You may choose to be licensed under the terms of the GNU
7  * General Public License (GPL) Version 2, available from the file
8  * COPYING in the main directory of this source tree, or the
9  * OpenIB.org BSD license below:
10  *
11  *     Redistribution and use in source and binary forms, with or
12  *     without modification, are permitted provided that the following
13  *     conditions are met:
14  *
15  *      - Redistributions of source code must retain the above
16  *        copyright notice, this list of conditions and the following
17  *        disclaimer.
18  *
19  *      - Redistributions in binary form must reproduce the above
20  *        copyright notice, this list of conditions and the following
21  *        disclaimer in the documentation and/or other materials
22  *        provided with the distribution.
23  *
24  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
28  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
29  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
30  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31  * SOFTWARE.
32  *
33  */
34 
35 /*
36  * Abstract:
37  * 	Header file that describes Unicast Cache functions.
38  *
39  * Environment:
40  * 	Linux User Mode
41  *
42  * $Revision: 1.4 $
43  */
44 
45 #ifndef _OSM_UCAST_CACHE_H_
46 #define _OSM_UCAST_CACHE_H_
47 
48 #include <iba/ib_types.h>
49 #include <complib/cl_qmap.h>
50 #include <opensm/osm_switch.h>
51 
52 #ifdef __cplusplus
53 #  define BEGIN_C_DECLS extern "C" {
54 #  define END_C_DECLS   }
55 #else				/* !__cplusplus */
56 #  define BEGIN_C_DECLS
57 #  define END_C_DECLS
58 #endif				/* __cplusplus */
59 
60 BEGIN_C_DECLS
61 
62 struct osm_ucast_mgr;
63 
64 /****h* OpenSM/Unicast Manager/Unicast Cache
65 * NAME
66 *	Unicast Cache
67 *
68 * DESCRIPTION
69 *	The Unicast Cache object encapsulates the information
70 *	needed to cache and write unicast routing of the subnet.
71 *
72 *	The Unicast Cache object is NOT thread safe.
73 *
74 *	This object should be treated as opaque and should be
75 *	manipulated only through the provided functions.
76 *
77 * AUTHOR
78 *	Yevgeny Kliteynik, Mellanox
79 *
80 *********/
81 
82 /****f* OpenSM: Unicast Cache/osm_ucast_cache_invalidate
83 * NAME
84 *	osm_ucast_cache_invalidate
85 *
86 * DESCRIPTION
87 *	The osm_ucast_cache_invalidate function purges the
88 *	unicast cache and marks the cache as invalid.
89 *
90 * SYNOPSIS
91 */
92 void osm_ucast_cache_invalidate(struct osm_ucast_mgr *p_mgr);
93 /*
94 * PARAMETERS
95 *	p_mgr
96 *		[in] Pointer to the ucast mgr object.
97 *
98 * RETURN VALUE
99 *	This function does not return any value.
100 *
101 * NOTES
102 *
103 * SEE ALSO
104 *	Unicast Manager object
105 *********/
106 
107 /****f* OpenSM: Unicast Cache/osm_ucast_cache_check_new_link
108 * NAME
109 *	osm_ucast_cache_check_new_link
110 *
111 * DESCRIPTION
112 *	The osm_ucast_cache_check_new_link checks whether
113 *	the newly discovered link still allows us to use
114 *	cached unicast routing.
115 *
116 * SYNOPSIS
117 */
118 void osm_ucast_cache_check_new_link(struct osm_ucast_mgr *p_mgr,
119 				    osm_node_t * p_node_1, uint8_t port_num_1,
120 				    osm_node_t * p_node_2, uint8_t port_num_2);
121 /*
122 * PARAMETERS
123 *	p_mgr
124 *		[in] Pointer to the unicast manager object.
125 *
126 *	physp1
127 *		[in] Pointer to the first physical port of the link.
128 *
129 *	physp2
130 *		[in] Pointer to the second physical port of the link.
131 *
132 * RETURN VALUE
133 *	This function does not return any value.
134 *
135 * NOTES
136 *	The function checks whether the link was previously
137 *	cached/dropped or is this a completely new link.
138 *	If it decides that the new link makes cached routing
139 *	invalid, the cache is purged and marked as invalid.
140 *
141 * SEE ALSO
142 *	Unicast Cache object
143 *********/
144 
145 /****f* OpenSM: Unicast Cache/osm_ucast_cache_add_link
146 * NAME
147 *	osm_ucast_cache_add_link
148 *
149 * DESCRIPTION
150 *	The osm_ucast_cache_add_link adds link to the cache.
151 *
152 * SYNOPSIS
153 */
154 void osm_ucast_cache_add_link(struct osm_ucast_mgr *p_mgr,
155 			      osm_physp_t * physp1, osm_physp_t * physp2);
156 /*
157 * PARAMETERS
158 *	p_mgr
159 *		[in] Pointer to the unicast manager object.
160 *
161 *	physp1
162 *		[in] Pointer to the first physical port of the link.
163 *
164 *	physp2
165 *		[in] Pointer to the second physical port of the link.
166 *
167 * RETURN VALUE
168 *	This function does not return any value.
169 *
170 * NOTES
171 *	Since the cache operates with ports and not links,
172 *	the function adds two port entries (both sides of the
173 *	link) to the cache.
174 *	If it decides that the dropped link makes cached routing
175 *	invalid, the cache is purged and marked as invalid.
176 *
177 * SEE ALSO
178 *	Unicast Manager object
179 *********/
180 
181 /****f* OpenSM: Unicast Cache/osm_ucast_cache_add_node
182 * NAME
183 *	osm_ucast_cache_add_node
184 *
185 * DESCRIPTION
186 *	The osm_ucast_cache_add_node adds node and all
187 *	its links to the cache.
188 *
189 * SYNOPSIS
190 */
191 void osm_ucast_cache_add_node(struct osm_ucast_mgr *p_mgr, osm_node_t * p_node);
192 /*
193 * PARAMETERS
194 *	p_mgr
195 *		[in] Pointer to the unicast manager object.
196 *
197 *	p_node
198 *		[in] Pointer to the node object that should be cached.
199 *
200 * RETURN VALUE
201 *	This function does not return any value.
202 *
203 * NOTES
204 *	If the function decides that the dropped node makes cached
205 *	routing invalid, the cache is purged and marked as invalid.
206 *
207 * SEE ALSO
208 *	Unicast Manager object
209 *********/
210 
211 /****f* OpenSM: Unicast Cache/osm_ucast_cache_process
212 * NAME
213 *	osm_ucast_cache_process
214 *
215 * DESCRIPTION
216 *	The osm_ucast_cache_process function writes the
217 *	cached unicast routing on the subnet switches.
218 *
219 * SYNOPSIS
220 */
221 int osm_ucast_cache_process(struct osm_ucast_mgr *p_mgr);
222 /*
223 * PARAMETERS
224 *	p_mgr
225 *		[in] Pointer to the unicast manager object.
226 *
227 * RETURN VALUE
228 *	This function returns zero on sucess and non-zero
229 *	value otherwise.
230 *
231 * NOTES
232 *	Iterates through all the subnet switches and writes
233 *	the LFTs that were calculated during the last routing
234 *       engine execution to the switches.
235 *
236 * SEE ALSO
237 *	Unicast Manager object
238 *********/
239 
240 END_C_DECLS
241 #endif				/* _OSM_UCAST_CACHE_H_ */
242