1219820Sjeff/*
2219820Sjeff * Copyright (c) 2004-2006 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 * 	Specification of the OpenSM SA Client API. This API uses the basic osm
39219820Sjeff *    vendor API to provide SA Client interface.
40219820Sjeff */
41219820Sjeff
42219820Sjeff#ifndef _OSM_VENDOR_SA_API_H_
43219820Sjeff#define _OSM_VENDOR_SA_API_H_
44219820Sjeff
45219820Sjeff#include <iba/ib_types.h>
46219820Sjeff
47219820Sjeff#ifdef __cplusplus
48219820Sjeff#  define BEGIN_C_DECLS extern "C" {
49219820Sjeff#  define END_C_DECLS   }
50219820Sjeff#else				/* !__cplusplus */
51219820Sjeff#  define BEGIN_C_DECLS
52219820Sjeff#  define END_C_DECLS
53219820Sjeff#endif				/* __cplusplus */
54219820Sjeff
55219820SjeffBEGIN_C_DECLS
56219820Sjeff/****d* OpenSM Vendor SA Client/osmv_flags_t
57219820Sjeff* NAME
58219820Sjeff*	osmv_flags_t
59219820Sjeff*
60219820Sjeff* DESCRIPTION
61219820Sjeff*	Access layer flags used to direct the operation of various calls.
62219820Sjeff*
63219820Sjeff* SYNOPSIS
64219820Sjeff*/
65219820Sjefftypedef uint32_t osmv_flags_t;
66219820Sjeff#define OSM_SA_FLAGS_SYNC				0x00000001
67219820Sjeff/*
68219820Sjeff* VALUES
69219820Sjeff*	OSM_SA_FLAGS_SYNC
70219820Sjeff*		Indicates that the given operation should be performed synchronously.
71219820Sjeff*		The call will block until it completes.  Callbacks will still be
72219820Sjeff*		invoked.
73219820Sjeff*
74219820Sjeff* SEE ALSO
75219820Sjeff*  osmv_query_sa
76219820Sjeff*****/
77219820Sjeff
78219820Sjeff/****d* OpenSM Vendor SA Client/osmv_query_type_t
79219820Sjeff* NAME
80219820Sjeff*	osmv_query_type_t
81219820Sjeff*
82219820Sjeff* DESCRIPTION
83219820Sjeff*	Abstracted queries supported by the access layer.
84219820Sjeff*
85219820Sjeff* SYNOPSIS
86219820Sjeff*/
87219820Sjefftypedef enum _osmv_query_type {
88219820Sjeff	OSMV_QUERY_USER_DEFINED,
89219820Sjeff
90219820Sjeff	OSMV_QUERY_ALL_SVC_RECS,
91219820Sjeff	OSMV_QUERY_SVC_REC_BY_NAME,
92219820Sjeff	OSMV_QUERY_SVC_REC_BY_ID,
93219820Sjeff
94219820Sjeff	OSMV_QUERY_CLASS_PORT_INFO,
95219820Sjeff
96219820Sjeff	OSMV_QUERY_NODE_REC_BY_NODE_GUID,
97219820Sjeff	OSMV_QUERY_PORT_REC_BY_LID,
98219820Sjeff	OSMV_QUERY_PORT_REC_BY_LID_AND_NUM,
99219820Sjeff
100219820Sjeff	OSMV_QUERY_VLARB_BY_LID_PORT_BLOCK,
101219820Sjeff	OSMV_QUERY_SLVL_BY_LID_AND_PORTS,
102219820Sjeff
103219820Sjeff	OSMV_QUERY_PATH_REC_BY_PORT_GUIDS,
104219820Sjeff	OSMV_QUERY_PATH_REC_BY_GIDS,
105219820Sjeff	OSMV_QUERY_PATH_REC_BY_LIDS,
106219820Sjeff
107219820Sjeff	OSMV_QUERY_UD_MULTICAST_SET,
108219820Sjeff	OSMV_QUERY_UD_MULTICAST_DELETE,
109219820Sjeff
110219820Sjeff	OSMV_QUERY_MULTIPATH_REC,
111219820Sjeff
112219820Sjeff} osmv_query_type_t;
113219820Sjeff/*
114219820Sjeff* VALUES
115219820Sjeff*	OSMV_QUERY_USER_DEFINED
116219820Sjeff*		Query the SA based on user-defined input.  Queries of this type
117219820Sjeff*		should reference an osmv_user_query_t structure as input to the
118219820Sjeff*		query.
119219820Sjeff*
120219820Sjeff*	OSMV_QUERY_SVC_REC_BY_NAME
121219820Sjeff*		Query for service records based on the service name.  Queries of
122219820Sjeff*		this type should reference an ib_svc_name_t structure as input
123219820Sjeff*		to the query.
124219820Sjeff*
125219820Sjeff*	OSMV_QUERY_SVC_REC_BY_ID
126219820Sjeff*		Query for service records based on the service ID.  Queries of
127219820Sjeff*		this type should reference an ib_net64_t value that indicates
128219820Sjeff*		the ID of the service being requested.
129219820Sjeff*
130219820Sjeff*	OSMV_QUERY_NODE_REC_BY_NODE_GUID
131219820Sjeff*		Query for node information based on the node's GUID.  Queries of
132219820Sjeff*		this type should reference an ib_net64_t value that indicates
133219820Sjeff*		the GUID of the node being requested.
134219820Sjeff*
135219820Sjeff*	OSMV_QUERY_PORT_REC_BY_LID
136219820Sjeff*		Query for port information based on the port's base LID. Queries
137219820Sjeff*		of this type should reference an ib_net16_t value that indicates
138219820Sjeff*		the base LID of the port being requested.
139219820Sjeff*
140219820Sjeff*	OSMV_QUERY_PORT_REC_BY_LID_AND_NUM
141219820Sjeff*		Query for port information based on the port's LID and port num.
142219820Sjeff*		Queries of this type should reference an osmv_user_query_t
143219820Sjeff*		structure as input to the query. The port num and lid should
144219820Sjeff*		be provided by it.
145219820Sjeff*
146219820Sjeff*	OSMV_QUERY_PATH_REC_BY_PORT_GUIDS
147219820Sjeff*		Query for path records between the specified pair of port GUIDs.
148219820Sjeff*		Queries of this type should reference an osmv_guid_pair_t
149219820Sjeff*		structure that indicates the GUIDs of the path being requested.
150219820Sjeff*
151219820Sjeff*	OSMV_QUERY_PATH_REC_BY_GIDS
152219820Sjeff*		Query for path records between the specified pair of port GIDs.
153219820Sjeff*		Queries of this type should reference an osmv_gid_pair_t
154219820Sjeff*		structure that indicates the GIDs of the path being requested.
155219820Sjeff*
156219820Sjeff*	OSMV_QUERY_PATH_REC_BY_LIDS
157219820Sjeff*		Query for path records between the specified pair of port LIDs.
158219820Sjeff*		Queries of this type should reference an osmv_lid_pair_t
159219820Sjeff*		structure that indicates the LIDs of the path being requested.
160219820Sjeff*
161219820Sjeff* NOTES
162219820Sjeff*	This enum is used to define abstracted queries provided by the access
163219820Sjeff*	layer.  Users may issue queries not listed here by sending MADs directly
164219820Sjeff*	to subnet administration or a class manager.  These queries are
165219820Sjeff*	intended to represent those most often used by clients.
166219820Sjeff*
167219820Sjeff* SEE ALSO
168219820Sjeff*	osmv_query, osmv_query_req_t, osmv_user_query_t, osmv_gid_pair_t,
169219820Sjeff*	osmv_lid_pair_t osmv_guid_pair_t
170219820Sjeff*****/
171219820Sjeff
172219820Sjeff/****s* OpenSM Vendor SA Client/osmv_user_query_t
173219820Sjeff* NAME
174219820Sjeff*	osmv_user_query_t
175219820Sjeff*
176219820Sjeff* DESCRIPTION
177219820Sjeff*	User-defined query information.
178219820Sjeff*
179219820Sjeff* SYNOPSIS
180219820Sjeff*/
181219820Sjefftypedef struct _osmv_user_query {
182219820Sjeff	uint8_t method;
183219820Sjeff	ib_net16_t attr_id;
184219820Sjeff	ib_net16_t attr_offset;
185219820Sjeff	ib_net32_t attr_mod;
186219820Sjeff	ib_net64_t comp_mask;
187219820Sjeff	void *p_attr;
188219820Sjeff} osmv_user_query_t;
189219820Sjeff/*
190219820Sjeff* FIELDS
191219820Sjeff*
192219820Sjeff*	method
193219820Sjeff*		Method to be used
194219820Sjeff*
195219820Sjeff*	attr_id
196219820Sjeff*		Attribute identifier of query data.
197219820Sjeff*
198219820Sjeff*	attr_offset
199219820Sjeff*		Size of the query attribute, in 8-byte words.  Users can set
200219820Sjeff*		this value by passing in the sizeof( attribute ) into the
201219820Sjeff*		ib_get_attr_offset() routine.
202219820Sjeff*
203219820Sjeff*	attr_mod
204219820Sjeff*		Attribute modifier for query request.
205219820Sjeff*
206219820Sjeff*	comp_mask
207219820Sjeff*		Indicates the attribute components that are specified for the
208219820Sjeff*		query.
209219820Sjeff*
210219820Sjeff*	p_attr
211219820Sjeff*		References the attribute structure used as input into the query.
212219820Sjeff*		This field is ignored if comp_mask is set to 0.
213219820Sjeff*
214219820Sjeff* NOTES
215219820Sjeff*	This structure is used to describe a user-defined query.  The attribute
216219820Sjeff*	ID, attribute offset, component mask, and attribute structure must match
217219820Sjeff*	those defined by the IBA specification.  Users should refer to chapter
218219820Sjeff*	15 of the IBA specification for additional details.
219219820Sjeff*
220219820Sjeff* SEE ALSO
221219820Sjeff*	osmv_query_type_t, ib_get_attr_offset, ib_get_attr_size, osmv_query_sa
222219820Sjeff*****/
223219820Sjeff
224219820Sjeff/****s* OpenSM Vendor SA Client/osmv_gid_pair_t
225219820Sjeff* NAME
226219820Sjeff*	osmv_gid_pair_t
227219820Sjeff*
228219820Sjeff* DESCRIPTION
229219820Sjeff*	Source and destination GIDs.
230219820Sjeff*
231219820Sjeff* SYNOPSIS
232219820Sjeff*/
233219820Sjefftypedef struct _osmv_gid_pair {
234219820Sjeff	ib_gid_t src_gid;
235219820Sjeff	ib_gid_t dest_gid;
236219820Sjeff} osmv_gid_pair_t;
237219820Sjeff/*
238219820Sjeff* FIELDS
239219820Sjeff*	src_gid
240219820Sjeff*		Source GID of a path.
241219820Sjeff*
242219820Sjeff*	dest_gid
243219820Sjeff*		Destination GID of a path.
244219820Sjeff*
245219820Sjeff* NOTES
246219820Sjeff*	This structure is used to describe the endpoints of a path.
247219820Sjeff*
248219820Sjeff* SEE ALSO
249219820Sjeff*	ib_gid_t
250219820Sjeff*****/
251219820Sjeff
252219820Sjeff/****s* OpenSM Vendor SA Client/osmv_lid_pair_t
253219820Sjeff* NAME
254219820Sjeff*	osmv_lid_pair_t
255219820Sjeff*
256219820Sjeff* DESCRIPTION
257219820Sjeff*	Source and destination LIDs.
258219820Sjeff*
259219820Sjeff* SYNOPSIS
260219820Sjeff*/
261219820Sjefftypedef struct _osmv_lid_pair {
262219820Sjeff	ib_net16_t src_lid;
263219820Sjeff	ib_net16_t dest_lid;
264219820Sjeff} osmv_lid_pair_t;
265219820Sjeff/*
266219820Sjeff* FIELDS
267219820Sjeff*	src_lid
268219820Sjeff*		Source LID of a path.
269219820Sjeff*
270219820Sjeff*	dest_lid
271219820Sjeff*		Destination LID of a path.
272219820Sjeff*
273219820Sjeff* NOTES
274219820Sjeff*	This structure is used to describe the endpoints of a path.
275219820Sjeff*****/
276219820Sjeff
277219820Sjeff/****s* OpenSM Vendor SA Client/osmv_guid_pair_t
278219820Sjeff* NAME
279219820Sjeff*	osmv_guid_pair_t
280219820Sjeff*
281219820Sjeff* DESCRIPTION
282219820Sjeff*	Source and destination GUIDs.  These may be port or channel adapter
283219820Sjeff*	GUIDs, depending on the context in which this structure is used.
284219820Sjeff*
285219820Sjeff* SYNOPSIS
286219820Sjeff*/
287219820Sjefftypedef struct _osmv_guid_pair {
288219820Sjeff	ib_net64_t src_guid;
289219820Sjeff	ib_net64_t dest_guid;
290219820Sjeff} osmv_guid_pair_t;
291219820Sjeff/*
292219820Sjeff* FIELDS
293219820Sjeff*	src_guid
294219820Sjeff*		Source GUID of a path.
295219820Sjeff*
296219820Sjeff*	dest_guid
297219820Sjeff*		Destination GUID of a path.
298219820Sjeff*
299219820Sjeff* NOTES
300219820Sjeff*	This structure is used to describe the endpoints of a path.  The given
301219820Sjeff*	GUID pair may belong to either ports or channel adapters.
302219820Sjeff*
303219820Sjeff* SEE ALSO
304219820Sjeff*	ib_guid_t
305219820Sjeff*****/
306219820Sjeff
307219820Sjeff/****s* OpenSM Vendor SA Client/osmv_multipath_req_t
308219820Sjeff* NAME
309219820Sjeff*       osmv_multipath_req_t
310219820Sjeff*
311219820Sjeff* DESCRIPTION
312219820Sjeff*       Fields from which to generate a MultiPathRecord request.
313219820Sjeff*
314219820Sjeff* SYNOPSIS
315219820Sjeff*/
316219820Sjefftypedef struct _osmv_multipath_req_t {
317219820Sjeff	ib_net64_t comp_mask;
318219820Sjeff	uint16_t pkey;
319219820Sjeff	boolean_t reversible;
320219820Sjeff	uint8_t num_path;
321219820Sjeff	uint8_t sl;
322219820Sjeff	uint8_t independence;
323219820Sjeff	uint8_t sgid_count;
324219820Sjeff	uint8_t dgid_count;
325219820Sjeff	ib_gid_t gids[IB_MULTIPATH_MAX_GIDS];
326219820Sjeff} osmv_multipath_req_t;
327219820Sjeff/*
328219820Sjeff* FIELDS
329219820Sjeff*
330219820Sjeff* NOTES
331219820Sjeff*       This structure is used to describe a multipath request.
332219820Sjeff*
333219820Sjeff* SEE ALSO
334219820Sjeff*****/
335219820Sjeff
336219820Sjeff/****s* OpenSM Vendor SA Client/osmv_query_res_t
337219820Sjeff* NAME
338219820Sjeff*	osmv_query_res_t
339219820Sjeff*
340219820Sjeff* DESCRIPTION
341219820Sjeff*	Contains the results of a subnet administration query.
342219820Sjeff*
343219820Sjeff* SYNOPSIS
344219820Sjeff*/
345219820Sjefftypedef struct _osmv_query_res {
346219820Sjeff	const void *query_context;
347219820Sjeff	ib_api_status_t status;
348219820Sjeff	osmv_query_type_t query_type;
349219820Sjeff	uint32_t result_cnt;
350219820Sjeff	osm_madw_t *p_result_madw;
351219820Sjeff} osmv_query_res_t;
352219820Sjeff/*
353219820Sjeff* FIELDS
354219820Sjeff*	query_context
355219820Sjeff*		User-defined context information associated with the query
356219820Sjeff*		through the osm_vendor_query_sa call.
357219820Sjeff*
358219820Sjeff*	status
359219820Sjeff*		Indicates the success of the query operation.
360219820Sjeff*
361219820Sjeff*	query_type
362219820Sjeff*		Indicates the type of query for which the results are being
363219820Sjeff*		returned.  This matches the query_type specified through the
364219820Sjeff*               osm_vendor_query_sa call.
365219820Sjeff*
366219820Sjeff*	result_cnt
367219820Sjeff*		The number of result structures that were returned by the query.
368219820Sjeff*
369219820Sjeff*	p_result_madw
370219820Sjeff*		For queries returning IB_SUCCESS or IB_REMOTE_ERROR, this
371219820Sjeff*		references the MAD wrapper returned by subnet administration
372219820Sjeff*		containing the list of results or the returned error code.
373219820Sjeff*
374219820Sjeff* NOTES
375219820Sjeff*	A query result structure is returned to a client through their
376219820Sjeff*	osmv_pfn_query_cb_t routine to notify them of the results of a subnet
377219820Sjeff*	administration query.  If the query was successful or received an error
378219820Sjeff*	from subnet administration, p_result_madw will reference a MAD wrapper
379219820Sjeff*	containing the results.  The MAD referenced by p_result_madw is owned by
380219820Sjeff*	the user and remains available even after their callback returns.  Users
381219820Sjeff*	must call osm_mad_pool_put() to return the MAD wrapper back to the
382219820Sjeff*	mad pool when they are done accessing the results.
383219820Sjeff*
384219820Sjeff*	To retrieve individual result structures from the p_result_madw, users
385219820Sjeff*	may call osmv_get_query_result().
386219820Sjeff*
387219820Sjeff* SEE ALSO
388219820Sjeff*	osmv_query_sa, osmv_pfn_query_cb_t, ib_api_status_t,
389219820Sjeff*	osmv_query_status_t, osmv_query_type_t,
390219820Sjeff*	osmv_get_query_result
391219820Sjeff*****/
392219820Sjeff
393219820Sjeff/****f* OpenSM Vendor SA Client/osmv_get_query_result
394219820Sjeff* NAME
395219820Sjeff*	osmv_get_query_result
396219820Sjeff*
397219820Sjeff* DESCRIPTION
398219820Sjeff*	Retrieves a result structure from a MADW returned by a call to
399219820Sjeff*	osmv_query_sa().
400219820Sjeff*
401219820Sjeff* SYNOPSIS
402219820Sjeff*/
403219820Sjeffstatic inline void *osmv_get_query_result(IN osm_madw_t * p_result_madw,
404219820Sjeff					  IN uint32_t result_index)
405219820Sjeff{
406219820Sjeff	ib_sa_mad_t *p_sa_mad;
407219820Sjeff
408219820Sjeff	CL_ASSERT(p_result_madw);
409219820Sjeff	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
410219820Sjeff	CL_ASSERT(p_sa_mad);
411219820Sjeff	CL_ASSERT(ib_get_attr_size(p_sa_mad->attr_offset) * (result_index + 1) +
412219820Sjeff		  IB_SA_MAD_HDR_SIZE <= p_result_madw->mad_size);
413219820Sjeff
414219820Sjeff	return (p_sa_mad->data +
415219820Sjeff		(ib_get_attr_size(p_sa_mad->attr_offset) * result_index));
416219820Sjeff}
417219820Sjeff
418219820Sjeff/*
419219820Sjeff* PARAMETERS
420219820Sjeff*	p_result_madw
421219820Sjeff*		[in] This is a reference to the MAD returned as a result of the
422219820Sjeff*		query.
423219820Sjeff*
424219820Sjeff*	result_index
425219820Sjeff*		[in] A zero-based index indicating which result to return.
426219820Sjeff*
427219820Sjeff* NOTES
428219820Sjeff*	This call returns a pointer to the start of a result structure from a
429219820Sjeff*	call to osmv_query_sa().  The type of result structure must be known to
430219820Sjeff*	the user either through the user's context or the query_type returned as
431219820Sjeff*	part of the osmv_query_res_t structure.
432219820Sjeff*
433219820Sjeff* SEE ALSO
434219820Sjeff*	osmv_query_res_t, osm_madw_t
435219820Sjeff*****/
436219820Sjeff
437219820Sjeff/****f* OpenSM Vendor SA Client/osmv_get_query_path_rec
438219820Sjeff* NAME
439219820Sjeff*	osmv_get_query_path_rec
440219820Sjeff*
441219820Sjeff* DESCRIPTION
442219820Sjeff*	Retrieves a path record result from a MAD returned by a call to
443219820Sjeff*	osmv_query_sa().
444219820Sjeff*
445219820Sjeff* SYNOPSIS
446219820Sjeff*/
447219820Sjeffstatic inline ib_path_rec_t *osmv_get_query_path_rec(IN osm_madw_t *
448219820Sjeff						     p_result_madw,
449219820Sjeff						     IN uint32_t result_index)
450219820Sjeff{
451219820Sjeff	ib_sa_mad_t *p_sa_mad;
452219820Sjeff
453219820Sjeff	CL_ASSERT(p_result_madw);
454219820Sjeff	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
455219820Sjeff	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PATH_RECORD);
456219820Sjeff
457219820Sjeff	return ((ib_path_rec_t *)
458219820Sjeff		osmv_get_query_result(p_result_madw, result_index));
459219820Sjeff}
460219820Sjeff
461219820Sjeff/*
462219820Sjeff* PARAMETERS
463219820Sjeff*	p_result_madw
464219820Sjeff*		[in] This is a reference to the MAD returned as a result of the
465219820Sjeff*		query.
466219820Sjeff*
467219820Sjeff*	result_index
468219820Sjeff*		[in] A zero-based index indicating which result to return.
469219820Sjeff*
470219820Sjeff* NOTES
471219820Sjeff*	This call returns a pointer to the start of a path record result from
472219820Sjeff*	a call to osmv_query_sa().
473219820Sjeff*
474219820Sjeff* SEE ALSO
475219820Sjeff*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_path_rec_t
476219820Sjeff*****/
477219820Sjeff
478219820Sjeff/****f* OpenSM Vendor SA Client/osmv_get_query_portinfo_rec
479219820Sjeff* NAME
480219820Sjeff*	osmv_get_query_portinfo_rec
481219820Sjeff*
482219820Sjeff* DESCRIPTION
483219820Sjeff*	Retrieves a port info record result from a MAD returned by a call to
484219820Sjeff*	osmv_query_sa().
485219820Sjeff*
486219820Sjeff* SYNOPSIS
487219820Sjeff*/
488219820Sjeffstatic inline ib_portinfo_record_t *osmv_get_query_portinfo_rec(IN osm_madw_t *
489219820Sjeff								p_result_madw,
490219820Sjeff								IN uint32_t
491219820Sjeff								result_index)
492219820Sjeff{
493219820Sjeff	ib_sa_mad_t *p_sa_mad;
494219820Sjeff
495219820Sjeff	CL_ASSERT(p_result_madw);
496219820Sjeff	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
497219820Sjeff	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_PORTINFO_RECORD);
498219820Sjeff
499219820Sjeff	return ((ib_portinfo_record_t *) osmv_get_query_result(p_result_madw,
500219820Sjeff							       result_index));
501219820Sjeff}
502219820Sjeff
503219820Sjeff/*
504219820Sjeff* PARAMETERS
505219820Sjeff*	p_result_madw
506219820Sjeff*		[in] This is a reference to the MAD returned as a result of the
507219820Sjeff*		query.
508219820Sjeff*
509219820Sjeff*	result_index
510219820Sjeff*		[in] A zero-based index indicating which result to return.
511219820Sjeff*
512219820Sjeff* NOTES
513219820Sjeff*	This call returns a pointer to the start of a port info record result
514219820Sjeff*	from a call to osmv_query_sa().
515219820Sjeff*
516219820Sjeff* SEE ALSO
517219820Sjeff*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_portinfo_record_t
518219820Sjeff*****/
519219820Sjeff
520219820Sjeff/****f* OpenSM Vendor SA Client/osmv_get_query_node_rec
521219820Sjeff* NAME
522219820Sjeff*	osmv_get_query_node_rec
523219820Sjeff*
524219820Sjeff* DESCRIPTION
525219820Sjeff*	Retrieves a node record result from a MAD returned by a call to
526219820Sjeff*	osmv_query_sa().
527219820Sjeff*
528219820Sjeff* SYNOPSIS
529219820Sjeff*/
530219820Sjeffstatic inline ib_node_record_t *osmv_get_query_node_rec(IN osm_madw_t *
531219820Sjeff							p_result_madw,
532219820Sjeff							IN uint32_t
533219820Sjeff							result_index)
534219820Sjeff{
535219820Sjeff	ib_sa_mad_t *p_sa_mad;
536219820Sjeff
537219820Sjeff	CL_ASSERT(p_result_madw);
538219820Sjeff	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
539219820Sjeff	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_NODE_RECORD);
540219820Sjeff
541219820Sjeff	return ((ib_node_record_t *) osmv_get_query_result(p_result_madw,
542219820Sjeff							   result_index));
543219820Sjeff}
544219820Sjeff
545219820Sjeff/*
546219820Sjeff* PARAMETERS
547219820Sjeff*	p_result_madw
548219820Sjeff*		[in] This is a reference to the MAD returned as a result of the
549219820Sjeff*		query.
550219820Sjeff*
551219820Sjeff*	result_index
552219820Sjeff*		[in] A zero-based index indicating which result to return.
553219820Sjeff*
554219820Sjeff* NOTES
555219820Sjeff*	This call returns a pointer to the start of a node record result from
556219820Sjeff*	a call to osmv_query_sa().
557219820Sjeff*
558219820Sjeff* SEE ALSO
559219820Sjeff*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_node_record_t
560219820Sjeff*****/
561219820Sjeff
562219820Sjeff/****f* OpenSM Vendor SA Client/osmv_get_query_svc_rec
563219820Sjeff* NAME
564219820Sjeff*	osmv_get_query_svc_rec
565219820Sjeff*
566219820Sjeff* DESCRIPTION
567219820Sjeff*	Retrieves a service record result from a MAD returned by a call to
568219820Sjeff*	osmv_query_sa().
569219820Sjeff*
570219820Sjeff* SYNOPSIS
571219820Sjeff*/
572219820Sjeffstatic inline ib_service_record_t *osmv_get_query_svc_rec(IN osm_madw_t *
573219820Sjeff							  p_result_madw,
574219820Sjeff							  IN uint32_t
575219820Sjeff							  result_index)
576219820Sjeff{
577219820Sjeff	ib_sa_mad_t *p_sa_mad;
578219820Sjeff
579219820Sjeff	CL_ASSERT(p_result_madw);
580219820Sjeff	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
581219820Sjeff	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_SERVICE_RECORD);
582219820Sjeff
583219820Sjeff	return ((ib_service_record_t *) osmv_get_query_result(p_result_madw,
584219820Sjeff							      result_index));
585219820Sjeff}
586219820Sjeff
587219820Sjeff/*
588219820Sjeff* PARAMETERS
589219820Sjeff*	p_result_madw
590219820Sjeff*		[in] This is a reference to the MAD returned as a result of the
591219820Sjeff*		query.
592219820Sjeff*
593219820Sjeff*	result_index
594219820Sjeff*		[in] A zero-based index indicating which result to return.
595219820Sjeff*
596219820Sjeff* NOTES
597219820Sjeff*	This call returns a pointer to the start of a service record result from
598219820Sjeff*	a call to osmv_query_sa().
599219820Sjeff*
600219820Sjeff* SEE ALSO
601219820Sjeff*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_service_record_t
602219820Sjeff*****/
603219820Sjeff
604219820Sjeff/****f* OpenSM Vendor SA Client/osmv_get_query_mc_rec
605219820Sjeff* NAME
606219820Sjeff*	osmv_get_query_mc_rec
607219820Sjeff*
608219820Sjeff* DESCRIPTION
609219820Sjeff*	Retrieves a multicast record result from a MAD returned by a call to
610219820Sjeff*	osmv_query_sa().
611219820Sjeff*
612219820Sjeff* SYNOPSIS
613219820Sjeff*/
614219820Sjeffstatic inline ib_member_rec_t *osmv_get_query_mc_rec(IN osm_madw_t *
615219820Sjeff						     p_result_madw,
616219820Sjeff						     IN uint32_t result_index)
617219820Sjeff{
618219820Sjeff	ib_sa_mad_t *p_sa_mad;
619219820Sjeff
620219820Sjeff	CL_ASSERT(p_result_madw);
621219820Sjeff	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
622219820Sjeff	CL_ASSERT(p_sa_mad && p_sa_mad->attr_id == IB_MAD_ATTR_MCMEMBER_RECORD);
623219820Sjeff
624219820Sjeff	return ((ib_member_rec_t *) osmv_get_query_result(p_result_madw,
625219820Sjeff							  result_index));
626219820Sjeff}
627219820Sjeff
628219820Sjeff/*
629219820Sjeff* PARAMETERS
630219820Sjeff*	p_result_madw
631219820Sjeff*		[in] This is a reference to the MAD returned as a result of the
632219820Sjeff*		query.
633219820Sjeff*
634219820Sjeff*	result_index
635219820Sjeff*		[in] A zero-based index indicating which result to return.
636219820Sjeff*
637219820Sjeff* NOTES
638219820Sjeff*	This call returns a pointer to the start of a service record result from
639219820Sjeff*	a call to osmv_query_sa().
640219820Sjeff*
641219820Sjeff* SEE ALSO
642219820Sjeff*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_member_rec_t
643219820Sjeff*****/
644219820Sjeff
645219820Sjeff/****f* OpenSM Vendor SA Client/osmv_get_query_inform_info_rec
646219820Sjeff* NAME
647219820Sjeff*	osmv_get_query_inform_info_rec
648219820Sjeff*
649219820Sjeff* DESCRIPTION
650219820Sjeff*	Retrieves an InformInfo record result from a MAD returned by
651219820Sjeff*	a call to osmv_query_sa().
652219820Sjeff*
653219820Sjeff* SYNOPSIS
654219820Sjeff*/
655219820Sjeffstatic inline ib_inform_info_record_t *osmv_get_query_inform_info_rec(IN
656219820Sjeff								      osm_madw_t
657219820Sjeff								      *
658219820Sjeff								      p_result_madw,
659219820Sjeff								      IN
660219820Sjeff								      uint32_t
661219820Sjeff								      result_index)
662219820Sjeff{
663219820Sjeff	ib_sa_mad_t *p_sa_mad;
664219820Sjeff
665219820Sjeff	CL_ASSERT(p_result_madw);
666219820Sjeff	p_sa_mad = (ib_sa_mad_t *) osm_madw_get_mad_ptr(p_result_madw);
667219820Sjeff	CL_ASSERT(p_sa_mad
668219820Sjeff		  && p_sa_mad->attr_id == IB_MAD_ATTR_INFORM_INFO_RECORD);
669219820Sjeff
670219820Sjeff	return ((ib_inform_info_record_t *) osmv_get_query_result(p_result_madw,
671219820Sjeff								  result_index));
672219820Sjeff}
673219820Sjeff
674219820Sjeff/*
675219820Sjeff* PARAMETERS
676219820Sjeff*	p_result_madw
677219820Sjeff*		[in] This is a reference to the MAD returned as a result of the
678219820Sjeff*		query.
679219820Sjeff*
680219820Sjeff*	result_index
681219820Sjeff*		[in] A zero-based index indicating which result to return.
682219820Sjeff*
683219820Sjeff* NOTES
684219820Sjeff*	This call returns a pointer to the start of a service record result from
685219820Sjeff*	a call to osmv_query_sa().
686219820Sjeff*
687219820Sjeff* SEE ALSO
688219820Sjeff*	osmv_query_res_t, osm_madw_t, osmv_get_query_result, ib_inform_info_record_t
689219820Sjeff*****/
690219820Sjeff
691219820Sjeff/****f* OpenSM Vendor SA Client/osmv_pfn_query_cb_t
692219820Sjeff* NAME
693219820Sjeff*	osmv_pfn_query_cb_t
694219820Sjeff*
695219820Sjeff* DESCRIPTION
696219820Sjeff*	User-defined callback invoked on completion of subnet administration
697219820Sjeff*	query.
698219820Sjeff*
699219820Sjeff* SYNOPSIS
700219820Sjeff*/
701219820Sjefftypedef void
702219820Sjeff (*osmv_pfn_query_cb_t) (IN osmv_query_res_t * p_query_res);
703219820Sjeff/*
704219820Sjeff* PARAMETERS
705219820Sjeff*	p_query_res
706219820Sjeff*		[in] This is a reference to a structure containing the result of
707219820Sjeff*		the query.
708219820Sjeff*
709219820Sjeff* NOTES
710219820Sjeff*	This routine is invoked to notify a client of the result of a subnet
711219820Sjeff*	administration query.  The p_query_rec parameter references the result
712219820Sjeff*	of the query and, in the case of a successful query, any information
713219820Sjeff*	returned by subnet administration.
714219820Sjeff*
715219820Sjeff*	In the kernel, this callback is usually invoked using a tasklet,
716219820Sjeff*	dependent on the implementation of the underlying verbs provider driver.
717219820Sjeff*
718219820Sjeff* SEE ALSO
719219820Sjeff*	osmv_query_res_t
720219820Sjeff*****/
721219820Sjeff
722219820Sjeff/****s* OpenSM Vendor SA Client/osmv_query_req_t
723219820Sjeff* NAME
724219820Sjeff*	osmv_query_req_t
725219820Sjeff*
726219820Sjeff* DESCRIPTION
727219820Sjeff*	Information used to request an access layer provided query of subnet
728219820Sjeff*	administration.
729219820Sjeff*
730219820Sjeff* SYNOPSIS
731219820Sjeff*/
732219820Sjefftypedef struct _osmv_query_req {
733219820Sjeff	osmv_query_type_t query_type;
734219820Sjeff	const void *p_query_input;
735219820Sjeff	ib_net64_t sm_key;
736219820Sjeff
737219820Sjeff	uint32_t timeout_ms;
738219820Sjeff	uint32_t retry_cnt;
739219820Sjeff	osmv_flags_t flags;
740219820Sjeff
741219820Sjeff	const void *query_context;
742219820Sjeff	osmv_pfn_query_cb_t pfn_query_cb;
743219820Sjeff} osmv_query_req_t;
744219820Sjeff/*
745219820Sjeff* FIELDS
746219820Sjeff*	query_type
747219820Sjeff*		Indicates the type of query that the access layer should
748219820Sjeff*		perform.
749219820Sjeff*
750219820Sjeff*	p_query_input
751219820Sjeff*		A pointer to the input for the query.  The data referenced by
752219820Sjeff*		this structure is dependent on the type of query being requested
753219820Sjeff*		and is determined by the specified query_type.
754219820Sjeff*
755219820Sjeff*	sm_key
756219820Sjeff*		The M_Key to be provided with the SA MAD for authentication.
757219820Sjeff*		Normally 0 is used.
758219820Sjeff*
759219820Sjeff*	timeout_ms
760219820Sjeff*		Specifies the number of milliseconds to wait for a response for
761219820Sjeff*		this query until retrying or timing out the request.
762219820Sjeff*
763219820Sjeff*	retry_cnt
764219820Sjeff*		Specifies the number of times that the query will be retried
765219820Sjeff*		before failing the request.
766219820Sjeff*
767219820Sjeff*	flags
768219820Sjeff*		Used to describe the mode of operation.  Set to IB_FLAGS_SYNC to
769219820Sjeff*		process the called routine synchronously.
770219820Sjeff*
771219820Sjeff*	query_context
772219820Sjeff*		User-defined context information associated with this query.
773219820Sjeff*		The context data is returned to the user as a part of their
774219820Sjeff*		query callback.
775219820Sjeff*
776219820Sjeff*	pfn_query_cb
777219820Sjeff*		A user-defined callback that is invoked upon completion of the
778219820Sjeff*		query.
779219820Sjeff*
780219820Sjeff* NOTES
781219820Sjeff*	This structure is used when requesting an osm vendor provided query
782219820Sjeff*	of subnet administration.  Clients specify the type of query through
783219820Sjeff*	the query_type field.  Based on the type of query, the p_query_input
784219820Sjeff*	field is set to reference the appropriate data structure.
785219820Sjeff*
786219820Sjeff*	The information referenced by the p_query_input field is one of the
787219820Sjeff*	following:
788219820Sjeff*
789219820Sjeff*		-- a NULL terminated service name
790219820Sjeff*		-- a service id
791219820Sjeff*		-- a single GUID
792219820Sjeff*		-- a pair of GUIDs specified through an osmv_guid_pair_t structure
793219820Sjeff*		-- a pair of GIDs specified through an osmv_gid_pair_t structure
794219820Sjeff*
795219820Sjeff* SEE ALSO
796219820Sjeff*	osmv_query_type_t, osmv_pfn_query_cb_t, osmv_guid_pair_t,
797219820Sjeff*	osmv_gid_pair_t
798219820Sjeff*****/
799219820Sjeff
800219820Sjeff/****f* OpenSM Vendor SA Client/osmv_bind_sa
801219820Sjeff* NAME
802219820Sjeff*   osmv_bind_sa
803219820Sjeff*
804219820Sjeff* DESCRIPTION
805219820Sjeff*	Bind to the SA service and return a handle to be used for later
806219820Sjeff*  queries.
807219820Sjeff*
808219820Sjeff*
809219820Sjeff* SYNOPSIS
810219820Sjeff*/
811219820Sjeffosm_bind_handle_t
812219820Sjeffosmv_bind_sa(IN osm_vendor_t * const p_vend,
813219820Sjeff	     IN osm_mad_pool_t * const p_mad_pool, IN ib_net64_t port_guid);
814219820Sjeff/*
815219820Sjeff* PARAMETERS
816219820Sjeff*   p_vend
817219820Sjeff*	[in] an osm_vendor object to work with
818219820Sjeff*
819219820Sjeff*   p_mad_pool
820219820Sjeff*	[in] mad pool to obtain madw from
821219820Sjeff*
822219820Sjeff*   port_guid
823219820Sjeff*	[in] the port guid to attach to.
824219820Sjeff*
825219820Sjeff* RETURN VALUE
826219820Sjeff*	Bind handle to be used for later SA queries or OSM_BIND_INVALID_HANDLE
827219820Sjeff*
828219820Sjeff* NOTES
829219820Sjeff*
830219820Sjeff* SEE ALSO
831219820Sjeff* osmv_query_sa
832219820Sjeff*********/
833219820Sjeff
834219820Sjeff/****f* OpenSM Vendor SA Client/osmv_query_sa
835219820Sjeff* NAME
836219820Sjeff*   osmv_query_sa
837219820Sjeff*
838219820Sjeff* DESCRIPTION
839219820Sjeff*   Query the SA given an SA query request (similar to IBAL ib_query).
840219820Sjeff*
841219820Sjeff* SYNOPSIS
842219820Sjeff*/
843219820Sjeffib_api_status_t
844219820Sjeffosmv_query_sa(IN osm_bind_handle_t h_bind,
845219820Sjeff	      IN const osmv_query_req_t * const p_query_req);
846219820Sjeff/*
847219820Sjeff* PARAMETERS
848219820Sjeff*   h_bind
849219820Sjeff*	[in] bind handle for this port. Should be previously
850219820Sjeff*       obtained by calling osmv_bind_sa
851219820Sjeff*
852219820Sjeff*   p_query_req
853219820Sjeff*	[in] an SA query request structure.
854219820Sjeff*
855219820Sjeff* RETURN VALUE
856219820Sjeff*	IB_SUCCESS if completed successfuly (or in ASYNC mode
857219820Sjeff*	if the request was sent).
858219820Sjeff*
859219820Sjeff* NOTES
860219820Sjeff*
861219820Sjeff* SEE ALSO
862219820Sjeff* osmv_bind_sa
863219820Sjeff*********/
864219820Sjeff
865219820SjeffEND_C_DECLS
866219820Sjeff#endif				/* _OSM_VENDOR_SA_API_H_ */
867