1321936Shselasky/* 2321936Shselasky * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved. 3321936Shselasky * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved. 4321936Shselasky * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. 5321936Shselasky * 6321936Shselasky * This software is available to you under a choice of one of two 7321936Shselasky * licenses. You may choose to be licensed under the terms of the GNU 8321936Shselasky * General Public License (GPL) Version 2, available from the file 9321936Shselasky * COPYING in the main directory of this source tree, or the 10321936Shselasky * OpenIB.org BSD license below: 11321936Shselasky * 12321936Shselasky * Redistribution and use in source and binary forms, with or 13321936Shselasky * without modification, are permitted provided that the following 14321936Shselasky * conditions are met: 15321936Shselasky * 16321936Shselasky * - Redistributions of source code must retain the above 17321936Shselasky * copyright notice, this list of conditions and the following 18321936Shselasky * disclaimer. 19321936Shselasky * 20321936Shselasky * - Redistributions in binary form must reproduce the above 21321936Shselasky * copyright notice, this list of conditions and the following 22321936Shselasky * disclaimer in the documentation and/or other materials 23321936Shselasky * provided with the distribution. 24321936Shselasky * 25321936Shselasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26321936Shselasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27321936Shselasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28321936Shselasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29321936Shselasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30321936Shselasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31321936Shselasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32321936Shselasky * SOFTWARE. 33321936Shselasky * 34321936Shselasky */ 35321936Shselasky 36321936Shselasky/* 37321936Shselasky * Abstract: 38321936Shselasky * Declaration of osm_router_t. 39321936Shselasky * This object represents an IBA router. 40321936Shselasky * This object is part of the OpenSM family of objects. 41321936Shselasky */ 42321936Shselasky 43321936Shselasky#ifndef _OSM_ROUTER_H_ 44321936Shselasky#define _OSM_ROUTER_H_ 45321936Shselasky 46321936Shselasky#include <iba/ib_types.h> 47321936Shselasky#include <opensm/osm_base.h> 48321936Shselasky#include <opensm/osm_madw.h> 49321936Shselasky#include <opensm/osm_node.h> 50321936Shselasky#include <opensm/osm_port.h> 51321936Shselasky#include <opensm/osm_mcast_tbl.h> 52321936Shselasky#include <opensm/osm_port_profile.h> 53321936Shselasky 54321936Shselasky#ifdef __cplusplus 55321936Shselasky# define BEGIN_C_DECLS extern "C" { 56321936Shselasky# define END_C_DECLS } 57321936Shselasky#else /* !__cplusplus */ 58321936Shselasky# define BEGIN_C_DECLS 59321936Shselasky# define END_C_DECLS 60321936Shselasky#endif /* __cplusplus */ 61321936Shselasky 62321936ShselaskyBEGIN_C_DECLS 63321936Shselasky/****h* OpenSM/Router 64321936Shselasky* NAME 65321936Shselasky* Router 66321936Shselasky* 67321936Shselasky* DESCRIPTION 68321936Shselasky* The Router object encapsulates the information needed by the 69321936Shselasky* OpenSM to manage routers. The OpenSM allocates one router object 70321936Shselasky* per router in the IBA subnet. 71321936Shselasky* 72321936Shselasky* The Router object is not thread safe, thus callers must provide 73321936Shselasky* serialization. 74321936Shselasky* 75321936Shselasky* This object should be treated as opaque and should be 76321936Shselasky* manipulated only through the provided functions. 77321936Shselasky* 78321936Shselasky* AUTHOR 79321936Shselasky* Hal Rosenstock, Voltaire 80321936Shselasky* 81321936Shselasky*********/ 82321936Shselasky/****s* OpenSM: Router/osm_router_t 83321936Shselasky* NAME 84321936Shselasky* osm_router_t 85321936Shselasky* 86321936Shselasky* DESCRIPTION 87321936Shselasky* Router structure. 88321936Shselasky* 89321936Shselasky* This object should be treated as opaque and should 90321936Shselasky* be manipulated only through the provided functions. 91321936Shselasky* 92321936Shselasky* SYNOPSIS 93321936Shselasky*/ 94321936Shselaskytypedef struct osm_router { 95321936Shselasky cl_map_item_t map_item; 96321936Shselasky osm_port_t *p_port; 97321936Shselasky} osm_router_t; 98321936Shselasky/* 99321936Shselasky* FIELDS 100321936Shselasky* map_item 101321936Shselasky* Linkage structure for cl_qmap. MUST BE FIRST MEMBER! 102321936Shselasky* 103321936Shselasky* p_port 104321936Shselasky* Pointer to the Port object for this router. 105321936Shselasky* 106321936Shselasky* SEE ALSO 107321936Shselasky* Router object 108321936Shselasky*********/ 109321936Shselasky 110321936Shselasky/****f* OpenSM: Router/osm_router_delete 111321936Shselasky* NAME 112321936Shselasky* osm_router_delete 113321936Shselasky* 114321936Shselasky* DESCRIPTION 115321936Shselasky* Destroys and deallocates the object. 116321936Shselasky* 117321936Shselasky* SYNOPSIS 118321936Shselasky*/ 119321936Shselaskyvoid osm_router_delete(IN OUT osm_router_t ** pp_rtr); 120321936Shselasky/* 121321936Shselasky* PARAMETERS 122321936Shselasky* p_rtr 123321936Shselasky* [in] Pointer to the object to destroy. 124321936Shselasky* 125321936Shselasky* RETURN VALUE 126321936Shselasky* None. 127321936Shselasky* 128321936Shselasky* NOTES 129321936Shselasky* 130321936Shselasky* SEE ALSO 131321936Shselasky* Router object, osm_router_new 132321936Shselasky*********/ 133321936Shselasky 134321936Shselasky/****f* OpenSM: Router/osm_router_new 135321936Shselasky* NAME 136321936Shselasky* osm_router_new 137321936Shselasky* 138321936Shselasky* DESCRIPTION 139321936Shselasky* The osm_router_new function initializes a Router object for use. 140321936Shselasky* 141321936Shselasky* SYNOPSIS 142321936Shselasky*/ 143321936Shselaskyosm_router_t *osm_router_new(IN osm_port_t * p_port); 144321936Shselasky/* 145321936Shselasky* PARAMETERS 146321936Shselasky* p_node 147321936Shselasky* [in] Pointer to the node object of this router 148321936Shselasky* 149321936Shselasky* RETURN VALUES 150321936Shselasky* Pointer to the new initialized router object. 151321936Shselasky* 152321936Shselasky* NOTES 153321936Shselasky* 154321936Shselasky* SEE ALSO 155321936Shselasky* Router object, osm_router_new 156321936Shselasky*********/ 157321936Shselasky 158321936Shselasky/****f* OpenSM: Router/osm_router_get_port_ptr 159321936Shselasky* NAME 160321936Shselasky* osm_router_get_port_ptr 161321936Shselasky* 162321936Shselasky* DESCRIPTION 163321936Shselasky* Returns a pointer to the Port object for this router. 164321936Shselasky* 165321936Shselasky* SYNOPSIS 166321936Shselasky*/ 167321936Shselaskystatic inline osm_port_t *osm_router_get_port_ptr(IN const osm_router_t * p_rtr) 168321936Shselasky{ 169321936Shselasky return p_rtr->p_port; 170321936Shselasky} 171321936Shselasky 172321936Shselasky/* 173321936Shselasky* PARAMETERS 174321936Shselasky* p_rtr 175321936Shselasky* [in] Pointer to an osm_router_t object. 176321936Shselasky* 177321936Shselasky* RETURN VALUES 178321936Shselasky* Returns a pointer to the Port object for this router. 179321936Shselasky* 180321936Shselasky* NOTES 181321936Shselasky* 182321936Shselasky* SEE ALSO 183321936Shselasky* Router object 184321936Shselasky*********/ 185321936Shselasky 186321936Shselasky/****f* OpenSM: Router/osm_router_get_node_ptr 187321936Shselasky* NAME 188321936Shselasky* osm_router_get_node_ptr 189321936Shselasky* 190321936Shselasky* DESCRIPTION 191321936Shselasky* Returns a pointer to the Node object for this router. 192321936Shselasky* 193321936Shselasky* SYNOPSIS 194321936Shselasky*/ 195321936Shselaskystatic inline osm_node_t *osm_router_get_node_ptr(IN const osm_router_t * p_rtr) 196321936Shselasky{ 197321936Shselasky return p_rtr->p_port->p_node; 198321936Shselasky} 199321936Shselasky 200321936Shselasky/* 201321936Shselasky* PARAMETERS 202321936Shselasky* p_rtr 203321936Shselasky* [in] Pointer to an osm_router_t object. 204321936Shselasky* 205321936Shselasky* RETURN VALUES 206321936Shselasky* Returns a pointer to the Node object for this router. 207321936Shselasky* 208321936Shselasky* NOTES 209321936Shselasky* 210321936Shselasky* SEE ALSO 211321936Shselasky* Router object 212321936Shselasky*********/ 213321936Shselasky 214321936ShselaskyEND_C_DECLS 215321936Shselasky#endif /* _OSM_ROUTER_H_ */ 216