2 * Copyright (c) 2004-2007 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4 * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
6 * This software is available to you under a choice of one of two
7 * licenses. You may choose to be licensed under the terms of the GNU
8 * General Public License (GPL) Version 2, available from the file
9 * COPYING in the main directory of this source tree, or the
10 * OpenIB.org BSD license below:
12 * Redistribution and use in source and binary forms, with or
13 * without modification, are permitted provided that the following
16 * - Redistributions of source code must retain the above
17 * copyright notice, this list of conditions and the following
20 * - Redistributions in binary form must reproduce the above
21 * copyright notice, this list of conditions and the following
22 * disclaimer in the documentation and/or other materials
23 * provided with the distribution.
25 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38 * Declaration of osm_router_t.
39 * This object represents an IBA router.
40 * This object is part of the OpenSM family of objects.
43 #ifndef _OSM_ROUTER_H_
44 #define _OSM_ROUTER_H_
46 #include <iba/ib_types.h>
47 #include <opensm/osm_base.h>
48 #include <opensm/osm_madw.h>
49 #include <opensm/osm_node.h>
50 #include <opensm/osm_port.h>
51 #include <opensm/osm_mcast_tbl.h>
52 #include <opensm/osm_port_profile.h>
55 # define BEGIN_C_DECLS extern "C" {
56 # define END_C_DECLS }
57 #else /* !__cplusplus */
58 # define BEGIN_C_DECLS
60 #endif /* __cplusplus */
68 * The Router object encapsulates the information needed by the
69 * OpenSM to manage routers. The OpenSM allocates one router object
70 * per router in the IBA subnet.
72 * The Router object is not thread safe, thus callers must provide
75 * This object should be treated as opaque and should be
76 * manipulated only through the provided functions.
79 * Hal Rosenstock, Voltaire
82 /****s* OpenSM: Router/osm_router_t
89 * This object should be treated as opaque and should
90 * be manipulated only through the provided functions.
94 typedef struct osm_router {
95 cl_map_item_t map_item;
101 * Linkage structure for cl_qmap. MUST BE FIRST MEMBER!
104 * Pointer to the Port object for this router.
110 /****f* OpenSM: Router/osm_router_delete
115 * Destroys and deallocates the object.
119 void osm_router_delete(IN OUT osm_router_t ** const pp_rtr);
123 * [in] Pointer to the object to destroy.
131 * Router object, osm_router_new
134 /****f* OpenSM: Router/osm_router_new
139 * The osm_router_new function initializes a Router object for use.
143 osm_router_t *osm_router_new(IN osm_port_t * const p_port);
147 * [in] Pointer to the node object of this router
150 * Pointer to the new initialized router object.
155 * Router object, osm_router_new
158 /****f* OpenSM: Router/osm_router_get_port_ptr
160 * osm_router_get_port_ptr
163 * Returns a pointer to the Port object for this router.
167 static inline osm_port_t *osm_router_get_port_ptr(IN const osm_router_t *
170 return (p_rtr->p_port);
176 * [in] Pointer to an osm_router_t object.
179 * Returns a pointer to the Port object for this router.
187 /****f* OpenSM: Router/osm_router_get_node_ptr
189 * osm_router_get_node_ptr
192 * Returns a pointer to the Node object for this router.
196 static inline osm_node_t *osm_router_get_node_ptr(IN const osm_router_t *
199 return (p_rtr->p_port->p_node);
205 * [in] Pointer to an osm_router_t object.
208 * Returns a pointer to the Node object for this router.
217 #endif /* _OSM_ROUTER_H_ */