2 * Copyright (c) 2004, 2005 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_mad_wrapper_t.
39 * This object represents the context wrapper for OpenSM MAD processing.
40 * This object is part of the OpenSM family of objects.
43 #ifndef _OSM_VENDOR_AL_H_
44 #define _OSM_VENDOR_AL_H_
46 #include <iba/ib_types.h>
47 #include <iba/ib_al.h>
48 #include <complib/cl_qlist.h>
49 #include <complib/cl_thread.h>
50 #include <opensm/osm_base.h>
51 #include <opensm/osm_log.h>
54 # define BEGIN_C_DECLS extern "C" {
55 # define END_C_DECLS }
56 #else /* !__cplusplus */
57 # define BEGIN_C_DECLS
59 #endif /* __cplusplus */
62 /****h* OpenSM/Vendor AL
68 * The Vendor AL object is thread safe.
70 * This object should be treated as opaque and should be
71 * manipulated only through the provided functions.
73 * Enable various hacks to compensate for bugs in external code...
80 /****h* OpenSM/Vendor Access Layer (AL)
85 * This file is the vendor specific file for the AL Infiniband API.
91 #define OSM_AL_SQ_SGE 256
92 #define OSM_AL_RQ_SGE 256
93 #define OSM_DEFAULT_RETRY_COUNT 3
94 /* AL supports RMPP */
95 #define VENDOR_RMPP_SUPPORT 1
96 /****s* OpenSM: Vendor AL/osm_ca_info_t
101 * Structure containing information about local Channle Adapters.
105 typedef struct _osm_ca_info {
108 ib_ca_attr_t *p_attr;
114 * Node GUID of the local CA.
117 * Size of the CA attributes for this CA.
120 * Pointer to dynamicly allocated CA Attribute structure.
125 /****f* OpenSM: CA Info/osm_ca_info_get_num_ports
127 * osm_ca_info_get_num_ports
130 * Returns the number of ports owned by this CA.
134 static inline uint8_t
135 osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)
137 return (p_ca_info->p_attr->num_ports);
143 * [in] Pointer to a CA Info object.
146 * Returns the number of ports owned by this CA.
153 /****f* OpenSM: CA Info/osm_ca_info_get_port_guid
155 * osm_ca_info_get_port_guid
158 * Returns the port GUID of the specified port owned by this CA.
162 static inline ib_net64_t
163 osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,
164 IN const uint8_t index)
166 return (p_ca_info->p_attr->p_port_attr[index].port_guid);
172 * [in] Pointer to a CA Info object.
175 * [in] Port "index" for which to retrieve the port GUID.
176 * The index is the offset into the ca's internal array
177 * of port attributes.
180 * Returns the port GUID of the specified port owned by this CA.
187 /****f* OpenSM: CA Info/osm_ca_info_get_port_num
189 * osm_ca_info_get_port_num
192 * Returns the port number of the specified port owned by this CA.
193 * Port numbers start with 1 for HCA's.
197 static inline uint8_t
198 osm_ca_info_get_port_num(IN const osm_ca_info_t * const p_ca_info,
199 IN const uint8_t index)
201 return (p_ca_info->p_attr->p_port_attr[index].port_num);
207 * [in] Pointer to a CA Info object.
210 * [in] Port "index" for which to retrieve the port GUID.
211 * The index is the offset into the ca's internal array
212 * of port attributes.
215 * Returns the port GUID of the specified port owned by this CA.
222 /****f* OpenSM: CA Info/osm_ca_info_get_ca_guid
224 * osm_ca_info_get_ca_guid
227 * Returns the GUID of the specified CA.
231 static inline ib_net64_t
232 osm_ca_info_get_ca_guid(IN const osm_ca_info_t * const p_ca_info)
234 return (p_ca_info->p_attr->ca_guid);
240 * [in] Pointer to a CA Info object.
243 * Returns the GUID of the specified CA.
250 /****s* OpenSM: Vendor AL/osm_bind_handle_t
255 * handle returned by the vendor transport bind call.
259 typedef struct _osm_vendor {
263 osm_ca_info_t *p_ca_info;
272 * Handle returned by AL open call (ib_open_al).
275 * Pointer to the log object.
278 * Number of CA's in the array pointed to by p_ca_info.
281 * Pointer to dynamically allocated array of CA info objects.
284 * MAD Pool handle returned by ib_create_mad_pool at init time.
287 * Transaction timeout time in milliseconds.
292 #define OSM_BIND_INVALID_HANDLE 0
294 /****s* OpenSM: Vendor AL/osm_bind_handle_t
299 * handle returned by the vendor transport bind call.
303 typedef void *osm_bind_handle_t;
306 /****s* OpenSM/osm_vend_wrap_t
308 * AL Vendor MAD Wrapper
311 * AL specific MAD wrapper. AL transport layer uses this for
316 typedef struct _osm_vend_wrap_t {
318 osm_bind_handle_t h_bind;
319 ib_mad_element_t *p_elem;
327 * Size of the allocated MAD
330 * Bind handle used on this transaction
333 * Pointer to the mad element structure associated with
337 * Address vector handle used for this transaction.
340 * Pointer to the mad wrapper structure used to hold the pending
341 * reponse to the mad, if any. If a response is expected, the
342 * wrapper for the reponse is allocated during the send call.
348 #endif /* _OSM_VENDOR_AL_H_ */