2 * Copyright (c) 2004-2008 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 osm_inform_rec_t.
39 * This object represents an IBA Inform Record.
40 * This object is part of the OpenSM family of objects.
43 * Eitan Zahavi, Mellanox
49 #include <iba/ib_types.h>
50 #include <complib/cl_qmap.h>
51 #include <complib/cl_spinlock.h>
52 #include <opensm/osm_subnet.h>
53 #include <opensm/osm_madw.h>
54 #include <opensm/osm_log.h>
55 #include <opensm/osm_sa.h>
58 # define BEGIN_C_DECLS extern "C" {
59 # define END_C_DECLS }
60 #else /* !__cplusplus */
61 # define BEGIN_C_DECLS
63 #endif /* __cplusplus */
66 /****h* OpenSM/Inform Record
71 * The Inform record encapsulates the information needed by the
72 * SA to manage InformInfo registrations and sending Reports(Notice)
73 * when SM receives Traps for registered LIDs.
75 * The inform records is not thread safe, thus callers must provide
78 * This object should be treated as opaque and should be
79 * manipulated only through the provided functions.
82 * Eitan Zahavi, Mellanox
85 /****s* OpenSM: Inform Record/osm_infr_t
90 * Inform Record structure.
92 * The osm_infr_t object should be treated as opaque and should
93 * be manipulated only through the provided functions.
97 typedef struct osm_infr {
98 cl_list_item_t list_item;
99 osm_bind_handle_t h_bind;
101 osm_mad_addr_t report_addr;
102 ib_inform_info_record_t inform_record;
107 * List Item for qlist linkage. Must be first element!!
110 * A handle of lower level mad srvc
113 * A pointer to osm_sa object
119 * The Inform Info Record
124 /****f* OpenSM: Inform Record/osm_infr_new
129 * Allocates and initializes a Inform Record for use.
133 osm_infr_t *osm_infr_new(IN const osm_infr_t * p_infr_rec);
137 * [in] Pointer to IB Inform Record
140 * pointer to osm_infr_t structure.
143 * Allows calling other inform record methods.
146 * Inform Record, osm_infr_delete
149 /****f* OpenSM: Inform Record/osm_infr_delete
154 * Destroys and deallocates the osm_infr_t structure.
158 void osm_infr_delete(IN osm_infr_t * const p_infr);
162 * [in] Pointer to osm_infr_t structure
165 * Inform Record, osm_infr_new
168 /****f* OpenSM: Inform Record/osm_infr_get_by_rec
170 * osm_infr_get_by_rec
173 * Find a matching osm_infr_t in the subnet DB by inform_info_record
177 osm_infr_t *osm_infr_get_by_rec(IN osm_subn_t const *p_subn,
178 IN osm_log_t * p_log,
179 IN osm_infr_t * const p_infr_rec);
183 * [in] Pointer to the subnet object
186 * [in] Pointer to the log object
189 * [in] Pointer to an inform_info record
192 * The matching osm_infr_t
194 * Inform Record, osm_infr_new, osm_infr_delete
198 osm_infr_insert_to_db(IN osm_subn_t * p_subn,
199 IN osm_log_t * p_log, IN osm_infr_t * p_infr);
202 osm_infr_remove_from_db(IN osm_subn_t * p_subn,
203 IN osm_log_t * p_log, IN osm_infr_t * p_infr);
205 /****f* OpenSM: Inform Record/osm_report_notice
210 * Once a Trap was received by the osm_trap_rcv, or a Trap sourced in
211 * the SM was sent (Traps 64-67) this routine is called with a copy of
213 * Given a notice attribute - compare and see if it matches the InformInfo
214 * Element and if it does - call the Report(Notice) for the
215 * target QP registered by the address stored in the InformInfo element
220 osm_report_notice(IN osm_log_t * const p_log,
221 IN osm_subn_t * p_subn, IN ib_mad_notice_attr_t * p_ntc);
225 * [in] Pointer to the trap receiver
228 * [in] Pointer to a copy of the incoming trap notice attribute.
231 * IB_SUCCESS on good completion
234 * Inform Record, osm_trap_rcv
238 #endif /* _OSM_INFR_H_ */