1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004-2008 Voltaire, Inc. All rights reserved. 3219820Sjeff * Copyright (c) 2002-2008 Mellanox Technologies LTD. All rights reserved. 4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5219820Sjeff * 6219820Sjeff * This software is available to you under a choice of one of two 7219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 8219820Sjeff * General Public License (GPL) Version 2, available from the file 9219820Sjeff * COPYING in the main directory of this source tree, or the 10219820Sjeff * OpenIB.org BSD license below: 11219820Sjeff * 12219820Sjeff * Redistribution and use in source and binary forms, with or 13219820Sjeff * without modification, are permitted provided that the following 14219820Sjeff * conditions are met: 15219820Sjeff * 16219820Sjeff * - Redistributions of source code must retain the above 17219820Sjeff * copyright notice, this list of conditions and the following 18219820Sjeff * disclaimer. 19219820Sjeff * 20219820Sjeff * - Redistributions in binary form must reproduce the above 21219820Sjeff * copyright notice, this list of conditions and the following 22219820Sjeff * disclaimer in the documentation and/or other materials 23219820Sjeff * provided with the distribution. 24219820Sjeff * 25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32219820Sjeff * SOFTWARE. 33219820Sjeff * 34219820Sjeff */ 35219820Sjeff 36219820Sjeff/* 37219820Sjeff * Abstract: 38219820Sjeff * Declaration of osm_ucast_mgr_t. 39219820Sjeff * This object represents the Unicast Manager object. 40219820Sjeff * This object is part of the OpenSM family of objects. 41219820Sjeff */ 42219820Sjeff 43219820Sjeff#ifndef _OSM_UCAST_MGR_H_ 44219820Sjeff#define _OSM_UCAST_MGR_H_ 45219820Sjeff 46219820Sjeff#include <complib/cl_passivelock.h> 47219820Sjeff#include <complib/cl_qlist.h> 48219820Sjeff#include <opensm/osm_madw.h> 49219820Sjeff#include <opensm/osm_subnet.h> 50219820Sjeff#include <opensm/osm_switch.h> 51219820Sjeff#include <opensm/osm_log.h> 52219820Sjeff#include <opensm/osm_ucast_cache.h> 53219820Sjeff 54219820Sjeff#ifdef __cplusplus 55219820Sjeff# define BEGIN_C_DECLS extern "C" { 56219820Sjeff# define END_C_DECLS } 57219820Sjeff#else /* !__cplusplus */ 58219820Sjeff# define BEGIN_C_DECLS 59219820Sjeff# define END_C_DECLS 60219820Sjeff#endif /* __cplusplus */ 61219820Sjeff 62219820SjeffBEGIN_C_DECLS 63219820Sjeff/****h* OpenSM/Unicast Manager 64219820Sjeff* NAME 65219820Sjeff* Unicast Manager 66219820Sjeff* 67219820Sjeff* DESCRIPTION 68219820Sjeff* The Unicast Manager object encapsulates the information 69219820Sjeff* needed to control unicast LID forwarding on the subnet. 70219820Sjeff* 71219820Sjeff* The Unicast Manager object is thread safe. 72219820Sjeff* 73219820Sjeff* This object should be treated as opaque and should be 74219820Sjeff* manipulated only through the provided functions. 75219820Sjeff* 76219820Sjeff* AUTHOR 77219820Sjeff* Steve King, Intel 78219820Sjeff* 79219820Sjeff*********/ 80219820Sjeffstruct osm_sm; 81219820Sjeff/****s* OpenSM: Unicast Manager/osm_ucast_mgr_t 82219820Sjeff* NAME 83219820Sjeff* osm_ucast_mgr_t 84219820Sjeff* 85219820Sjeff* DESCRIPTION 86219820Sjeff* Unicast Manager structure. 87219820Sjeff* 88219820Sjeff* This object should be treated as opaque and should 89219820Sjeff* be manipulated only through the provided functions. 90219820Sjeff* 91219820Sjeff* SYNOPSIS 92219820Sjeff*/ 93219820Sjefftypedef struct osm_ucast_mgr { 94219820Sjeff struct osm_sm *sm; 95219820Sjeff osm_subn_t *p_subn; 96219820Sjeff osm_log_t *p_log; 97219820Sjeff cl_plock_t *p_lock; 98219820Sjeff cl_qlist_t port_order_list; 99219820Sjeff boolean_t is_dor; 100219820Sjeff boolean_t some_hop_count_set; 101219820Sjeff cl_qmap_t cache_sw_tbl; 102219820Sjeff boolean_t cache_valid; 103219820Sjeff} osm_ucast_mgr_t; 104219820Sjeff/* 105219820Sjeff* FIELDS 106219820Sjeff* sm 107219820Sjeff* Pointer to the SM object. 108219820Sjeff* 109219820Sjeff* p_subn 110219820Sjeff* Pointer to the Subnet object for this subnet. 111219820Sjeff* 112219820Sjeff* p_log 113219820Sjeff* Pointer to the log object. 114219820Sjeff* 115219820Sjeff* p_lock 116219820Sjeff* Pointer to the serializing lock. 117219820Sjeff* 118219820Sjeff* is_dor 119219820Sjeff* Dimension Order Routing (DOR) will be done 120219820Sjeff* 121219820Sjeff* port_order_list 122219820Sjeff* List of ports ordered for routing. 123219820Sjeff* 124219820Sjeff* any_change 125219820Sjeff* Initialized to FALSE at the beginning of the algorithm, 126219820Sjeff* set to TRUE by osm_ucast_mgr_set_fwd_table() if any mad 127219820Sjeff* was sent. 128219820Sjeff* 129219820Sjeff* some_hop_count_set 130219820Sjeff* Initialized to FALSE at the beginning of each the min hop 131219820Sjeff* tables calculation iteration cycle, set to TRUE to indicate 132219820Sjeff* that some hop count changes were done. 133219820Sjeff* 134219820Sjeff* cache_sw_tbl 135219820Sjeff* Cached switches table. 136219820Sjeff* 137219820Sjeff* cache_valid 138219820Sjeff* TRUE if the unicast cache is valid. 139219820Sjeff* 140219820Sjeff* SEE ALSO 141219820Sjeff* Unicast Manager object 142219820Sjeff*********/ 143219820Sjeff 144219820Sjeff/****f* OpenSM: Unicast Manager/osm_ucast_mgr_construct 145219820Sjeff* NAME 146219820Sjeff* osm_ucast_mgr_construct 147219820Sjeff* 148219820Sjeff* DESCRIPTION 149219820Sjeff* This function constructs a Unicast Manager object. 150219820Sjeff* 151219820Sjeff* SYNOPSIS 152219820Sjeff*/ 153219820Sjeffvoid osm_ucast_mgr_construct(IN osm_ucast_mgr_t * const p_mgr); 154219820Sjeff/* 155219820Sjeff* PARAMETERS 156219820Sjeff* p_mgr 157219820Sjeff* [in] Pointer to a Unicast Manager object to construct. 158219820Sjeff* 159219820Sjeff* RETURN VALUE 160219820Sjeff* This function does not return a value. 161219820Sjeff* 162219820Sjeff* NOTES 163219820Sjeff* Allows osm_ucast_mgr_destroy 164219820Sjeff* 165219820Sjeff* Calling osm_ucast_mgr_construct is a prerequisite to calling any other 166219820Sjeff* method except osm_ucast_mgr_init. 167219820Sjeff* 168219820Sjeff* SEE ALSO 169219820Sjeff* Unicast Manager object, osm_ucast_mgr_init, 170219820Sjeff* osm_ucast_mgr_destroy 171219820Sjeff*********/ 172219820Sjeff 173219820Sjeff/****f* OpenSM: Unicast Manager/osm_ucast_mgr_destroy 174219820Sjeff* NAME 175219820Sjeff* osm_ucast_mgr_destroy 176219820Sjeff* 177219820Sjeff* DESCRIPTION 178219820Sjeff* The osm_ucast_mgr_destroy function destroys the object, releasing 179219820Sjeff* all resources. 180219820Sjeff* 181219820Sjeff* SYNOPSIS 182219820Sjeff*/ 183219820Sjeffvoid osm_ucast_mgr_destroy(IN osm_ucast_mgr_t * const p_mgr); 184219820Sjeff/* 185219820Sjeff* PARAMETERS 186219820Sjeff* p_mgr 187219820Sjeff* [in] Pointer to the object to destroy. 188219820Sjeff* 189219820Sjeff* RETURN VALUE 190219820Sjeff* This function does not return a value. 191219820Sjeff* 192219820Sjeff* NOTES 193219820Sjeff* Performs any necessary cleanup of the specified 194219820Sjeff* Unicast Manager object. 195219820Sjeff* Further operations should not be attempted on the destroyed object. 196219820Sjeff* This function should only be called after a call to 197219820Sjeff* osm_ucast_mgr_construct or osm_ucast_mgr_init. 198219820Sjeff* 199219820Sjeff* SEE ALSO 200219820Sjeff* Unicast Manager object, osm_ucast_mgr_construct, 201219820Sjeff* osm_ucast_mgr_init 202219820Sjeff*********/ 203219820Sjeff 204219820Sjeff/****f* OpenSM: Unicast Manager/osm_ucast_mgr_init 205219820Sjeff* NAME 206219820Sjeff* osm_ucast_mgr_init 207219820Sjeff* 208219820Sjeff* DESCRIPTION 209219820Sjeff* The osm_ucast_mgr_init function initializes a 210219820Sjeff* Unicast Manager object for use. 211219820Sjeff* 212219820Sjeff* SYNOPSIS 213219820Sjeff*/ 214219820Sjeffib_api_status_t 215219820Sjeffosm_ucast_mgr_init(IN osm_ucast_mgr_t * const p_mgr, IN struct osm_sm * sm); 216219820Sjeff/* 217219820Sjeff* PARAMETERS 218219820Sjeff* p_mgr 219219820Sjeff* [in] Pointer to an osm_ucast_mgr_t object to initialize. 220219820Sjeff* 221219820Sjeff* sm 222219820Sjeff* [in] Pointer to the SM object. 223219820Sjeff* 224219820Sjeff* RETURN VALUES 225219820Sjeff* IB_SUCCESS if the Unicast Manager object was initialized 226219820Sjeff* successfully. 227219820Sjeff* 228219820Sjeff* NOTES 229219820Sjeff* Allows calling other Unicast Manager methods. 230219820Sjeff* 231219820Sjeff* SEE ALSO 232219820Sjeff* Unicast Manager object, osm_ucast_mgr_construct, 233219820Sjeff* osm_ucast_mgr_destroy 234219820Sjeff*********/ 235219820Sjeff 236219820Sjeff/****f* OpenSM: Unicast Manager/osm_ucast_mgr_set_fwd_table 237219820Sjeff* NAME 238219820Sjeff* osm_ucast_mgr_set_fwd_table 239219820Sjeff* 240219820Sjeff* DESCRIPTION 241219820Sjeff* Setup forwarding table for the switch (from prepared new_lft). 242219820Sjeff* 243219820Sjeff* SYNOPSIS 244219820Sjeff*/ 245219820Sjeffint osm_ucast_mgr_set_fwd_table(IN osm_ucast_mgr_t * const p_mgr, 246219820Sjeff IN osm_switch_t * const p_sw); 247219820Sjeff/* 248219820Sjeff* PARAMETERS 249219820Sjeff* p_mgr 250219820Sjeff* [in] Pointer to an osm_ucast_mgr_t object. 251219820Sjeff* 252219820Sjeff* p_mgr 253219820Sjeff* [in] Pointer to an osm_switch_t object. 254219820Sjeff* 255219820Sjeff* SEE ALSO 256219820Sjeff* Unicast Manager 257219820Sjeff*********/ 258219820Sjeff 259219820Sjeff/****f* OpenSM: Unicast Manager/osm_ucast_mgr_build_lid_matrices 260219820Sjeff* NAME 261219820Sjeff* osm_ucast_mgr_build_lid_matrices 262219820Sjeff* 263219820Sjeff* DESCRIPTION 264219820Sjeff* Build switches's lid matrices. 265219820Sjeff* 266219820Sjeff* SYNOPSIS 267219820Sjeff*/ 268219820Sjeffint osm_ucast_mgr_build_lid_matrices(IN osm_ucast_mgr_t * const p_mgr); 269219820Sjeff/* 270219820Sjeff* PARAMETERS 271219820Sjeff* p_mgr 272219820Sjeff* [in] Pointer to an osm_ucast_mgr_t object. 273219820Sjeff* 274219820Sjeff* NOTES 275219820Sjeff* This function processes the subnet, configuring switches' 276219820Sjeff* min hops tables (aka lid matrices). 277219820Sjeff* 278219820Sjeff* SEE ALSO 279219820Sjeff* Unicast Manager 280219820Sjeff*********/ 281219820Sjeff 282219820Sjeff/****f* OpenSM: Unicast Manager/osm_ucast_mgr_process 283219820Sjeff* NAME 284219820Sjeff* osm_ucast_mgr_process 285219820Sjeff* 286219820Sjeff* DESCRIPTION 287219820Sjeff* Process and configure the subnet's unicast forwarding tables. 288219820Sjeff* 289219820Sjeff* SYNOPSIS 290219820Sjeff*/ 291219820Sjeffint osm_ucast_mgr_process(IN osm_ucast_mgr_t * const p_mgr); 292219820Sjeff/* 293219820Sjeff* PARAMETERS 294219820Sjeff* p_mgr 295219820Sjeff* [in] Pointer to an osm_ucast_mgr_t object. 296219820Sjeff* 297219820Sjeff* RETURN VALUES 298219820Sjeff* Returns zero on success and negative value on failure. 299219820Sjeff* 300219820Sjeff* NOTES 301219820Sjeff* This function processes the subnet, configuring switch 302219820Sjeff* unicast forwarding tables. 303219820Sjeff* 304219820Sjeff* SEE ALSO 305219820Sjeff* Unicast Manager, Node Info Response Controller 306219820Sjeff*********/ 307219820SjeffEND_C_DECLS 308219820Sjeff#endif /* _OSM_UCAST_MGR_H_ */ 309