]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/ofed/management/opensm/include/opensm/osm_port_profile.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / ofed / management / opensm / include / opensm / osm_port_profile.h
1 /*
2  * Copyright (c) 2004-2008 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.
5  * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved.
6  *
7  * This software is available to you under a choice of one of two
8  * licenses.  You may choose to be licensed under the terms of the GNU
9  * General Public License (GPL) Version 2, available from the file
10  * COPYING in the main directory of this source tree, or the
11  * OpenIB.org BSD license below:
12  *
13  *     Redistribution and use in source and binary forms, with or
14  *     without modification, are permitted provided that the following
15  *     conditions are met:
16  *
17  *      - Redistributions of source code must retain the above
18  *        copyright notice, this list of conditions and the following
19  *        disclaimer.
20  *
21  *      - Redistributions in binary form must reproduce the above
22  *        copyright notice, this list of conditions and the following
23  *        disclaimer in the documentation and/or other materials
24  *        provided with the distribution.
25  *
26  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
30  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
31  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
32  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33  * SOFTWARE.
34  *
35  */
36
37 /*
38  * Abstract:
39  *      Declaration of Switch/osm_port_profile_t.
40  *      This object represents a port profile for an IBA switch.
41  *      This object is part of the OpenSM family of objects.
42  */
43
44 #ifndef _OSM_PORT_PROFILE_H_
45 #define _OSM_PORT_PROFILE_H_
46
47 #include <string.h>
48 #include <iba/ib_types.h>
49 #include <opensm/osm_base.h>
50 #include <opensm/osm_madw.h>
51 #include <opensm/osm_subnet.h>
52 #include <opensm/osm_node.h>
53 #include <opensm/osm_port.h>
54 #include <opensm/osm_mcast_tbl.h>
55
56 #ifdef __cplusplus
57 #  define BEGIN_C_DECLS extern "C" {
58 #  define END_C_DECLS   }
59 #else                           /* !__cplusplus */
60 #  define BEGIN_C_DECLS
61 #  define END_C_DECLS
62 #endif                          /* __cplusplus */
63
64 BEGIN_C_DECLS
65 /****h* OpenSM/Port Profile
66 * NAME
67 *       Port Profile
68 *
69 * DESCRIPTION
70 *       The Port Profile object contains profiling information for
71 *       each Physical Port on a switch.  The profile information
72 *       may be used to optimize path selection.
73 *
74 * AUTHOR
75 *       Steve King, Intel
76 *
77 *********/
78 /****s* OpenSM: Switch/osm_port_profile_t
79 * NAME
80 *       osm_port_profile_t
81 *
82 * DESCRIPTION
83 *       The Port Profile object contains profiling information for
84 *       each Physical Port on the switch.  The profile information
85 *       may be used to optimize path selection.
86 *
87 *       This object should be treated as opaque and should be
88 *       be manipulated only through the provided functions.
89 *
90 * SYNOPSIS
91 */
92 typedef struct osm_port_profile {
93         uint32_t num_paths;
94 } osm_port_profile_t;
95 /*
96 * FIELDS
97 *       num_paths
98 *               The number of paths using this port.
99 *
100 * SEE ALSO
101 *********/
102
103 /****s* OpenSM: Switch/osm_port_mask_t
104 * NAME
105 *       osm_port_mask_t
106 *
107 * DESCRIPTION
108 *       The Port Mask object contains a port numbered bit mask
109 *       for whether the port should be ignored by the link load
110 *       equalization algorithm.
111 *
112 * SYNOPSIS
113 */
114 typedef long osm_port_mask_t[32 / sizeof(long)];
115 /*
116 * FIELDS
117 *       osm_port_mask_t
118 *               Bit mask by port number
119 *
120 * SEE ALSO
121 *********/
122
123 /****f* OpenSM: Port Profile/osm_port_prof_construct
124 * NAME
125 *       osm_port_prof_construct
126 *
127 * DESCRIPTION
128 *
129 *
130 * SYNOPSIS
131 */
132 static inline void osm_port_prof_construct(IN osm_port_profile_t * const p_prof)
133 {
134         CL_ASSERT(p_prof);
135         memset(p_prof, 0, sizeof(*p_prof));
136 }
137 /*
138 * PARAMETERS
139 *       p_prof
140 *               [in] Pointer to the Port Profile object to construct.
141 *
142 * RETURN VALUE
143 *       None.
144 *
145 * NOTES
146 *
147 * SEE ALSO
148 *********/
149
150 /****f* OpenSM: Port Profile/osm_port_prof_path_count_inc
151 * NAME
152 *       osm_port_prof_path_count_inc
153 *
154 * DESCRIPTION
155 *       Increments the count of the number of paths going through this port.
156 *
157 *
158 * SYNOPSIS
159 */
160 static inline void
161 osm_port_prof_path_count_inc(IN osm_port_profile_t * const p_prof)
162 {
163         CL_ASSERT(p_prof);
164         p_prof->num_paths++;
165 }
166 /*
167 * PARAMETERS
168 *       p_prof
169 *               [in] Pointer to the Port Profile object.
170 *
171 * RETURN VALUE
172 *       None.
173 *
174 * NOTES
175 *
176 * SEE ALSO
177 *********/
178
179 /****f* OpenSM: Port Profile/osm_port_prof_path_count_get
180 * NAME
181 *       osm_port_prof_path_count_get
182 *
183 * DESCRIPTION
184 *       Returns the count of the number of paths going through this port.
185 *
186 * SYNOPSIS
187 */
188 static inline uint32_t
189 osm_port_prof_path_count_get(IN const osm_port_profile_t * const p_prof)
190 {
191         return (p_prof->num_paths);
192 }
193 /*
194 * PARAMETERS
195 *       p_prof
196 *               [in] Pointer to the Port Profile object.
197 *
198 * RETURN VALUE
199 *       None.
200 *
201 * NOTES
202 *
203 * SEE ALSO
204 *********/
205
206 END_C_DECLS
207 #endif                          /* _OSM_PORT_PROFILE_H_ */