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