1*d6b92ffaSHans Petter Selasky /*
2*d6b92ffaSHans Petter Selasky * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3*d6b92ffaSHans Petter Selasky * Copyright (c) 2002-2005,2008 Mellanox Technologies LTD. All rights reserved.
4*d6b92ffaSHans Petter Selasky * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5*d6b92ffaSHans Petter Selasky *
6*d6b92ffaSHans Petter Selasky * This software is available to you under a choice of one of two
7*d6b92ffaSHans Petter Selasky * licenses. You may choose to be licensed under the terms of the GNU
8*d6b92ffaSHans Petter Selasky * General Public License (GPL) Version 2, available from the file
9*d6b92ffaSHans Petter Selasky * COPYING in the main directory of this source tree, or the
10*d6b92ffaSHans Petter Selasky * OpenIB.org BSD license below:
11*d6b92ffaSHans Petter Selasky *
12*d6b92ffaSHans Petter Selasky * Redistribution and use in source and binary forms, with or
13*d6b92ffaSHans Petter Selasky * without modification, are permitted provided that the following
14*d6b92ffaSHans Petter Selasky * conditions are met:
15*d6b92ffaSHans Petter Selasky *
16*d6b92ffaSHans Petter Selasky * - Redistributions of source code must retain the above
17*d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following
18*d6b92ffaSHans Petter Selasky * disclaimer.
19*d6b92ffaSHans Petter Selasky *
20*d6b92ffaSHans Petter Selasky * - Redistributions in binary form must reproduce the above
21*d6b92ffaSHans Petter Selasky * copyright notice, this list of conditions and the following
22*d6b92ffaSHans Petter Selasky * disclaimer in the documentation and/or other materials
23*d6b92ffaSHans Petter Selasky * provided with the distribution.
24*d6b92ffaSHans Petter Selasky *
25*d6b92ffaSHans Petter Selasky * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26*d6b92ffaSHans Petter Selasky * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27*d6b92ffaSHans Petter Selasky * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28*d6b92ffaSHans Petter Selasky * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29*d6b92ffaSHans Petter Selasky * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30*d6b92ffaSHans Petter Selasky * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31*d6b92ffaSHans Petter Selasky * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32*d6b92ffaSHans Petter Selasky * SOFTWARE.
33*d6b92ffaSHans Petter Selasky *
34*d6b92ffaSHans Petter Selasky */
35*d6b92ffaSHans Petter Selasky
36*d6b92ffaSHans Petter Selasky /*
37*d6b92ffaSHans Petter Selasky * Abstract:
38*d6b92ffaSHans Petter Selasky * Declaration of osm_router_t.
39*d6b92ffaSHans Petter Selasky * This object represents an IBA router.
40*d6b92ffaSHans Petter Selasky * This object is part of the OpenSM family of objects.
41*d6b92ffaSHans Petter Selasky */
42*d6b92ffaSHans Petter Selasky
43*d6b92ffaSHans Petter Selasky #ifndef _OSM_ROUTER_H_
44*d6b92ffaSHans Petter Selasky #define _OSM_ROUTER_H_
45*d6b92ffaSHans Petter Selasky
46*d6b92ffaSHans Petter Selasky #include <iba/ib_types.h>
47*d6b92ffaSHans Petter Selasky #include <opensm/osm_base.h>
48*d6b92ffaSHans Petter Selasky #include <opensm/osm_madw.h>
49*d6b92ffaSHans Petter Selasky #include <opensm/osm_node.h>
50*d6b92ffaSHans Petter Selasky #include <opensm/osm_port.h>
51*d6b92ffaSHans Petter Selasky #include <opensm/osm_mcast_tbl.h>
52*d6b92ffaSHans Petter Selasky #include <opensm/osm_port_profile.h>
53*d6b92ffaSHans Petter Selasky
54*d6b92ffaSHans Petter Selasky #ifdef __cplusplus
55*d6b92ffaSHans Petter Selasky # define BEGIN_C_DECLS extern "C" {
56*d6b92ffaSHans Petter Selasky # define END_C_DECLS }
57*d6b92ffaSHans Petter Selasky #else /* !__cplusplus */
58*d6b92ffaSHans Petter Selasky # define BEGIN_C_DECLS
59*d6b92ffaSHans Petter Selasky # define END_C_DECLS
60*d6b92ffaSHans Petter Selasky #endif /* __cplusplus */
61*d6b92ffaSHans Petter Selasky
62*d6b92ffaSHans Petter Selasky BEGIN_C_DECLS
63*d6b92ffaSHans Petter Selasky /****h* OpenSM/Router
64*d6b92ffaSHans Petter Selasky * NAME
65*d6b92ffaSHans Petter Selasky * Router
66*d6b92ffaSHans Petter Selasky *
67*d6b92ffaSHans Petter Selasky * DESCRIPTION
68*d6b92ffaSHans Petter Selasky * The Router object encapsulates the information needed by the
69*d6b92ffaSHans Petter Selasky * OpenSM to manage routers. The OpenSM allocates one router object
70*d6b92ffaSHans Petter Selasky * per router in the IBA subnet.
71*d6b92ffaSHans Petter Selasky *
72*d6b92ffaSHans Petter Selasky * The Router object is not thread safe, thus callers must provide
73*d6b92ffaSHans Petter Selasky * serialization.
74*d6b92ffaSHans Petter Selasky *
75*d6b92ffaSHans Petter Selasky * This object should be treated as opaque and should be
76*d6b92ffaSHans Petter Selasky * manipulated only through the provided functions.
77*d6b92ffaSHans Petter Selasky *
78*d6b92ffaSHans Petter Selasky * AUTHOR
79*d6b92ffaSHans Petter Selasky * Hal Rosenstock, Voltaire
80*d6b92ffaSHans Petter Selasky *
81*d6b92ffaSHans Petter Selasky *********/
82*d6b92ffaSHans Petter Selasky /****s* OpenSM: Router/osm_router_t
83*d6b92ffaSHans Petter Selasky * NAME
84*d6b92ffaSHans Petter Selasky * osm_router_t
85*d6b92ffaSHans Petter Selasky *
86*d6b92ffaSHans Petter Selasky * DESCRIPTION
87*d6b92ffaSHans Petter Selasky * Router structure.
88*d6b92ffaSHans Petter Selasky *
89*d6b92ffaSHans Petter Selasky * This object should be treated as opaque and should
90*d6b92ffaSHans Petter Selasky * be manipulated only through the provided functions.
91*d6b92ffaSHans Petter Selasky *
92*d6b92ffaSHans Petter Selasky * SYNOPSIS
93*d6b92ffaSHans Petter Selasky */
94*d6b92ffaSHans Petter Selasky typedef struct osm_router {
95*d6b92ffaSHans Petter Selasky cl_map_item_t map_item;
96*d6b92ffaSHans Petter Selasky osm_port_t *p_port;
97*d6b92ffaSHans Petter Selasky } osm_router_t;
98*d6b92ffaSHans Petter Selasky /*
99*d6b92ffaSHans Petter Selasky * FIELDS
100*d6b92ffaSHans Petter Selasky * map_item
101*d6b92ffaSHans Petter Selasky * Linkage structure for cl_qmap. MUST BE FIRST MEMBER!
102*d6b92ffaSHans Petter Selasky *
103*d6b92ffaSHans Petter Selasky * p_port
104*d6b92ffaSHans Petter Selasky * Pointer to the Port object for this router.
105*d6b92ffaSHans Petter Selasky *
106*d6b92ffaSHans Petter Selasky * SEE ALSO
107*d6b92ffaSHans Petter Selasky * Router object
108*d6b92ffaSHans Petter Selasky *********/
109*d6b92ffaSHans Petter Selasky
110*d6b92ffaSHans Petter Selasky /****f* OpenSM: Router/osm_router_delete
111*d6b92ffaSHans Petter Selasky * NAME
112*d6b92ffaSHans Petter Selasky * osm_router_delete
113*d6b92ffaSHans Petter Selasky *
114*d6b92ffaSHans Petter Selasky * DESCRIPTION
115*d6b92ffaSHans Petter Selasky * Destroys and deallocates the object.
116*d6b92ffaSHans Petter Selasky *
117*d6b92ffaSHans Petter Selasky * SYNOPSIS
118*d6b92ffaSHans Petter Selasky */
119*d6b92ffaSHans Petter Selasky void osm_router_delete(IN OUT osm_router_t ** pp_rtr);
120*d6b92ffaSHans Petter Selasky /*
121*d6b92ffaSHans Petter Selasky * PARAMETERS
122*d6b92ffaSHans Petter Selasky * p_rtr
123*d6b92ffaSHans Petter Selasky * [in] Pointer to the object to destroy.
124*d6b92ffaSHans Petter Selasky *
125*d6b92ffaSHans Petter Selasky * RETURN VALUE
126*d6b92ffaSHans Petter Selasky * None.
127*d6b92ffaSHans Petter Selasky *
128*d6b92ffaSHans Petter Selasky * NOTES
129*d6b92ffaSHans Petter Selasky *
130*d6b92ffaSHans Petter Selasky * SEE ALSO
131*d6b92ffaSHans Petter Selasky * Router object, osm_router_new
132*d6b92ffaSHans Petter Selasky *********/
133*d6b92ffaSHans Petter Selasky
134*d6b92ffaSHans Petter Selasky /****f* OpenSM: Router/osm_router_new
135*d6b92ffaSHans Petter Selasky * NAME
136*d6b92ffaSHans Petter Selasky * osm_router_new
137*d6b92ffaSHans Petter Selasky *
138*d6b92ffaSHans Petter Selasky * DESCRIPTION
139*d6b92ffaSHans Petter Selasky * The osm_router_new function initializes a Router object for use.
140*d6b92ffaSHans Petter Selasky *
141*d6b92ffaSHans Petter Selasky * SYNOPSIS
142*d6b92ffaSHans Petter Selasky */
143*d6b92ffaSHans Petter Selasky osm_router_t *osm_router_new(IN osm_port_t * p_port);
144*d6b92ffaSHans Petter Selasky /*
145*d6b92ffaSHans Petter Selasky * PARAMETERS
146*d6b92ffaSHans Petter Selasky * p_node
147*d6b92ffaSHans Petter Selasky * [in] Pointer to the node object of this router
148*d6b92ffaSHans Petter Selasky *
149*d6b92ffaSHans Petter Selasky * RETURN VALUES
150*d6b92ffaSHans Petter Selasky * Pointer to the new initialized router object.
151*d6b92ffaSHans Petter Selasky *
152*d6b92ffaSHans Petter Selasky * NOTES
153*d6b92ffaSHans Petter Selasky *
154*d6b92ffaSHans Petter Selasky * SEE ALSO
155*d6b92ffaSHans Petter Selasky * Router object, osm_router_new
156*d6b92ffaSHans Petter Selasky *********/
157*d6b92ffaSHans Petter Selasky
158*d6b92ffaSHans Petter Selasky /****f* OpenSM: Router/osm_router_get_port_ptr
159*d6b92ffaSHans Petter Selasky * NAME
160*d6b92ffaSHans Petter Selasky * osm_router_get_port_ptr
161*d6b92ffaSHans Petter Selasky *
162*d6b92ffaSHans Petter Selasky * DESCRIPTION
163*d6b92ffaSHans Petter Selasky * Returns a pointer to the Port object for this router.
164*d6b92ffaSHans Petter Selasky *
165*d6b92ffaSHans Petter Selasky * SYNOPSIS
166*d6b92ffaSHans Petter Selasky */
osm_router_get_port_ptr(IN const osm_router_t * p_rtr)167*d6b92ffaSHans Petter Selasky static inline osm_port_t *osm_router_get_port_ptr(IN const osm_router_t * p_rtr)
168*d6b92ffaSHans Petter Selasky {
169*d6b92ffaSHans Petter Selasky return p_rtr->p_port;
170*d6b92ffaSHans Petter Selasky }
171*d6b92ffaSHans Petter Selasky
172*d6b92ffaSHans Petter Selasky /*
173*d6b92ffaSHans Petter Selasky * PARAMETERS
174*d6b92ffaSHans Petter Selasky * p_rtr
175*d6b92ffaSHans Petter Selasky * [in] Pointer to an osm_router_t object.
176*d6b92ffaSHans Petter Selasky *
177*d6b92ffaSHans Petter Selasky * RETURN VALUES
178*d6b92ffaSHans Petter Selasky * Returns a pointer to the Port object for this router.
179*d6b92ffaSHans Petter Selasky *
180*d6b92ffaSHans Petter Selasky * NOTES
181*d6b92ffaSHans Petter Selasky *
182*d6b92ffaSHans Petter Selasky * SEE ALSO
183*d6b92ffaSHans Petter Selasky * Router object
184*d6b92ffaSHans Petter Selasky *********/
185*d6b92ffaSHans Petter Selasky
186*d6b92ffaSHans Petter Selasky /****f* OpenSM: Router/osm_router_get_node_ptr
187*d6b92ffaSHans Petter Selasky * NAME
188*d6b92ffaSHans Petter Selasky * osm_router_get_node_ptr
189*d6b92ffaSHans Petter Selasky *
190*d6b92ffaSHans Petter Selasky * DESCRIPTION
191*d6b92ffaSHans Petter Selasky * Returns a pointer to the Node object for this router.
192*d6b92ffaSHans Petter Selasky *
193*d6b92ffaSHans Petter Selasky * SYNOPSIS
194*d6b92ffaSHans Petter Selasky */
osm_router_get_node_ptr(IN const osm_router_t * p_rtr)195*d6b92ffaSHans Petter Selasky static inline osm_node_t *osm_router_get_node_ptr(IN const osm_router_t * p_rtr)
196*d6b92ffaSHans Petter Selasky {
197*d6b92ffaSHans Petter Selasky return p_rtr->p_port->p_node;
198*d6b92ffaSHans Petter Selasky }
199*d6b92ffaSHans Petter Selasky
200*d6b92ffaSHans Petter Selasky /*
201*d6b92ffaSHans Petter Selasky * PARAMETERS
202*d6b92ffaSHans Petter Selasky * p_rtr
203*d6b92ffaSHans Petter Selasky * [in] Pointer to an osm_router_t object.
204*d6b92ffaSHans Petter Selasky *
205*d6b92ffaSHans Petter Selasky * RETURN VALUES
206*d6b92ffaSHans Petter Selasky * Returns a pointer to the Node object for this router.
207*d6b92ffaSHans Petter Selasky *
208*d6b92ffaSHans Petter Selasky * NOTES
209*d6b92ffaSHans Petter Selasky *
210*d6b92ffaSHans Petter Selasky * SEE ALSO
211*d6b92ffaSHans Petter Selasky * Router object
212*d6b92ffaSHans Petter Selasky *********/
213*d6b92ffaSHans Petter Selasky
214*d6b92ffaSHans Petter Selasky END_C_DECLS
215*d6b92ffaSHans Petter Selasky #endif /* _OSM_ROUTER_H_ */
216