1/*
2 * Copyright (c) 2004-2009 Voltaire, Inc. All rights reserved.
3 * Copyright (c) 2002-2005,2008 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
64BEGIN_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*/
92typedef 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*/
114typedef 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*/
132static inline void osm_port_prof_construct(IN osm_port_profile_t * 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*/
160static inline void osm_port_prof_path_count_inc(IN osm_port_profile_t * p_prof)
161{
162	CL_ASSERT(p_prof);
163	p_prof->num_paths++;
164}
165/*
166* PARAMETERS
167*	p_prof
168*		[in] Pointer to the Port Profile object.
169*
170* RETURN VALUE
171*	None.
172*
173* NOTES
174*
175* SEE ALSO
176*********/
177
178/****f* OpenSM: Port Profile/osm_port_prof_path_count_get
179* NAME
180*	osm_port_prof_path_count_get
181*
182* DESCRIPTION
183*	Returns the count of the number of paths going through this port.
184*
185* SYNOPSIS
186*/
187static inline uint32_t
188osm_port_prof_path_count_get(IN const osm_port_profile_t * p_prof)
189{
190	return p_prof->num_paths;
191}
192/*
193* PARAMETERS
194*	p_prof
195*		[in] Pointer to the Port Profile object.
196*
197* RETURN VALUE
198*	None.
199*
200* NOTES
201*
202* SEE ALSO
203*********/
204
205END_C_DECLS
206#endif				/* _OSM_PORT_PROFILE_H_ */
207