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