1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004, 2005 Voltaire, Inc. All rights reserved.
3219820Sjeff * Copyright (c) 2002-2005 Mellanox Technologies LTD. All rights reserved.
4219820Sjeff * Copyright (c) 1996-2003 Intel Corporation. All rights reserved.
5219820Sjeff *
6219820Sjeff * This software is available to you under a choice of one of two
7219820Sjeff * licenses.  You may choose to be licensed under the terms of the GNU
8219820Sjeff * General Public License (GPL) Version 2, available from the file
9219820Sjeff * COPYING in the main directory of this source tree, or the
10219820Sjeff * OpenIB.org BSD license below:
11219820Sjeff *
12219820Sjeff *     Redistribution and use in source and binary forms, with or
13219820Sjeff *     without modification, are permitted provided that the following
14219820Sjeff *     conditions are met:
15219820Sjeff *
16219820Sjeff *      - Redistributions of source code must retain the above
17219820Sjeff *        copyright notice, this list of conditions and the following
18219820Sjeff *        disclaimer.
19219820Sjeff *
20219820Sjeff *      - Redistributions in binary form must reproduce the above
21219820Sjeff *        copyright notice, this list of conditions and the following
22219820Sjeff *        disclaimer in the documentation and/or other materials
23219820Sjeff *        provided with the distribution.
24219820Sjeff *
25219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
26219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
27219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
28219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
29219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
30219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
31219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32219820Sjeff * SOFTWARE.
33219820Sjeff *
34219820Sjeff */
35219820Sjeff
36219820Sjeff/*
37219820Sjeff * Abstract:
38219820Sjeff * 	Declaration of osm_mad_wrapper_t.
39219820Sjeff *	This object represents the context wrapper for OpenSM MAD processing.
40219820Sjeff *	This object is part of the OpenSM family of objects.
41219820Sjeff */
42219820Sjeff
43219820Sjeff#ifndef _OSM_UMADT_h_
44219820Sjeff#define _OSM_UMADT_h_
45219820Sjeff
46219820Sjeff#include "iba/ib_types.h"
47219820Sjeff#include <vendor/osm_vendor_api.h>
48219820Sjeff#include <opensm/osm_log.h>
49219820Sjeff#include "umadt.h"
50219820Sjeff#include "ibt.h"
51219820Sjeff
52219820Sjeff#ifdef __cplusplus
53219820Sjeff#  define BEGIN_C_DECLS extern "C" {
54219820Sjeff#  define END_C_DECLS   }
55219820Sjeff#else				/* !__cplusplus */
56219820Sjeff#  define BEGIN_C_DECLS
57219820Sjeff#  define END_C_DECLS
58219820Sjeff#endif				/* __cplusplus */
59219820Sjeff
60219820SjeffBEGIN_C_DECLS
61219820Sjeff
62219820Sjefftypedef struct _umadt_obj_t {
63219820Sjeff	void *umadt_handle;
64219820Sjeff	UMADT_INTERFACE uMadtInterface;
65219820Sjeff	IBT_INTERFACE IbtInterface;
66219820Sjeff	boolean init_done;
67219820Sjeff	cl_spinlock_t register_lock;
68219820Sjeff	cl_qlist_t register_list;
69219820Sjeff	osm_log_t *p_log;
70219820Sjeff	uint32_t timeout;
71219820Sjeff
72219820Sjeff} umadt_obj_t;
73219820Sjeff/*********/
74219820Sjeff
75219820Sjeff/****s* OpenSM: Umadt MAD Wrapper/osm_bind_info
76219820Sjeff* NAME
77219820Sjeff*	osm_bind_info
78219820Sjeff*
79219820Sjeff* DESCRIPTION
80219820Sjeff*	Context needed for processing individual MADs
81219820Sjeff*
82219820Sjeff* SYNOPSIS
83219820Sjeff*/
84219820Sjeff
85219820Sjefftypedef struct _mad_bind_info_t {
86219820Sjeff	cl_list_item_t list_item;
87219820Sjeff	umadt_obj_t *p_umadt_obj;
88219820Sjeff	osm_mad_pool_t *p_mad_pool;
89219820Sjeff	osm_vend_mad_recv_callback_t mad_recv_callback;
90219820Sjeff	void *client_context;
91219820Sjeff	cl_thread_t recv_processor_thread;
92219820Sjeff	cl_spinlock_t trans_ctxt_lock;
93219820Sjeff	cl_qlist_t trans_ctxt_list;
94219820Sjeff	cl_timer_t timeout_timer;
95219820Sjeff	cl_spinlock_t timeout_list_lock;
96219820Sjeff	cl_qlist_t timeout_list;
97219820Sjeff	RegisterClassStruct umadt_reg_class;
98219820Sjeff	MADT_HANDLE umadt_handle;	/* Umadt type */
99219820Sjeff
100219820Sjeff} mad_bind_info_t;
101219820Sjeff
102219820Sjefftypedef struct _trans_context_t {
103219820Sjeff	cl_list_item_t list_item;
104219820Sjeff	uint64_t trans_id;
105219820Sjeff	uint64_t sent_time;	/* micro secs */
106219820Sjeff	void *context;
107219820Sjeff} trans_context_t;
108219820Sjeff
109219820Sjeff/*
110219820Sjeff* FIELDS
111219820Sjeff*	list_item
112219820Sjeff*		List linkage for pools and lists.  MUST BE FIRST MEMBER!
113219820Sjeff*
114219820Sjeff*	p_mad_pool
115219820Sjeff*		Pointer to the MAD pool to be used by mads with this bind handle.
116219820Sjeff*
117219820Sjeff*	mad_recv_callback
118219820Sjeff*		Callback function called by the mad receive processor.
119219820Sjeff*
120219820Sjeff*	client_context
121219820Sjeff*		context to be passed to the receive callback.
122219820Sjeff*
123219820Sjeff*	recv_processor_thread
124219820Sjeff*		Thread structure for the receive processor thread.
125219820Sjeff*
126219820Sjeff*	umadt_reg_class
127219820Sjeff*		Umadt register class struct used to register with Umadt.
128219820Sjeff*
129219820Sjeff*	umadt_handle
130219820Sjeff*		Umadt returns this handle from a registration call. The transport layer
131219820Sjeff*		uses this handle to talk to Umadt.
132219820Sjeff*
133219820Sjeff* SEE ALSO
134219820Sjeff*********/
135219820Sjeff
136219820SjeffEND_C_DECLS
137219820Sjeff#endif /*_OSM_UMADT_h_ */
138