~ubuntu-branches/ubuntu/raring/ibutils/raring-proposed

« back to all changes in this revision

Viewing changes to ibis/src/ibsm.h

  • Committer: Bazaar Package Importer
  • Author(s): Benoit Mortier
  • Date: 2010-01-11 22:22:00 UTC
  • Revision ID: james.westby@ubuntu.com-20100111222200-53kum2et5nh13rv3
Tags: upstream-1.2-OFED-1.4.2
ImportĀ upstreamĀ versionĀ 1.2-OFED-1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2004 Mellanox Technologies LTD. All rights reserved.
 
3
 *
 
4
 * This software is available to you under a choice of one of two
 
5
 * licenses.  You may choose to be licensed under the terms of the GNU
 
6
 * General Public License (GPL) Version 2, available from the file
 
7
 * COPYING in the main directory of this source tree, or the
 
8
 * OpenIB.org BSD license below:
 
9
 *
 
10
 *     Redistribution and use in source and binary forms, with or
 
11
 *     without modification, are permitted provided that the following
 
12
 *     conditions are met:
 
13
 *
 
14
 *      - Redistributions of source code must retain the above
 
15
 *        copyright notice, this list of conditions and the following
 
16
 *        disclaimer.
 
17
 *
 
18
 *      - Redistributions in binary form must reproduce the above
 
19
 *        copyright notice, this list of conditions and the following
 
20
 *        disclaimer in the documentation and/or other materials
 
21
 *        provided with the distribution.
 
22
 *
 
23
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
24
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
25
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 
26
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 
27
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 
28
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
29
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
30
 * SOFTWARE.
 
31
 *
 
32
 * $Id$
 
33
 */
 
34
 
 
35
/*
 
36
 * Abstract:
 
37
 *      Definition of ibsm_t.
 
38
 *      This object represents the Subnet Management Packets Interface
 
39
 *      This object is part of the IBIS family of objects.
 
40
 *
 
41
 * Environment:
 
42
 *      Linux User Mode
 
43
 *
 
44
 * $Revision: 1.2 $
 
45
 */
 
46
 
 
47
#ifndef _IBSM_H_
 
48
#define _IBSM_H_
 
49
 
 
50
#include <complib/cl_qmap.h>
 
51
#include <complib/cl_passivelock.h>
 
52
#include <complib/cl_debug.h>
 
53
#include <iba/ib_types.h>
 
54
#include <opensm/osm_madw.h>
 
55
#include <opensm/osm_log.h>
 
56
#include <opensm/osm_mad_pool.h>
 
57
#include <opensm/osm_msgdef.h>
 
58
#include "ibis_api.h"
 
59
#include "ibis.h"
 
60
 
 
61
typedef enum _ibsm_state
 
62
{
 
63
  IBSM_STATE_INIT,
 
64
  IBSM_STATE_READY,
 
65
  IBSM_STATE_BUSY,
 
66
} ibsm_state_t;
 
67
 
 
68
/****s* IBIS: ibsm/ibsm_t
 
69
* NAME  ibsm_t
 
70
*
 
71
*
 
72
* DESCRIPTION
 
73
*       ibsm structure.
 
74
*
 
75
* SYNOPSIS
 
76
*/
 
77
typedef struct _ibsm
 
78
{
 
79
  ibsm_state_t         state;
 
80
  osm_bind_handle_t    lid_route_bind;
 
81
  osm_bind_handle_t    dr_route_bind;
 
82
} ibsm_t;
 
83
/*
 
84
* FIELDS
 
85
*
 
86
*       state
 
87
*            The ibsm state: INIT, READ or BUSY
 
88
*
 
89
* SEE ALSO
 
90
*
 
91
*********/
 
92
 
 
93
/****s* IBIS: ibsm/ibsm_dr_path_t
 
94
* NAME  ibsm_dr_path_t
 
95
*
 
96
*
 
97
* DESCRIPTION
 
98
*       ibsm directed route structure.
 
99
*
 
100
* SYNOPSIS
 
101
*/
 
102
typedef struct _ibsm_dr_path {
 
103
  uint8_t count;
 
104
  uint8_t path[IB_SUBNET_PATH_HOPS_MAX];
 
105
} ibsm_dr_path_t;
 
106
/*
 
107
* FIELDS
 
108
*
 
109
*  path
 
110
*   The list of output ports to be used in the path going out (initial)
 
111
*
 
112
*  number of entries
 
113
*
 
114
* SEE ALSO
 
115
*
 
116
*********/
 
117
 
 
118
/****f* IBIS: ibsm/ibsm_construct
 
119
* NAME
 
120
*       ibsm_construct
 
121
*
 
122
* DESCRIPTION
 
123
*      Allocation of ibsm_t struct
 
124
*
 
125
* SYNOPSIS
 
126
*/
 
127
 
 
128
ibsm_t*
 
129
ibsm_construct(void);
 
130
 
 
131
/*
 
132
* PARAMETERS
 
133
*
 
134
*
 
135
* RETURN VALUE
 
136
*       Return a pointer to an ibsm struct. Null if fails to do so.
 
137
*
 
138
* NOTES
 
139
*       First step of the creation of ibsm_t
 
140
*
 
141
* SEE ALSO
 
142
*       ibsm_destroy ibsm_init
 
143
*********/
 
144
 
 
145
/****s* IBIS: ibsm/ibsm_destroy
 
146
* NAME
 
147
*       ibsm_destroy
 
148
*
 
149
* DESCRIPTION
 
150
*      release of ibsm_t struct
 
151
*
 
152
* SYNOPSIS
 
153
*/
 
154
 
 
155
void
 
156
ibsm_destroy(
 
157
  IN ibsm_t* const p_ibsm );
 
158
 
 
159
/*
 
160
* PARAMETERS
 
161
*       p_ibsm
 
162
*               A pointer to the ibsm_t struct that is about to be released
 
163
*
 
164
* RETURN VALUE
 
165
*
 
166
* NOTES
 
167
*       Final step of the releasing of ibsm_t
 
168
*
 
169
* SEE ALSO
 
170
*       ibsm_construct
 
171
*********/
 
172
 
 
173
/****f* IBIS: ibsm/ibsm_init
 
174
* NAME
 
175
*       ibsm_init
 
176
*
 
177
* DESCRIPTION
 
178
*      Initialization of an ibsm_t struct
 
179
*
 
180
* SYNOPSIS
 
181
*/
 
182
ib_api_status_t
 
183
ibsm_init(
 
184
  IN ibsm_t* const p_ibsm );
 
185
 
 
186
/*
 
187
* PARAMETERS
 
188
*       p_ibsm
 
189
*               A pointer to the ibsm_t struct that is about to be initialized
 
190
*
 
191
* RETURN VALUE
 
192
*       The status of the function.
 
193
*
 
194
* NOTES
 
195
*
 
196
* SEE ALSO
 
197
*       ibsm_construct
 
198
* *********/
 
199
 
 
200
 
 
201
/****f* IBIS: ibsm/ibsm_bind
 
202
* NAME
 
203
*       ibsm_bind
 
204
*
 
205
* DESCRIPTION
 
206
*      Binding the ibsm object to a lower level.
 
207
*
 
208
* SYNOPSIS
 
209
*/
 
210
ib_api_status_t
 
211
ibsm_bind(
 
212
  ibsm_t* p_ibsm );
 
213
 
 
214
/*
 
215
* PARAMETERS
 
216
*       p_ibsm
 
217
*               A pointer to the ibsm_t struct that is about to be binded
 
218
*
 
219
* RETURN VALUE
 
220
*       The status of the function.
 
221
*
 
222
* NOTES
 
223
*
 
224
* SEE ALSO
 
225
*       ibsm_construct
 
226
*********/
 
227
 
 
228
/****f* IBIS: ibsm/ibsm_send_mad_by_lid
 
229
* NAME
 
230
*     ibsm_send_mad_by_lid
 
231
*
 
232
* DESCRIPTION
 
233
*      Send a SMI mad to the given LID.
 
234
*
 
235
* SYNOPSIS
 
236
*   ibsm_send_mad_by_lid(p_ibsm, p_mad, lid, attr, mod, meth)
 
237
*   Note that all values are in host order.
 
238
*/
 
239
ib_api_status_t
 
240
ibsm_send_mad_by_lid(
 
241
  ibsm_t   *p_ibsm,
 
242
  uint8_t  *p_data,
 
243
  size_t    data_size,
 
244
  uint16_t  lid,
 
245
  uint16_t  attr,
 
246
  uint32_t  mod,
 
247
  uint16_t  meth);
 
248
/*
 
249
* PARAMETERS
 
250
*       p_ibsm
 
251
*               A pointer to the ibsm_t struct.
 
252
*
 
253
*       p_data
 
254
*               [in/out] A pointer to attribute data. Will be overwritten in case of response.
 
255
*
 
256
*       data_size
 
257
*               [in] The size of the attribute block
 
258
*
 
259
*       lid
 
260
*               The Destination lid of the MAD.
 
261
*
 
262
*       attr
 
263
*               The Attribute code
 
264
*
 
265
*       mod
 
266
*               Attribute modifier value
 
267
*
 
268
*       meth
 
269
*               The MAD method: Set/Get/Trap...
 
270
*
 
271
* RETURN VALUE
 
272
*       The status of the function or response status.
 
273
*
 
274
* NOTES
 
275
*
 
276
* SEE ALSO
 
277
*
 
278
*********/
 
279
 
 
280
/****f* IBIS: ibsm/ibsm_send_mad_by_dr
 
281
* NAME
 
282
*     ibsm_send_mad_by_dr
 
283
*
 
284
* DESCRIPTION
 
285
*      Send a SMI mad to the given a directed route
 
286
*
 
287
* SYNOPSIS
 
288
*   ibsm_send_mad_by_dr(p_ibsm, p_mad, dr[], attr, mod, meth)
 
289
*   Note that all values are in network order.
 
290
*/
 
291
ib_api_status_t
 
292
ibsm_send_mad_by_dr(
 
293
  ibsm_t   *p_ibsm,
 
294
  uint8_t  *p_data,
 
295
  size_t    data_size,
 
296
  ibsm_dr_path_t *dr,
 
297
  uint16_t  attr,
 
298
  uint32_t  mod,
 
299
  uint16_t  meth);
 
300
/*
 
301
* PARAMETERS
 
302
*       p_ibsm
 
303
*               A pointer to the ibsm_t struct.
 
304
*
 
305
*       p_data
 
306
*               [in/out] A pointer to attribute data. Will be overwritten in case of response.
 
307
*
 
308
*       data_size
 
309
*               [in] The size of the attribute block
 
310
*
 
311
*
 
312
*       dr
 
313
*               The directed route to the destination as an
 
314
*               array of bytes with last one is 0.
 
315
*
 
316
*       attr
 
317
*               The Attribute code
 
318
*
 
319
*       mod
 
320
*               Attribute modifier value
 
321
*
 
322
*       meth
 
323
*               The MAD method: Set/Get/Trap...
 
324
*
 
325
* RETURN VALUE
 
326
*       The status of the function or response status.
 
327
*
 
328
* NOTES
 
329
*
 
330
* SEE ALSO
 
331
*
 
332
*********/
 
333
 
 
334
#endif /* _IBSM_H_ */