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 * Definition of interface for the MTL Vendor
39 * This object is part of the OpenSM family of objects.
42 #ifndef _OSM_VENDOR_MTL_H_
43 #define _OSM_VENDOR_MTL_H_
47 #include <vapi_types.h>
52 #include "iba/ib_types.h"
53 #include "iba/ib_al.h"
54 #include <complib/cl_thread.h>
55 #include <complib/cl_types_osd.h>
56 #include <opensm/osm_base.h>
59 # define BEGIN_C_DECLS extern "C" {
60 # define END_C_DECLS }
61 #else /* !__cplusplus */
62 # define BEGIN_C_DECLS
64 #endif /* __cplusplus */
67 /****h* OpenSM/Vendor MTL
73 * The Vendor MTL object is thread safe.
75 * This object should be treated as opaque and should be
76 * manipulated only through the provided functions.
83 /****s* OpenSM: Vendor MTL/osm_ca_info_t
88 * Structure containing information about local Channle Adapters.
92 typedef struct _osm_ca_info {
102 * Node GUID of the local CA.
105 * Size of the CA attributes for this CA.
108 * Pointer to dynamicly allocated CA Attribute structure.
113 #define OSM_DEFAULT_RETRY_COUNT 3
115 /***** OpenSM: Vendor MTL/osm_vendor_t
120 * The structure defining a vendor
124 typedef struct _osm_vendor {
128 osm_ca_info_t *p_ca_info;
130 struct osm_transaction_mgr_t *p_transaction_mgr;
136 * Handle returned by MTL open call (ib_open_al).
139 * Pointer to the log object.
142 * Number of CA's in the array pointed to by p_ca_info.
145 * Pointer to dynamically allocated array of CA info objects.
148 * Transaction timeout time in milliseconds.
151 * Pointer to Transaction Manager.
156 /****f* OpenSM: Vendor MTL/CA Info/osm_ca_info_get_port_guid
158 * osm_ca_info_get_port_guid
161 * Returns the port GUID of the specified port owned by this CA.
165 static inline ib_net64_t
166 osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,
167 IN const uint8_t index)
169 return (p_ca_info->p_attr->p_port_attr[index].port_guid);
175 * [in] Pointer to a CA Info object.
178 * [in] Port "index" for which to retrieve the port GUID.
179 * The index is the offset into the ca's internal array
180 * of port attributes.
183 * Returns the port GUID of the specified port owned by this CA.
190 /****f* OpenSM: Vendor MTL/CA Info/osm_ca_info_get_num_ports
192 * osm_ca_info_get_num_ports
195 * Returns the number of ports of the given ca_info
199 static inline uint8_t
200 osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)
202 return (p_ca_info->p_attr->num_ports);
208 * [in] Pointer to a CA Info object.
211 * Returns the number of CA ports
218 /****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port
220 * osm_vendor_get_guid_ca_and_port
223 * Given the vendor obj and a guid
224 * return the ca id and port number that have that guid
229 osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,
230 IN ib_net64_t const guid,
231 OUT VAPI_hca_hndl_t * p_hca_hndl,
232 OUT VAPI_hca_id_t * p_hca_id,
233 OUT uint32_t * p_port_num);
238 * [in] Pointer to an osm_vendor_t object.
241 * [in] The guid to search for.
244 * [out] The HCA Id (VAPI_hca_id_t *) that the port is found on.
247 * [out] Pointer to a port number arg to be filled with the port number with the given guid.
250 * IB_SUCCESS on SUCCESS
251 * IB_INVALID_GUID if the guid is notfound on any Local HCA Port
258 /****f* OpenSM: Vendor MTL/osm_vendor_get_all_port_attr
260 * osm_vendor_get_all_port_attr
263 * Fill in the array of port_attr with all available ports on ALL the
264 * avilable CAs on this machine.
266 * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS
270 ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
273 IN uint32_t * const p_num_ports);
278 * [in] Pointer to an osm_vendor_t object.
281 * [out] Pre-allocated array of port attributes to be filled in
284 * [out] The size of the given array. Filled in by the actual numberof ports found.
288 * IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided.
295 #define OSM_BIND_INVALID_HANDLE 0
297 /****s* OpenSM: Vendor MTL/osm_bind_handle_t
302 * handle returned by the vendor transport bind call.
306 typedef void *osm_bind_handle_t;
310 /****s* OpenSM: Vendor MTL/osm_vend_wrap_t
312 * MTL Vendor MAD Wrapper
315 * MTL specific MAD wrapper. MTL transport layer uses this for
320 typedef struct _osm_vend_wrap_t {
322 osm_bind_handle_t h_bind;
323 // ib_av_handle_t h_av;
331 * Size of the allocated MAD
334 * Bind handle used on this transaction
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_MTL_H_ */