2 * Copyright (c) 2006 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 * Declaration of osmtest_t.
39 * This object represents the OSMTest Test object.
46 #include <complib/cl_qmap.h>
47 #include <opensm/osm_log.h>
48 #include <vendor/osm_vendor_api.h>
49 #include <vendor/osm_vendor_sa_api.h>
50 #include <opensm/osm_mad_pool.h>
51 #include <opensm/osm_helper.h>
52 #include "osmtest_base.h"
53 #include "osmtest_subnet.h"
57 OSMT_FLOW_CREATE_INVENTORY,
58 OSMT_FLOW_VALIDATE_INVENTORY,
59 OSMT_FLOW_SERVICE_REGISTRATION,
60 OSMT_FLOW_EVENT_FORWARDING,
67 /****s* OpenSM: Subnet/osmtest_opt_t
72 * Subnet options structure. This structure contains the various
73 * site specific configuration parameters for osmtest.
77 typedef struct _osmtest_opt {
78 uint32_t transaction_timeout;
79 boolean_t force_log_flush;
84 char file_name[OSMTEST_FILE_PATH_MAX];
88 boolean_t ignore_path_records;
97 /****h* OSMTest/OSMTest
102 * The OSMTest object tests an SM/SA for conformance to a known
103 * set of data about an Infiniband subnet.
110 /****s* OSMTest/osmtest_t
117 * This object should be treated as opaque and should
118 * be manipulated only through the provided functions.
122 typedef struct _osmtest {
124 struct _osm_vendor *p_vendor;
125 osm_bind_handle_t h_bind;
126 osm_mad_pool_t mad_pool;
129 ib_port_attr_t local_port;
131 cl_qpool_t node_pool;
132 cl_qpool_t port_pool;
133 cl_qpool_t link_pool;
141 * Log facility used by all OSMTest components.
144 * Pointer to the vendor transport layer.
147 * The bind handle obtained by osm_vendor_sa_api/osmv_bind_sa
150 * The mad pool provided for teh vendor layer to allocate mad wrappers in
153 * osmtest options structure
156 * Port attributes for the port over which osmtest is running.
159 * Subnet object representing the expected subnet
162 * Pool of objects for use in populating the subnet databases.
165 * Pool of objects for use in populating the subnet databases.
168 * Pool of objects for use in populating the subnet databases.
173 /****s* OpenSM: Subnet/osmtest_req_context_t
175 * osmtest_req_context_t
178 * Query context for ib_query callback function.
182 typedef struct _osmtest_req_context {
184 osmv_query_res_t result;
185 } osmtest_req_context_t;
187 typedef struct _osmtest_mgrp_t {
188 cl_map_item_t map_item;
189 ib_member_rec_t mcmember_rec;
198 /****f* OSMTest/osmtest_construct
203 * This function constructs an OSMTest object.
207 void osmtest_construct(IN osmtest_t * const p_osmt);
212 * [in] Pointer to a OSMTest object to construct.
215 * This function does not return a value.
218 * Allows calling osmtest_init, osmtest_destroy.
220 * Calling osmtest_construct is a prerequisite to calling any other
221 * method except osmtest_init.
224 * SM object, osmtest_init, osmtest_destroy
227 /****f* OSMTest/osmtest_destroy
232 * The osmtest_destroy function destroys an osmtest object, releasing
237 void osmtest_destroy(IN osmtest_t * const p_osmt);
242 * [in] Pointer to a OSMTest object to destroy.
245 * This function does not return a value.
248 * Performs any necessary cleanup of the specified OSMTest object.
249 * Further operations should not be attempted on the destroyed object.
250 * This function should only be called after a call to osmtest_construct or
254 * SM object, osmtest_construct, osmtest_init
257 /****f* OSMTest/osmtest_init
262 * The osmtest_init function initializes a OSMTest object for use.
266 ib_api_status_t osmtest_init(IN osmtest_t * const p_osmt,
267 IN const osmtest_opt_t * const p_opt,
268 IN const osm_log_level_t log_flags);
273 * [in] Pointer to an osmtest_t object to initialize.
276 * [in] Pointer to the options structure.
279 * [in] Log level flags to set.
282 * IB_SUCCESS if the OSMTest object was initialized successfully.
285 * Allows calling other OSMTest methods.
288 * SM object, osmtest_construct, osmtest_destroy
291 /****f* OSMTest/osmtest_run
296 * Runs the osmtest suite.
300 ib_api_status_t osmtest_run(IN osmtest_t * const p_osmt);
305 * [in] Pointer to an osmtest_t object.
308 * [in] Port GUID over which to run the test suite.
318 /****f* OSMTest/osmtest_bind
323 * Binds osmtest to a local port.
327 ib_api_status_t osmtest_bind(IN osmtest_t * p_osmt,
328 IN uint16_t max_lid, IN ib_net64_t guid OPTIONAL);
333 * [in] Pointer to an osmtest_t object.
336 * [in] The maximal lid to query about (if RMPP is not supported)
339 * [in] Port GUID over which to run the test suite.
340 * If zero, the bind function will display a menu of local
341 * port guids and wait for user input.
351 /****f* OSMTest/osmtest_query_res_cb
353 * osmtest_query_res_cb
356 * A Callback for the query to invoke on completion
360 void osmtest_query_res_cb(IN osmv_query_res_t * p_rec);
364 * [in] Pointer to an ib_query_rec_t object used for the query.
374 /****f* OSMTest/ib_get_mad_status_str
376 * ib_get_mad_status_str
379 * return the string representing the given mad status
383 const char *ib_get_mad_status_str(IN const ib_mad_t * const p_mad);
387 * [in] Pointer to the mad payload
397 /****f* OSMTest/osmt_run_service_records_flow
399 * osmt_run_service_records_flow
402 * Run the service record testing flow.
406 ib_api_status_t osmt_run_service_records_flow(IN osmtest_t * const p_osmt);
410 * [in] Pointer to the osmtest obj
420 ib_api_status_t osmt_run_inform_info_flow(IN osmtest_t * const p_osmt);
422 /****f* OSMTest/osmt_run_slvl_and_vlarb_records_flow
424 * osmt_run_slvl_and_vlarb_records_flow
427 * Run the sl2vl and vlarb tables testing flow.
432 osmt_run_slvl_and_vlarb_records_flow(IN osmtest_t * const p_osmt);
436 * [in] Pointer to the osmtest obj
446 /****f* OSMTest/osmt_run_mcast_flow
448 * osmt_run_mcast_flow
451 * Run the multicast test flow
455 ib_api_status_t osmt_run_mcast_flow(IN osmtest_t * const p_osmt);
459 * [in] Pointer to the osmtest obj
469 /****f* OSMTest/osmt_run_trap64_65_flow
471 * osmt_run_trap64_65_flow
474 * Run the trap 64/65 test flow. This test is ran with
479 ib_api_status_t osmt_run_trap64_65_flow(IN osmtest_t * const p_osmt);
483 * [in] Pointer to the osmtest obj
494 osmtest_get_all_recs(IN osmtest_t * const p_osmt,
495 IN ib_net16_t const attr_id,
496 IN size_t const attr_size,
497 IN OUT osmtest_req_context_t * const p_context);
500 osmtest_get_local_port_lmc(IN osmtest_t * const p_osmt,
501 IN ib_net16_t lid, OUT uint8_t * const p_lmc);
504 * A few auxiliary macros for logging
507 #define EXPECTING_ERRORS_START "[[ ===== Expecting Errors - START ===== "
508 #define EXPECTING_ERRORS_END " ===== Expecting Errors - END ===== ]]"
510 #endif /* _OSMTEST_H_ */