1 /* 2 * Copyright (c) 2008 Mellanox Technologies LTD. All rights reserved. 3 * 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: 9 * 10 * Redistribution and use in source and binary forms, with or 11 * without modification, are permitted provided that the following 12 * conditions are met: 13 * 14 * - Redistributions of source code must retain the above 15 * copyright notice, this list of conditions and the following 16 * disclaimer. 17 * 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. 22 * 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 30 * SOFTWARE. 31 * 32 */ 33 34 /* 35 * Abstract: 36 * Header file that describes Unicast Cache functions. 37 * 38 * Environment: 39 * Linux User Mode 40 * 41 * $Revision: 1.4 $ 42 */ 43 44 #ifndef _OSM_UCAST_CACHE_H_ 45 #define _OSM_UCAST_CACHE_H_ 46 47 #include <iba/ib_types.h> 48 #include <complib/cl_qmap.h> 49 #include <opensm/osm_switch.h> 50 51 #ifdef __cplusplus 52 # define BEGIN_C_DECLS extern "C" { 53 # define END_C_DECLS } 54 #else /* !__cplusplus */ 55 # define BEGIN_C_DECLS 56 # define END_C_DECLS 57 #endif /* __cplusplus */ 58 59 BEGIN_C_DECLS 60 61 struct osm_ucast_mgr; 62 63 /****h* OpenSM/Unicast Manager/Unicast Cache 64 * NAME 65 * Unicast Cache 66 * 67 * DESCRIPTION 68 * The Unicast Cache object encapsulates the information 69 * needed to cache and write unicast routing of the subnet. 70 * 71 * The Unicast Cache object is NOT thread safe. 72 * 73 * This object should be treated as opaque and should be 74 * manipulated only through the provided functions. 75 * 76 * AUTHOR 77 * Yevgeny Kliteynik, Mellanox 78 * 79 *********/ 80 81 /****f* OpenSM: Unicast Cache/osm_ucast_cache_invalidate 82 * NAME 83 * osm_ucast_cache_invalidate 84 * 85 * DESCRIPTION 86 * The osm_ucast_cache_invalidate function purges the 87 * unicast cache and marks the cache as invalid. 88 * 89 * SYNOPSIS 90 */ 91 void osm_ucast_cache_invalidate(struct osm_ucast_mgr *p_mgr); 92 /* 93 * PARAMETERS 94 * p_mgr 95 * [in] Pointer to the ucast mgr object. 96 * 97 * RETURN VALUE 98 * This function does not return any value. 99 * 100 * NOTES 101 * 102 * SEE ALSO 103 * Unicast Manager object 104 *********/ 105 106 /****f* OpenSM: Unicast Cache/osm_ucast_cache_check_new_link 107 * NAME 108 * osm_ucast_cache_check_new_link 109 * 110 * DESCRIPTION 111 * The osm_ucast_cache_check_new_link checks whether 112 * the newly discovered link still allows us to use 113 * cached unicast routing. 114 * 115 * SYNOPSIS 116 */ 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); 120 /* 121 * PARAMETERS 122 * p_mgr 123 * [in] Pointer to the unicast manager object. 124 * 125 * physp1 126 * [in] Pointer to the first physical port of the link. 127 * 128 * physp2 129 * [in] Pointer to the second physical port of the link. 130 * 131 * RETURN VALUE 132 * This function does not return any value. 133 * 134 * NOTES 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. 139 * 140 * SEE ALSO 141 * Unicast Cache object 142 *********/ 143 144 /****f* OpenSM: Unicast Cache/osm_ucast_cache_add_link 145 * NAME 146 * osm_ucast_cache_add_link 147 * 148 * DESCRIPTION 149 * The osm_ucast_cache_add_link adds link to the cache. 150 * 151 * SYNOPSIS 152 */ 153 void osm_ucast_cache_add_link(struct osm_ucast_mgr *p_mgr, 154 osm_physp_t * physp1, osm_physp_t * physp2); 155 /* 156 * PARAMETERS 157 * p_mgr 158 * [in] Pointer to the unicast manager object. 159 * 160 * physp1 161 * [in] Pointer to the first physical port of the link. 162 * 163 * physp2 164 * [in] Pointer to the second physical port of the link. 165 * 166 * RETURN VALUE 167 * This function does not return any value. 168 * 169 * NOTES 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. 175 * 176 * SEE ALSO 177 * Unicast Manager object 178 *********/ 179 180 /****f* OpenSM: Unicast Cache/osm_ucast_cache_add_node 181 * NAME 182 * osm_ucast_cache_add_node 183 * 184 * DESCRIPTION 185 * The osm_ucast_cache_add_node adds node and all 186 * its links to the cache. 187 * 188 * SYNOPSIS 189 */ 190 void osm_ucast_cache_add_node(struct osm_ucast_mgr *p_mgr, osm_node_t * p_node); 191 /* 192 * PARAMETERS 193 * p_mgr 194 * [in] Pointer to the unicast manager object. 195 * 196 * p_node 197 * [in] Pointer to the node object that should be cached. 198 * 199 * RETURN VALUE 200 * This function does not return any value. 201 * 202 * NOTES 203 * If the function decides that the dropped node makes cached 204 * routing invalid, the cache is purged and marked as invalid. 205 * 206 * SEE ALSO 207 * Unicast Manager object 208 *********/ 209 210 /****f* OpenSM: Unicast Cache/osm_ucast_cache_process 211 * NAME 212 * osm_ucast_cache_process 213 * 214 * DESCRIPTION 215 * The osm_ucast_cache_process function writes the 216 * cached unicast routing on the subnet switches. 217 * 218 * SYNOPSIS 219 */ 220 int osm_ucast_cache_process(struct osm_ucast_mgr *p_mgr); 221 /* 222 * PARAMETERS 223 * p_mgr 224 * [in] Pointer to the unicast manager object. 225 * 226 * RETURN VALUE 227 * This function returns zero on sucess and non-zero 228 * value otherwise. 229 * 230 * NOTES 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. 234 * 235 * SEE ALSO 236 * Unicast Manager object 237 *********/ 238 239 END_C_DECLS 240 #endif /* _OSM_UCAST_CACHE_H_ */ 241