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 TS Vendor
39 * This object is part of the OpenSM family of objects.
42 #ifndef _OSM_VENDOR_TS_H_
43 #define _OSM_VENDOR_TS_H_
47 #include <vapi_types.h>
49 #include <ib/ts_api_ng/useraccess/include/ts_ib_useraccess.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>
57 #include <opensm/osm_log.h>
60 # define BEGIN_C_DECLS extern "C" {
61 # define END_C_DECLS }
62 #else /* !__cplusplus */
63 # define BEGIN_C_DECLS
65 #endif /* __cplusplus */
68 /****s* OpenSM: Vendor TS/osm_bind_handle_t
73 * handle returned by the vendor transport bind call.
77 typedef void *osm_bind_handle_t;
80 #define OSM_DEFAULT_RETRY_COUNT 3
82 /****s* OpenSM: Vendor osm_ts_bind_info_t
87 * Handle to the result of binding a class callbacks .
91 typedef struct _osm_ts_bind_info {
93 VAPI_hca_hndl_t hca_hndl;
94 struct _osm_vendor *p_vend;
98 void *send_err_callback;
99 struct _osm_mad_pool *p_osm_pool;
101 } osm_ts_bind_info_t;
105 * the file handle to be used for sending the MADs
108 * Handle to the HCA provided by the underlying VAPI
111 * Pointer to the vendor object.
114 * User's context passed during osm_bind
120 * Port number (within the HCA) of the bound port.
123 * OSM Callback function to be called on receive of MAD.
126 * OSM Callback to be called on send error.
129 * Points to the MAD pool used by OSM
132 * A thread reading from the device file handle
137 /****h* OpenSM/Vendor TS
143 * The Vendor TS object is thread safe.
145 * This object should be treated as opaque and should be
146 * manipulated only through the provided functions.
154 /****s* OpenSM: Vendor TS/osm_ca_info_t
159 * Structure containing information about local Channle Adapters.
163 typedef struct _osm_ca_info {
166 ib_ca_attr_t *p_attr;
173 * Node GUID of the local CA.
176 * Size of the CA attributes for this CA.
179 * Pointer to dynamicly allocated CA Attribute structure.
184 /***** OpenSM: Vendor TS/osm_vendor_t
189 * The structure defining a TS vendor
193 typedef struct _osm_vendor {
196 osm_ca_info_t *p_ca_info;
198 struct _osm_transaction_mgr *p_transaction_mgr;
199 osm_ts_bind_info_t smi_bind;
200 osm_ts_bind_info_t gsi_bind;
206 * Handle returned by TS open call .
209 * Pointer to the log object.
212 * Number of CA's in the array pointed to by p_ca_info.
215 * Pointer to dynamically allocated array of CA info objects.
218 * Transaction timeout time in milliseconds.
221 * Pointer to Transaction Manager.
224 * Bind information for handling SMI MADs
227 * Bind information for GSI MADs
232 /****f* OpenSM: Vendor TS/CA Info/osm_ca_info_get_port_guid
234 * osm_ca_info_get_port_guid
237 * Returns the port GUID of the specified port owned by this CA.
241 static inline ib_net64_t
242 osm_ca_info_get_port_guid(IN const osm_ca_info_t * const p_ca_info,
243 IN const uint8_t index)
245 return (p_ca_info->p_attr->p_port_attr[index].port_guid);
251 * [in] Pointer to a CA Info object.
254 * [in] Port "index" for which to retrieve the port GUID.
255 * The index is the offset into the ca's internal array
256 * of port attributes.
259 * Returns the port GUID of the specified port owned by this CA.
266 /****f* OpenSM: Vendor TS/CA Info/osm_ca_info_get_num_ports
268 * osm_ca_info_get_num_ports
271 * Returns the number of ports of the given ca_info
275 static inline uint8_t
276 osm_ca_info_get_num_ports(IN const osm_ca_info_t * const p_ca_info)
278 return (p_ca_info->p_attr->num_ports);
284 * [in] Pointer to a CA Info object.
287 * Returns the number of CA ports
294 /****f* OpenSM: SM Vendor/osm_vendor_get_guid_ca_and_port
296 * osm_vendor_get_guid_ca_and_port
299 * Given the vendor obj and a guid
300 * return the ca id and port number that have that guid
305 osm_vendor_get_guid_ca_and_port(IN osm_vendor_t * const p_vend,
306 IN ib_net64_t const guid,
307 OUT VAPI_hca_hndl_t * p_hca_hndl,
308 OUT VAPI_hca_id_t * p_hca_id,
309 OUT uint32_t * p_port_num);
314 * [in] Pointer to an osm_vendor_t object.
317 * [in] The guid to search for.
320 * [out] The HCA Id (VAPI_hca_id_t *) that the port is found on.
323 * [out] Pointer to a port number arg to be filled with the port number with the given guid.
326 * IB_SUCCESS on SUCCESS
327 * IB_INVALID_GUID if the guid is notfound on any Local HCA Port
334 /****f* OpenSM: Vendor TS/osm_vendor_get_all_port_attr
336 * osm_vendor_get_all_port_attr
339 * Fill in the array of port_attr with all available ports on ALL the
340 * avilable CAs on this machine.
342 * UPDATE THE VENDOR OBJECT LIST OF CA_INFO STRUCTS
346 ib_api_status_t osm_vendor_get_all_port_attr(IN osm_vendor_t * const p_vend,
349 IN uint32_t * const p_num_ports);
354 * [in] Pointer to an osm_vendor_t object.
357 * [out] Pre-allocated array of port attributes to be filled in
360 * [out] The size of the given array. Filled in by the actual numberof ports found.
364 * IB_INSUFFICIENT_MEMORY if not enough place for all ports was provided.
371 #define OSM_BIND_INVALID_HANDLE 0
373 /****s* OpenSM: Vendor TS/osm_vend_wrap_t
375 * TS Vendor MAD Wrapper
378 * TS specific MAD wrapper. TS transport layer uses this for
383 typedef struct _osm_vend_wrap_t {
385 osm_bind_handle_t h_bind;
393 * Size of the allocated MAD
396 * Bind handle used on this transaction
399 * Address vector handle used for this transaction.
402 * Pointer to the mad wrapper structure used to hold the pending
403 * reponse to the mad, if any. If a response is expected, the
404 * wrapper for the reponse is allocated during the send call.
410 #endif /* _OSM_VENDOR_TS_H_ */