1/*
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.
5 *
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:
11 *
12 *     Redistribution and use in source and binary forms, with or
13 *     without modification, are permitted provided that the following
14 *     conditions are met:
15 *
16 *      - Redistributions of source code must retain the above
17 *        copyright notice, this list of conditions and the following
18 *        disclaimer.
19 *
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.
24 *
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
32 * SOFTWARE.
33 *
34 */
35
36/*
37 * Abstract:
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.
41 */
42
43#ifndef _OSM_UMADT_h_
44#define _OSM_UMADT_h_
45
46#include "iba/ib_types.h"
47#include <vendor/osm_vendor_api.h>
48#include <opensm/osm_log.h>
49#include "umadt.h"
50#include "ibt.h"
51
52#ifdef __cplusplus
53#  define BEGIN_C_DECLS extern "C" {
54#  define END_C_DECLS   }
55#else				/* !__cplusplus */
56#  define BEGIN_C_DECLS
57#  define END_C_DECLS
58#endif				/* __cplusplus */
59
60BEGIN_C_DECLS
61
62typedef struct _umadt_obj_t {
63	void *umadt_handle;
64	UMADT_INTERFACE uMadtInterface;
65	IBT_INTERFACE IbtInterface;
66	boolean init_done;
67	cl_spinlock_t register_lock;
68	cl_qlist_t register_list;
69	osm_log_t *p_log;
70	uint32_t timeout;
71
72} umadt_obj_t;
73/*********/
74
75/****s* OpenSM: Umadt MAD Wrapper/osm_bind_info
76* NAME
77*	osm_bind_info
78*
79* DESCRIPTION
80*	Context needed for processing individual MADs
81*
82* SYNOPSIS
83*/
84
85typedef struct _mad_bind_info_t {
86	cl_list_item_t list_item;
87	umadt_obj_t *p_umadt_obj;
88	osm_mad_pool_t *p_mad_pool;
89	osm_vend_mad_recv_callback_t mad_recv_callback;
90	void *client_context;
91	cl_thread_t recv_processor_thread;
92	cl_spinlock_t trans_ctxt_lock;
93	cl_qlist_t trans_ctxt_list;
94	cl_timer_t timeout_timer;
95	cl_spinlock_t timeout_list_lock;
96	cl_qlist_t timeout_list;
97	RegisterClassStruct umadt_reg_class;
98	MADT_HANDLE umadt_handle;	/* Umadt type */
99
100} mad_bind_info_t;
101
102typedef struct _trans_context_t {
103	cl_list_item_t list_item;
104	uint64_t trans_id;
105	uint64_t sent_time;	/* micro secs */
106	void *context;
107} trans_context_t;
108
109/*
110* FIELDS
111*	list_item
112*		List linkage for pools and lists.  MUST BE FIRST MEMBER!
113*
114*	p_mad_pool
115*		Pointer to the MAD pool to be used by mads with this bind handle.
116*
117*	mad_recv_callback
118*		Callback function called by the mad receive processor.
119*
120*	client_context
121*		context to be passed to the receive callback.
122*
123*	recv_processor_thread
124*		Thread structure for the receive processor thread.
125*
126*	umadt_reg_class
127*		Umadt register class struct used to register with Umadt.
128*
129*	umadt_handle
130*		Umadt returns this handle from a registration call. The transport layer
131*		uses this handle to talk to Umadt.
132*
133* SEE ALSO
134*********/
135
136END_C_DECLS
137#endif /*_OSM_UMADT_h_ */
138