1 /*
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.
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_MADW_H_
44 #define _OSM_MADW_H_
45
46 #include <string.h>
47 #include <iba/ib_types.h>
48 #include <complib/cl_qlist.h>
49 #include <complib/cl_dispatcher.h>
50 #include <opensm/osm_base.h>
51 #include <vendor/osm_vendor.h>
52
53 #ifdef __cplusplus
54 # define BEGIN_C_DECLS extern "C" {
55 # define END_C_DECLS }
56 #else /* !__cplusplus */
57 # define BEGIN_C_DECLS
58 # define END_C_DECLS
59 #endif /* __cplusplus */
60
61 BEGIN_C_DECLS
62 /****s* OpenSM: MAD Wrapper/osm_bind_info_t
63 * NAME
64 * osm_bind_info_t
65 *
66 * DESCRIPTION
67 *
68 * SYNOPSIS
69 */
70 typedef struct osm_bind_info {
71 ib_net64_t port_guid;
72 uint8_t mad_class;
73 uint8_t class_version;
74 boolean_t is_responder;
75 boolean_t is_trap_processor;
76 boolean_t is_report_processor;
77 uint32_t send_q_size;
78 uint32_t recv_q_size;
79 } osm_bind_info_t;
80 /*
81 * FIELDS
82 * portguid
83 * PortGuid of local port
84 *
85 * mad_class
86 * Mgmt Class ID
87 *
88 * class_version
89 * Mgmt Class version
90 *
91 * is_responder
92 * True if this is a GSI Agent
93 *
94 * is_trap_processor
95 * True if GSI Trap msgs are handled
96 *
97 * is_report_processor
98 * True if GSI Report msgs are handled
99 *
100 * send_q_size
101 * SendQueueSize
102 *
103 * recv_q_size
104 * Receive Queue Size
105 *
106 * SEE ALSO
107 *********/
108
109 /****h* OpenSM/MAD Wrapper
110 * NAME
111 * MAD Wrapper
112 *
113 * DESCRIPTION
114 * The MAD Wrapper object encapsulates the information needed by the
115 * OpenSM to manage individual MADs. The OpenSM allocates one MAD Wrapper
116 * per MAD.
117 *
118 * The MAD Wrapper is not thread safe, thus callers must provide
119 * serialization.
120 *
121 * This object should be treated as opaque and should be
122 * manipulated only through the provided functions.
123 *
124 * AUTHOR
125 * Steve King, Intel
126 *
127 *********/
128
129 /****s* OpenSM: MAD Wrapper/osm_ni_context_t
130 * NAME
131 * osm_ni_context_t
132 *
133 * DESCRIPTION
134 * Context needed by recipient of NodeInfo attribute.
135 *
136 * SYNOPSIS
137 */
138 typedef struct osm_ni_context {
139 ib_net64_t node_guid;
140 uint8_t port_num;
141 ib_net64_t dup_node_guid;
142 uint8_t dup_port_num;
143 unsigned dup_count;
144 } osm_ni_context_t;
145 /*
146 * FIELDS
147 * p_node
148 * Pointer to the node thru which we got to this node.
149 *
150 * p_sw
151 * Pointer to the switch object (if any) of the switch
152 * thru which we got to this node.
153 *
154 * port_num
155 * Port number on the node or switch thru which we got
156 * to this node.
157 *
158 * SEE ALSO
159 *********/
160
161 /****s* OpenSM: MAD Wrapper/osm_pi_context_t
162 * NAME
163 * osm_pi_context_t
164 *
165 * DESCRIPTION
166 * Context needed by recipient of PortInfo attribute.
167 *
168 * SYNOPSIS
169 */
170 typedef struct osm_pi_context {
171 ib_net64_t node_guid;
172 ib_net64_t port_guid;
173 boolean_t set_method;
174 boolean_t light_sweep;
175 boolean_t active_transition;
176 } osm_pi_context_t;
177 /*********/
178
179 /****s* OpenSM: MAD Wrapper/osm_nd_context_t
180 * NAME
181 * osm_nd_context_t
182 *
183 * DESCRIPTION
184 * Context needed by recipient of NodeDescription attribute.
185 *
186 * SYNOPSIS
187 */
188 typedef struct osm_nd_context {
189 ib_net64_t node_guid;
190 } osm_nd_context_t;
191 /*********/
192
193 /****s* OpenSM: MAD Wrapper/osm_si_context_t
194 * NAME
195 * osm_si_context_t
196 *
197 * DESCRIPTION
198 * Context needed by recipient of SwitchInfo attribute.
199 *
200 * SYNOPSIS
201 */
202 typedef struct osm_si_context {
203 ib_net64_t node_guid;
204 boolean_t set_method;
205 boolean_t light_sweep;
206 } osm_si_context_t;
207 /*********/
208
209 /****s* OpenSM: MAD Wrapper/osm_lft_context_t
210 * NAME
211 * osm_lft_context_t
212 *
213 * DESCRIPTION
214 * Context needed by recipient of LinearForwardingTable attribute.
215 *
216 * SYNOPSIS
217 */
218 typedef struct osm_lft_context {
219 ib_net64_t node_guid;
220 boolean_t set_method;
221 } osm_lft_context_t;
222 /*********/
223
224 /****s* OpenSM: MAD Wrapper/osm_mft_context_t
225 * NAME
226 * osm_mft_context_t
227 *
228 * DESCRIPTION
229 * Context needed by recipient of MulticastForwardingTable attribute.
230 *
231 * SYNOPSIS
232 */
233 typedef struct osm_mft_context {
234 ib_net64_t node_guid;
235 boolean_t set_method;
236 } osm_mft_context_t;
237 /*********/
238
239 /****s* OpenSM: MAD Wrapper/osm_smi_context_t
240 * NAME
241 * osm_smi_context_t
242 *
243 * DESCRIPTION
244 * Context needed by recipient of SMInfo attribute.
245 *
246 * SYNOPSIS
247 */
248 typedef struct osm_smi_context {
249 ib_net64_t port_guid;
250 boolean_t set_method;
251 boolean_t light_sweep;
252 } osm_smi_context_t;
253 /*********/
254
255 /****s* OpenSM: MAD Wrapper/osm_pkey_context_t
256 * NAME
257 * osm_pkey_context_t
258 *
259 * DESCRIPTION
260 * Context needed by recipient of P_Key attribute.
261 *
262 * SYNOPSIS
263 */
264 typedef struct osm_pkey_context {
265 ib_net64_t node_guid;
266 ib_net64_t port_guid;
267 boolean_t set_method;
268 } osm_pkey_context_t;
269 /*********/
270
271 /****s* OpenSM: MAD Wrapper/osm_slvl_context_t
272 * NAME
273 * osm_slvl_context_t
274 *
275 * DESCRIPTION
276 * Context needed by recipient of PortInfo attribute.
277 *
278 * SYNOPSIS
279 */
280 typedef struct osm_slvl_context {
281 ib_net64_t node_guid;
282 ib_net64_t port_guid;
283 boolean_t set_method;
284 } osm_slvl_context_t;
285 /*********/
286
287 /****s* OpenSM: MAD Wrapper/osm_vla_context_t
288 * NAME
289 * osm_vla_context_t
290 *
291 * DESCRIPTION
292 * Context needed by recipient of VL Arb attribute.
293 *
294 * SYNOPSIS
295 */
296 typedef struct osm_vla_context {
297 ib_net64_t node_guid;
298 ib_net64_t port_guid;
299 boolean_t set_method;
300 } osm_vla_context_t;
301 /*********/
302
303 /****s* OpenSM: MAD Wrapper/osm_perfmgr_context_t
304 * DESCRIPTION
305 * Context for Performance manager queries
306 */
307 typedef struct osm_perfmgr_context {
308 uint64_t node_guid;
309 uint16_t port;
310 uint8_t mad_method; /* was this a get or a set */
311 #if ENABLE_OSM_PERF_MGR_PROFILE
312 struct timeval query_start;
313 #endif
314 } osm_perfmgr_context_t;
315 /*********/
316
317 #ifndef OSM_VENDOR_INTF_OPENIB
318 /****s* OpenSM: MAD Wrapper/osm_arbitrary_context_t
319 * NAME
320 * osm_arbitrary_context_t
321 *
322 * DESCRIPTION
323 * Context needed by arbitrary recipient.
324 *
325 * SYNOPSIS
326 */
327 typedef struct osm_arbitrary_context {
328 void *context1;
329 void *context2;
330 } osm_arbitrary_context_t;
331 /*********/
332 #endif
333
334 /****s* OpenSM: MAD Wrapper/osm_madw_context_t
335 * NAME
336 * osm_madw_context_t
337 *
338 * DESCRIPTION
339 * Context needed by recipients of MAD responses.
340 *
341 * SYNOPSIS
342 */
343 typedef union _osm_madw_context {
344 osm_ni_context_t ni_context;
345 osm_pi_context_t pi_context;
346 osm_nd_context_t nd_context;
347 osm_si_context_t si_context;
348 osm_lft_context_t lft_context;
349 osm_mft_context_t mft_context;
350 osm_smi_context_t smi_context;
351 osm_slvl_context_t slvl_context;
352 osm_pkey_context_t pkey_context;
353 osm_vla_context_t vla_context;
354 osm_perfmgr_context_t perfmgr_context;
355 #ifndef OSM_VENDOR_INTF_OPENIB
356 osm_arbitrary_context_t arb_context;
357 #endif
358 } osm_madw_context_t;
359 /*********/
360
361 /****s* OpenSM: MAD Wrapper/osm_mad_addr_t
362 * NAME
363 * osm_mad_addr_t
364 *
365 * DESCRIPTION
366 *
367 * SYNOPSIS
368 */
369 typedef struct osm_mad_addr {
370 ib_net16_t dest_lid;
371 uint8_t path_bits;
372 uint8_t static_rate;
373 union addr_type {
374 struct _smi {
375 ib_net16_t source_lid;
376 uint8_t port_num;
377 } smi;
378
379 struct _gsi {
380 ib_net32_t remote_qp;
381 ib_net32_t remote_qkey;
382 uint16_t pkey_ix;
383 uint8_t service_level;
384 boolean_t global_route;
385 ib_grh_t grh_info;
386 } gsi;
387 } addr_type;
388 } osm_mad_addr_t;
389 /*
390 * FIELDS
391 *
392 * SEE ALSO
393 *********/
394
395 /****s* OpenSM: MAD Wrapper/osm_madw_t
396 * NAME
397 * osm_madw_t
398 *
399 * DESCRIPTION
400 * Context needed for processing individual MADs
401 *
402 * SYNOPSIS
403 */
404 typedef struct osm_madw {
405 cl_list_item_t list_item;
406 osm_bind_handle_t h_bind;
407 osm_vend_wrap_t vend_wrap;
408 osm_mad_addr_t mad_addr;
409 osm_bind_info_t bind_info;
410 osm_madw_context_t context;
411 uint32_t mad_size;
412 ib_api_status_t status;
413 cl_disp_msgid_t fail_msg;
414 boolean_t resp_expected;
415 const ib_mad_t *p_mad;
416 } osm_madw_t;
417 /*
418 * FIELDS
419 * list_item
420 * List linkage for lists. MUST BE FIRST MEMBER!
421 *
422 * h_bind
423 * Bind handle for the port on which this MAD will be sent
424 * or was received.
425 *
426 * vend_wrap
427 * Transport vendor specific context. This structure is not
428 * used outside MAD transport vendor specific code.
429 *
430 * context
431 * Union of controller specific contexts needed for this MAD.
432 * This structure allows controllers to indirectly communicate
433 * with each other through the dispatcher.
434 *
435 * mad_size
436 * Size of this MAD in bytes.
437 *
438 * status
439 * Status of completed operation on the MAD.
440 * CL_SUCCESS if the operation was successful.
441 *
442 * fail_msg
443 * Dispatcher message with which to post this MAD on failure.
444 * This value is set by the originator of the MAD.
445 * If an operation on this MAD fails, for example due to a timeout,
446 * then the transport layer will dispose of the MAD by sending
447 * it through the Dispatcher with this message type. Presumably,
448 * there is a controller listening for the failure message that can
449 * properly clean up.
450 *
451 * resp_expected
452 * TRUE if a response is expected to this MAD.
453 * FALSE otherwise.
454 *
455 * p_mad
456 * Pointer to the wire MAD. The MAD itself cannot be part of the
457 * wrapper, since wire MADs typically reside in special memory
458 * registered with the local HCA.
459 *
460 * SEE ALSO
461 *********/
462
463 /****f* OpenSM: MAD Wrapper/osm_madw_init
464 * NAME
465 * osm_madw_init
466 *
467 * DESCRIPTION
468 * Initializes a MAD Wrapper object for use.
469 *
470 * SYNOPSIS
471 */
472 static inline void
osm_madw_init(IN osm_madw_t * const p_madw,IN osm_bind_handle_t h_bind,IN const uint32_t mad_size,IN const osm_mad_addr_t * const p_mad_addr)473 osm_madw_init(IN osm_madw_t * const p_madw,
474 IN osm_bind_handle_t h_bind,
475 IN const uint32_t mad_size,
476 IN const osm_mad_addr_t * const p_mad_addr)
477 {
478 memset(p_madw, 0, sizeof(*p_madw));
479 p_madw->h_bind = h_bind;
480 p_madw->fail_msg = CL_DISP_MSGID_NONE;
481 p_madw->mad_size = mad_size;
482 if (p_mad_addr)
483 p_madw->mad_addr = *p_mad_addr;
484 p_madw->resp_expected = FALSE;
485 }
486
487 /*
488 * PARAMETERS
489 * p_madw
490 * [in] Pointer to an osm_madw_t object to initialize.
491 *
492 * h_bind
493 * [in] Pointer to the wire MAD.
494 *
495 * p_mad_addr
496 * [in] Pointer to the MAD address structure. This parameter may
497 * be NULL for directed route MADs.
498 *
499 * RETURN VALUES
500 * None.
501 *
502 * NOTES
503 *
504 * SEE ALSO
505 *********/
506
507 /****f* OpenSM: MAD Wrapper/osm_madw_get_smp_ptr
508 * NAME
509 * osm_madw_get_smp_ptr
510 *
511 * DESCRIPTION
512 * Gets a pointer to the SMP in this MAD.
513 *
514 * SYNOPSIS
515 */
osm_madw_get_smp_ptr(IN const osm_madw_t * const p_madw)516 static inline ib_smp_t *osm_madw_get_smp_ptr(IN const osm_madw_t * const p_madw)
517 {
518 return ((ib_smp_t *) p_madw->p_mad);
519 }
520
521 /*
522 * PARAMETERS
523 * p_madw
524 * [in] Pointer to an osm_madw_t object to initialize.
525 *
526 * RETURN VALUES
527 * Pointer to the start of the SMP MAD.
528 *
529 * NOTES
530 *
531 * SEE ALSO
532 * MAD Wrapper object
533 *********/
534
535 /****f* OpenSM: MAD Wrapper/osm_madw_get_sa_mad_ptr
536 * NAME
537 * osm_madw_get_sa_mad_ptr
538 *
539 * DESCRIPTION
540 * Gets a pointer to the SA MAD in this MAD wrapper.
541 *
542 * SYNOPSIS
543 */
osm_madw_get_sa_mad_ptr(IN const osm_madw_t * const p_madw)544 static inline ib_sa_mad_t *osm_madw_get_sa_mad_ptr(IN const osm_madw_t *
545 const p_madw)
546 {
547 return ((ib_sa_mad_t *) p_madw->p_mad);
548 }
549
550 /*
551 * PARAMETERS
552 * p_madw
553 * [in] Pointer to an osm_madw_t object.
554 *
555 * RETURN VALUES
556 * Pointer to the start of the SA MAD.
557 *
558 * NOTES
559 *
560 * SEE ALSO
561 * MAD Wrapper object
562 *********/
563
564 /****f* OpenSM: MAD Wrapper/osm_madw_get_perfmgt_mad_ptr
565 * DESCRIPTION
566 * Gets a pointer to the PerfMgt MAD in this MAD wrapper.
567 *
568 * SYNOPSIS
569 */
osm_madw_get_perfmgt_mad_ptr(IN const osm_madw_t * const p_madw)570 static inline ib_perfmgt_mad_t *osm_madw_get_perfmgt_mad_ptr(IN const osm_madw_t
571 * const p_madw)
572 {
573 return ((ib_perfmgt_mad_t *) p_madw->p_mad);
574 }
575
576 /*
577 * PARAMETERS
578 * p_madw
579 * [in] Pointer to an osm_madw_t object.
580 *
581 * RETURN VALUES
582 * Pointer to the start of the PerfMgt MAD.
583 *
584 * NOTES
585 *
586 * SEE ALSO
587 * MAD Wrapper object
588 *********/
589
590 /****f* OpenSM: MAD Wrapper/osm_madw_get_ni_context_ptr
591 * NAME
592 * osm_madw_get_ni_context_ptr
593 *
594 * DESCRIPTION
595 * Gets a pointer to the NodeInfo context in this MAD.
596 *
597 * SYNOPSIS
598 */
osm_madw_get_ni_context_ptr(IN const osm_madw_t * const p_madw)599 static inline osm_ni_context_t *osm_madw_get_ni_context_ptr(IN const osm_madw_t
600 * const p_madw)
601 {
602 return ((osm_ni_context_t *) & p_madw->context);
603 }
604
605 /*
606 * PARAMETERS
607 * p_madw
608 * [in] Pointer to an osm_madw_t object.
609 *
610 * RETURN VALUES
611 * Pointer to the start of the context structure.
612 *
613 * NOTES
614 *
615 * SEE ALSO
616 *********/
617
618 /****f* OpenSM: MAD Wrapper/osm_madw_get_pi_context_ptr
619 * NAME
620 * osm_madw_get_pi_context_ptr
621 *
622 * DESCRIPTION
623 * Gets a pointer to the PortInfo context in this MAD.
624 *
625 * SYNOPSIS
626 */
osm_madw_get_pi_context_ptr(IN const osm_madw_t * const p_madw)627 static inline osm_pi_context_t *osm_madw_get_pi_context_ptr(IN const osm_madw_t
628 * const p_madw)
629 {
630 return ((osm_pi_context_t *) & p_madw->context);
631 }
632
633 /*
634 * PARAMETERS
635 * p_madw
636 * [in] Pointer to an osm_madw_t object.
637 *
638 * RETURN VALUES
639 * Pointer to the start of the context structure.
640 *
641 * NOTES
642 *
643 * SEE ALSO
644 *********/
645
646 /****f* OpenSM: MAD Wrapper/osm_madw_get_nd_context_ptr
647 * NAME
648 * osm_madw_get_nd_context_ptr
649 *
650 * DESCRIPTION
651 * Gets a pointer to the NodeDescription context in this MAD.
652 *
653 * SYNOPSIS
654 */
osm_madw_get_nd_context_ptr(IN const osm_madw_t * const p_madw)655 static inline osm_nd_context_t *osm_madw_get_nd_context_ptr(IN const osm_madw_t
656 * const p_madw)
657 {
658 return ((osm_nd_context_t *) & p_madw->context);
659 }
660
661 /*
662 * PARAMETERS
663 * p_madw
664 * [in] Pointer to an osm_madw_t object.
665 *
666 * RETURN VALUES
667 * Pointer to the start of the context structure.
668 *
669 * NOTES
670 *
671 * SEE ALSO
672 *********/
673
674 /****f* OpenSM: MAD Wrapper/osm_madw_get_lft_context_ptr
675 * NAME
676 * osm_madw_get_lft_context_ptr
677 *
678 * DESCRIPTION
679 * Gets a pointer to the LFT context in this MAD.
680 *
681 * SYNOPSIS
682 */
osm_madw_get_lft_context_ptr(IN const osm_madw_t * const p_madw)683 static inline osm_lft_context_t *osm_madw_get_lft_context_ptr(IN const
684 osm_madw_t *
685 const p_madw)
686 {
687 return ((osm_lft_context_t *) & p_madw->context);
688 }
689
690 /*
691 * PARAMETERS
692 * p_madw
693 * [in] Pointer to an osm_madw_t object.
694 *
695 * RETURN VALUES
696 * Pointer to the start of the context structure.
697 *
698 * NOTES
699 *
700 * SEE ALSO
701 *********/
702
703 /****f* OpenSM: MAD Wrapper/osm_madw_get_mft_context_ptr
704 * NAME
705 * osm_madw_get_mft_context_ptr
706 *
707 * DESCRIPTION
708 * Gets a pointer to the MFT context in this MAD.
709 *
710 * SYNOPSIS
711 */
osm_madw_get_mft_context_ptr(IN const osm_madw_t * const p_madw)712 static inline osm_mft_context_t *osm_madw_get_mft_context_ptr(IN const
713 osm_madw_t *
714 const p_madw)
715 {
716 return ((osm_mft_context_t *) & p_madw->context);
717 }
718
719 /*
720 * PARAMETERS
721 * p_madw
722 * [in] Pointer to an osm_madw_t object.
723 *
724 * RETURN VALUES
725 * Pointer to the start of the context structure.
726 *
727 * NOTES
728 *
729 * SEE ALSO
730 *********/
731
732 /****f* OpenSM: MAD Wrapper/osm_madw_get_si_context_ptr
733 * NAME
734 * osm_madw_get_si_context_ptr
735 *
736 * DESCRIPTION
737 * Gets a pointer to the SwitchInfo context in this MAD.
738 *
739 * SYNOPSIS
740 */
osm_madw_get_si_context_ptr(IN const osm_madw_t * const p_madw)741 static inline osm_si_context_t *osm_madw_get_si_context_ptr(IN const osm_madw_t
742 * const p_madw)
743 {
744 return ((osm_si_context_t *) & p_madw->context);
745 }
746
747 /*
748 * PARAMETERS
749 * p_madw
750 * [in] Pointer to an osm_madw_t object.
751 *
752 * RETURN VALUES
753 * Pointer to the start of the context structure.
754 *
755 * NOTES
756 *
757 * SEE ALSO
758 *********/
759
760 /****f* OpenSM: MAD Wrapper/osm_madw_get_smi_context_ptr
761 * NAME
762 * osm_madw_get_smi_context_ptr
763 *
764 * DESCRIPTION
765 * Gets a pointer to the SMInfo context in this MAD.
766 *
767 * SYNOPSIS
768 */
osm_madw_get_smi_context_ptr(IN const osm_madw_t * const p_madw)769 static inline osm_smi_context_t *osm_madw_get_smi_context_ptr(IN const
770 osm_madw_t *
771 const p_madw)
772 {
773 return ((osm_smi_context_t *) & p_madw->context);
774 }
775
776 /*
777 * PARAMETERS
778 * p_madw
779 * [in] Pointer to an osm_madw_t object.
780 *
781 * RETURN VALUES
782 * Pointer to the start of the context structure.
783 *
784 * NOTES
785 *
786 * SEE ALSO
787 *********/
788
789 /****f* OpenSM: MAD Wrapper/osm_madw_get_pkey_context_ptr
790 * NAME
791 * osm_madw_get_pkey_context_ptr
792 *
793 * DESCRIPTION
794 * Gets a pointer to the P_Key context in this MAD.
795 *
796 * SYNOPSIS
797 */
osm_madw_get_pkey_context_ptr(IN const osm_madw_t * const p_madw)798 static inline osm_pkey_context_t *osm_madw_get_pkey_context_ptr(IN const
799 osm_madw_t *
800 const p_madw)
801 {
802 return ((osm_pkey_context_t *) & p_madw->context);
803 }
804
805 /*
806 * PARAMETERS
807 * p_madw
808 * [in] Pointer to an osm_madw_t object.
809 *
810 * RETURN VALUES
811 * Pointer to the start of the context structure.
812 *
813 * NOTES
814 *
815 * SEE ALSO
816 *********/
817
818 /****f* OpenSM: MAD Wrapper/osm_madw_get_slvl_context_ptr
819 * NAME
820 * osm_madw_get_slvl_context_ptr
821 *
822 * DESCRIPTION
823 * Gets a pointer to the PortInfo context in this MAD.
824 *
825 * SYNOPSIS
826 */
osm_madw_get_slvl_context_ptr(IN const osm_madw_t * const p_madw)827 static inline osm_slvl_context_t *osm_madw_get_slvl_context_ptr(IN const
828 osm_madw_t *
829 const p_madw)
830 {
831 return ((osm_slvl_context_t *) & p_madw->context);
832 }
833
834 /*
835 * PARAMETERS
836 * p_madw
837 * [in] Pointer to an osm_madw_t object.
838 *
839 * RETURN VALUES
840 * Pointer to the start of the context structure.
841 *
842 * NOTES
843 *
844 * SEE ALSO
845 *********/
846
847 /****f* OpenSM: MAD Wrapper/osm_madw_get_vla_context_ptr
848 * NAME
849 * osm_madw_get_vla_context_ptr
850 *
851 * DESCRIPTION
852 * Gets a pointer to the Vl Arb context in this MAD.
853 *
854 * SYNOPSIS
855 */
osm_madw_get_vla_context_ptr(IN const osm_madw_t * const p_madw)856 static inline osm_vla_context_t *osm_madw_get_vla_context_ptr(IN const
857 osm_madw_t *
858 const p_madw)
859 {
860 return ((osm_vla_context_t *) & p_madw->context);
861 }
862
863 /*
864 * PARAMETERS
865 * p_madw
866 * [in] Pointer to an osm_madw_t object.
867 *
868 * RETURN VALUES
869 * Pointer to the start of the context structure.
870 *
871 * NOTES
872 *
873 * SEE ALSO
874 *********/
875
876 #ifndef OSM_VENDOR_INTF_OPENIB
877 /****f* OpenSM: MAD Wrapper/osm_madw_get_arbitrary_context_ptr
878 * NAME
879 * osm_madw_get_arbitrary_context_ptr
880 *
881 * DESCRIPTION
882 * Gets a pointer to the arbitrary context in this MAD.
883 *
884 * SYNOPSIS
885 */
osm_madw_get_arbitrary_context_ptr(IN const osm_madw_t * const p_madw)886 static inline osm_arbitrary_context_t *osm_madw_get_arbitrary_context_ptr(IN
887 const
888 osm_madw_t
889 *
890 const
891 p_madw)
892 {
893 return ((osm_arbitrary_context_t *) & p_madw->context);
894 }
895
896 /*
897 * PARAMETERS
898 * p_madw
899 * [in] Pointer to an osm_madw_t object.
900 *
901 * RETURN VALUES
902 * Pointer to the start of the context structure.
903 *
904 * NOTES
905 *
906 * SEE ALSO
907 *********/
908 #endif
909
910 /****f* OpenSM: MAD Wrapper/osm_madw_get_vend_ptr
911 * NAME
912 * osm_madw_get_vend_ptr
913 *
914 * DESCRIPTION
915 * Gets a pointer to the vendor specific MAD wrapper component.
916 *
917 * SYNOPSIS
918 */
osm_madw_get_vend_ptr(IN const osm_madw_t * const p_madw)919 static inline osm_vend_wrap_t *osm_madw_get_vend_ptr(IN const osm_madw_t *
920 const p_madw)
921 {
922 return ((osm_vend_wrap_t *) & p_madw->vend_wrap);
923 }
924
925 /*
926 * PARAMETERS
927 * p_madw
928 * [in] Pointer to an osm_madw_t object.
929 *
930 * RETURN VALUES
931 * Gets a pointer to the vendor specific MAD wrapper component.
932 *
933 * NOTES
934 *
935 * SEE ALSO
936 *********/
937
938 /****f* OpenSM: MAD Wrapper/osm_madw_get_vend_ptr
939 * NAME
940 * osm_madw_get_vend_ptr
941 *
942 * DESCRIPTION
943 * Returns the bind handle associated with this MAD.
944 *
945 * SYNOPSIS
946 */
947 static inline osm_bind_handle_t
osm_madw_get_bind_handle(IN const osm_madw_t * const p_madw)948 osm_madw_get_bind_handle(IN const osm_madw_t * const p_madw)
949 {
950 return ((osm_bind_handle_t) p_madw->h_bind);
951 }
952
953 /*
954 * PARAMETERS
955 * p_madw
956 * [in] Pointer to an osm_madw_t object.
957 *
958 * RETURN VALUES
959 * Returns the bind handle associated with this MAD.
960 *
961 * NOTES
962 *
963 * SEE ALSO
964 *********/
965
966 /****f* OpenSM: MAD Wrapper/osm_madw_get_mad_addr_ptr
967 * NAME
968 * osm_madw_get_mad_addr_ptr
969 *
970 * DESCRIPTION
971 * Returns the mad address structure associated with this MAD.
972 *
973 * SYNOPSIS
974 */
osm_madw_get_mad_addr_ptr(IN const osm_madw_t * const p_madw)975 static inline osm_mad_addr_t *osm_madw_get_mad_addr_ptr(IN const osm_madw_t *
976 const p_madw)
977 {
978 return ((osm_mad_addr_t *) & p_madw->mad_addr);
979 }
980
981 /*
982 * PARAMETERS
983 * p_madw
984 * [in] Pointer to an osm_madw_t object.
985 *
986 * RETURN VALUES
987 * Returns the mad address structure associated with this MAD.
988 *
989 * NOTES
990 *
991 * SEE ALSO
992 *********/
993
994 /****f* OpenSM: MAD Wrapper/osm_madw_get_mad_ptr
995 * NAME
996 * osm_madw_get_mad_ptr
997 *
998 * DESCRIPTION
999 * Returns the mad address structure associated with this MAD.
1000 *
1001 * SYNOPSIS
1002 */
osm_madw_get_mad_ptr(IN const osm_madw_t * const p_madw)1003 static inline ib_mad_t *osm_madw_get_mad_ptr(IN const osm_madw_t * const p_madw)
1004 {
1005 return ((ib_mad_t *) p_madw->p_mad);
1006 }
1007
1008 /*
1009 * PARAMETERS
1010 * p_madw
1011 * [in] Pointer to an osm_madw_t object.
1012 *
1013 * RETURN VALUES
1014 * Returns the mad address structure associated with this MAD.
1015 *
1016 * NOTES
1017 *
1018 * SEE ALSO
1019 *********/
1020
1021 /****f* OpenSM: MAD Wrapper/osm_madw_get_err_msg
1022 * NAME
1023 * osm_madw_get_err_msg
1024 *
1025 * DESCRIPTION
1026 * Returns the message with which to post this mad wrapper if
1027 * an error occurs during processing the mad.
1028 *
1029 * SYNOPSIS
1030 */
1031 static inline cl_disp_msgid_t
osm_madw_get_err_msg(IN const osm_madw_t * const p_madw)1032 osm_madw_get_err_msg(IN const osm_madw_t * const p_madw)
1033 {
1034 return ((cl_disp_msgid_t) p_madw->fail_msg);
1035 }
1036
1037 /*
1038 * PARAMETERS
1039 * p_madw
1040 * [in] Pointer to an osm_madw_t object.
1041 *
1042 * RETURN VALUES
1043 * Returns the message with which to post this mad wrapper if
1044 * an error occurs during processing the mad.
1045 *
1046 * NOTES
1047 *
1048 * SEE ALSO
1049 *********/
1050
1051 /****f* OpenSM: MAD Wrapper/osm_madw_set_mad
1052 * NAME
1053 * osm_madw_set_mad
1054 *
1055 * DESCRIPTION
1056 * Associates a wire MAD with this MAD Wrapper object.
1057 *
1058 * SYNOPSIS
1059 */
1060 static inline void
osm_madw_set_mad(IN osm_madw_t * const p_madw,IN const ib_mad_t * const p_mad)1061 osm_madw_set_mad(IN osm_madw_t * const p_madw, IN const ib_mad_t * const p_mad)
1062 {
1063 p_madw->p_mad = p_mad;
1064 }
1065
1066 /*
1067 * PARAMETERS
1068 * p_madw
1069 * [in] Pointer to an osm_madw_t object.
1070 *
1071 * p_mad
1072 * [in] Pointer to the wire MAD to attach to this wrapper.
1073 *
1074 * RETURN VALUES
1075 * None.
1076 *
1077 * NOTES
1078 *
1079 * SEE ALSO
1080 *********/
1081
1082 /****f* OpenSM: MAD Wrapper/osm_madw_copy_context
1083 * NAME
1084 * osm_madw_copy_context
1085 *
1086 * DESCRIPTION
1087 * Copies the controller context from one MAD Wrapper to another.
1088 *
1089 * SYNOPSIS
1090 */
1091 static inline void
osm_madw_copy_context(IN osm_madw_t * const p_dest,IN const osm_madw_t * const p_src)1092 osm_madw_copy_context(IN osm_madw_t * const p_dest,
1093 IN const osm_madw_t * const p_src)
1094 {
1095 p_dest->context = p_src->context;
1096 }
1097
1098 /*
1099 * PARAMETERS
1100 * p_dest
1101 * [in] Pointer to the destination osm_madw_t object.
1102 *
1103 * p_src
1104 * [in] Pointer to the source osm_madw_t object.
1105 *
1106 * RETURN VALUES
1107 * None.
1108 *
1109 * NOTES
1110 *
1111 * SEE ALSO
1112 *********/
1113
1114 END_C_DECLS
1115 #endif /* _OSM_MADW_H_ */
1116