2 * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36 * Header file that describes Unicast Cache functions.
44 #ifndef _OSM_UCAST_CACHE_H_
45 #define _OSM_UCAST_CACHE_H_
47 #include <iba/ib_types.h>
48 #include <complib/cl_qmap.h>
49 #include <opensm/osm_switch.h>
52 # define BEGIN_C_DECLS extern "C" {
53 # define END_C_DECLS }
54 #else /* !__cplusplus */
55 # define BEGIN_C_DECLS
57 #endif /* __cplusplus */
63 /****h* OpenSM/Unicast Manager/Unicast Cache
68 * The Unicast Cache object encapsulates the information
69 * needed to cache and write unicast routing of the subnet.
71 * The Unicast Cache object is NOT thread safe.
73 * This object should be treated as opaque and should be
74 * manipulated only through the provided functions.
77 * Yevgeny Kliteynik, Mellanox
81 /****f* OpenSM: Unicast Cache/osm_ucast_cache_invalidate
83 * osm_ucast_cache_invalidate
86 * The osm_ucast_cache_invalidate function purges the
87 * unicast cache and marks the cache as invalid.
91 void osm_ucast_cache_invalidate(struct osm_ucast_mgr *p_mgr);
95 * [in] Pointer to the ucast mgr object.
98 * This function does not return any value.
103 * Unicast Manager object
106 /****f* OpenSM: Unicast Cache/osm_ucast_cache_check_new_link
108 * osm_ucast_cache_check_new_link
111 * The osm_ucast_cache_check_new_link checks whether
112 * the newly discovered link still allows us to use
113 * cached unicast routing.
117 void osm_ucast_cache_check_new_link(struct osm_ucast_mgr *p_mgr,
118 osm_node_t * p_node_1, uint8_t port_num_1,
119 osm_node_t * p_node_2, uint8_t port_num_2);
123 * [in] Pointer to the unicast manager object.
126 * [in] Pointer to the first physical port of the link.
129 * [in] Pointer to the second physical port of the link.
132 * This function does not return any value.
135 * The function checks whether the link was previously
136 * cached/dropped or is this a completely new link.
137 * If it decides that the new link makes cached routing
138 * invalid, the cache is purged and marked as invalid.
141 * Unicast Cache object
144 /****f* OpenSM: Unicast Cache/osm_ucast_cache_add_link
146 * osm_ucast_cache_add_link
149 * The osm_ucast_cache_add_link adds link to the cache.
153 void osm_ucast_cache_add_link(struct osm_ucast_mgr *p_mgr,
154 osm_physp_t * physp1, osm_physp_t * physp2);
158 * [in] Pointer to the unicast manager object.
161 * [in] Pointer to the first physical port of the link.
164 * [in] Pointer to the second physical port of the link.
167 * This function does not return any value.
170 * Since the cache operates with ports and not links,
171 * the function adds two port entries (both sides of the
172 * link) to the cache.
173 * If it decides that the dropped link makes cached routing
174 * invalid, the cache is purged and marked as invalid.
177 * Unicast Manager object
180 /****f* OpenSM: Unicast Cache/osm_ucast_cache_add_node
182 * osm_ucast_cache_add_node
185 * The osm_ucast_cache_add_node adds node and all
186 * its links to the cache.
190 void osm_ucast_cache_add_node(struct osm_ucast_mgr *p_mgr, osm_node_t * p_node);
194 * [in] Pointer to the unicast manager object.
197 * [in] Pointer to the node object that should be cached.
200 * This function does not return any value.
203 * If the function decides that the dropped node makes cached
204 * routing invalid, the cache is purged and marked as invalid.
207 * Unicast Manager object
210 /****f* OpenSM: Unicast Cache/osm_ucast_cache_process
212 * osm_ucast_cache_process
215 * The osm_ucast_cache_process function writes the
216 * cached unicast routing on the subnet switches.
220 int osm_ucast_cache_process(struct osm_ucast_mgr *p_mgr);
224 * [in] Pointer to the unicast manager object.
227 * This function returns zero on sucess and non-zero
231 * Iterates through all the subnet switches and writes
232 * the LFTs that were calculated during the last routing
233 * engine execution to the switches.
236 * Unicast Manager object
240 #endif /* _OSM_UCAST_CACHE_H_ */