1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 24*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*7c478bd9Sstevel@tonic-gate */ 26*7c478bd9Sstevel@tonic-gate 27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_IB_MGT_IBMF_IBMF_SAA_H 28*7c478bd9Sstevel@tonic-gate #define _SYS_IB_MGT_IBMF_IBMF_SAA_H 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 31*7c478bd9Sstevel@tonic-gate extern "C" { 32*7c478bd9Sstevel@tonic-gate #endif 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate #include <sys/ib/ib_types.h> 35*7c478bd9Sstevel@tonic-gate #include <sys/ib/mgt/sa_recs.h> 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate /* 38*7c478bd9Sstevel@tonic-gate * SA Access Interface: Interfaces to enable access to the SA 39*7c478bd9Sstevel@tonic-gate */ 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #define IBMF_SAA_PKEY_WC 0 /* partition key wildcard */ 42*7c478bd9Sstevel@tonic-gate #define IBMF_SAA_MTU_WC 0 /* mtu wilcard for gid_to_pathrecords */ 43*7c478bd9Sstevel@tonic-gate 44*7c478bd9Sstevel@tonic-gate typedef enum _ibmf_saa_access_type_t { 45*7c478bd9Sstevel@tonic-gate IBMF_SAA_RETRIEVE, 46*7c478bd9Sstevel@tonic-gate IBMF_SAA_UPDATE, 47*7c478bd9Sstevel@tonic-gate IBMF_SAA_DELETE 48*7c478bd9Sstevel@tonic-gate } ibmf_saa_access_type_t; 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* 51*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle 52*7c478bd9Sstevel@tonic-gate * Opaque handle to identify the consumer 53*7c478bd9Sstevel@tonic-gate */ 54*7c478bd9Sstevel@tonic-gate typedef struct ibmf_saa_handle *ibmf_saa_handle_t; 55*7c478bd9Sstevel@tonic-gate 56*7c478bd9Sstevel@tonic-gate /* 57*7c478bd9Sstevel@tonic-gate * ibmf_saa_cb_t 58*7c478bd9Sstevel@tonic-gate * ibmf_saa's callback to clients to inform them that the response to an 59*7c478bd9Sstevel@tonic-gate * asynchronous request has arrived or that the request timed out. 60*7c478bd9Sstevel@tonic-gate * 61*7c478bd9Sstevel@tonic-gate * Input Arguments 62*7c478bd9Sstevel@tonic-gate * clnt_private - opaque handle to client specific data (sq_callback_arg) 63*7c478bd9Sstevel@tonic-gate * length - size of response returned 64*7c478bd9Sstevel@tonic-gate * result - pointer to buffer of response. Data will be in host-endian format 65*7c478bd9Sstevel@tonic-gate * and unpacked. Client can just cast to a pointer to the structure 66*7c478bd9Sstevel@tonic-gate * status - ibmf status. Status can be any of the values returned by a 67*7c478bd9Sstevel@tonic-gate * synchronous ibmf_sa_access() call. 68*7c478bd9Sstevel@tonic-gate * 69*7c478bd9Sstevel@tonic-gate * Output Arguments 70*7c478bd9Sstevel@tonic-gate * none 71*7c478bd9Sstevel@tonic-gate * 72*7c478bd9Sstevel@tonic-gate * Returns 73*7c478bd9Sstevel@tonic-gate * none 74*7c478bd9Sstevel@tonic-gate */ 75*7c478bd9Sstevel@tonic-gate typedef void (*ibmf_saa_cb_t) ( 76*7c478bd9Sstevel@tonic-gate void *callback_arg, 77*7c478bd9Sstevel@tonic-gate size_t length, 78*7c478bd9Sstevel@tonic-gate char *result, 79*7c478bd9Sstevel@tonic-gate int status); 80*7c478bd9Sstevel@tonic-gate 81*7c478bd9Sstevel@tonic-gate /* 82*7c478bd9Sstevel@tonic-gate * structure to provide parameters to ibmf_sa_access call 83*7c478bd9Sstevel@tonic-gate */ 84*7c478bd9Sstevel@tonic-gate typedef struct ibmf_saa_access_args_s { 85*7c478bd9Sstevel@tonic-gate /* MAD attribute ID */ 86*7c478bd9Sstevel@tonic-gate uint16_t sq_attr_id; 87*7c478bd9Sstevel@tonic-gate 88*7c478bd9Sstevel@tonic-gate /* retrieve, update, or delete */ 89*7c478bd9Sstevel@tonic-gate ibmf_saa_access_type_t sq_access_type; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate /* SA MAD component mask indicating fields in template to query on */ 92*7c478bd9Sstevel@tonic-gate uint64_t sq_component_mask; 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate /* pointer to template */ 95*7c478bd9Sstevel@tonic-gate void *sq_template; 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate /* 98*7c478bd9Sstevel@tonic-gate * length, in bytes, of template size for attributes which ibmf does 99*7c478bd9Sstevel@tonic-gate * not know about; ignored for known attribute id's. length should be 100*7c478bd9Sstevel@tonic-gate * wire length and template for unknown attributes should be in wire 101*7c478bd9Sstevel@tonic-gate * format as ibmf will not be able to pack data. 102*7c478bd9Sstevel@tonic-gate */ 103*7c478bd9Sstevel@tonic-gate size_t sq_template_length; 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate /* callback and argument when asynchronous request returns */ 106*7c478bd9Sstevel@tonic-gate ibmf_saa_cb_t sq_callback; 107*7c478bd9Sstevel@tonic-gate void *sq_callback_arg; 108*7c478bd9Sstevel@tonic-gate } ibmf_saa_access_args_t; 109*7c478bd9Sstevel@tonic-gate 110*7c478bd9Sstevel@tonic-gate /* 111*7c478bd9Sstevel@tonic-gate * enumeration of subnet events 112*7c478bd9Sstevel@tonic-gate * 113*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_GID_AVAILABLE 114*7c478bd9Sstevel@tonic-gate * the identified gid is available 115*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_GID_UNAVAILABLE 116*7c478bd9Sstevel@tonic-gate * the identified gid is unavailable 117*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_MCG_CREATED 118*7c478bd9Sstevel@tonic-gate * MC group identified by mgid is created 119*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_MCG_DELETED 120*7c478bd9Sstevel@tonic-gate * MC group identified by mgid is deleted 121*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_CAP_MASK_CHG 122*7c478bd9Sstevel@tonic-gate * Portinfo.CapabilityMask changed 123*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_SYS_IMG_GUID_CHG 124*7c478bd9Sstevel@tonic-gate * System Image GUID changed 125*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_SUBSCRIBER_STATUS_CHG 126*7c478bd9Sstevel@tonic-gate * Status of ibmf subscriptions changed 127*7c478bd9Sstevel@tonic-gate */ 128*7c478bd9Sstevel@tonic-gate typedef enum ibmf_saa_subnet_event_e { 129*7c478bd9Sstevel@tonic-gate 130*7c478bd9Sstevel@tonic-gate IBMF_SAA_EVENT_GID_AVAILABLE, 131*7c478bd9Sstevel@tonic-gate IBMF_SAA_EVENT_GID_UNAVAILABLE, 132*7c478bd9Sstevel@tonic-gate IBMF_SAA_EVENT_MCG_CREATED, 133*7c478bd9Sstevel@tonic-gate IBMF_SAA_EVENT_MCG_DELETED, 134*7c478bd9Sstevel@tonic-gate IBMF_SAA_EVENT_CAP_MASK_CHG, 135*7c478bd9Sstevel@tonic-gate IBMF_SAA_EVENT_SYS_IMG_GUID_CHG, 136*7c478bd9Sstevel@tonic-gate IBMF_SAA_EVENT_SUBSCRIBER_STATUS_CHG 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate } ibmf_saa_subnet_event_t; 139*7c478bd9Sstevel@tonic-gate 140*7c478bd9Sstevel@tonic-gate /* 141*7c478bd9Sstevel@tonic-gate * ibmf must subscribe with the Subnet Administrator to provide the subnet 142*7c478bd9Sstevel@tonic-gate * events for its clients. It registers for the four trap producer types: CA, 143*7c478bd9Sstevel@tonic-gate * switch, router, and subnet management. If any of these registrations fails 144*7c478bd9Sstevel@tonic-gate * the ibmf will notify each client that registered for events. Clients are 145*7c478bd9Sstevel@tonic-gate * notified by ibmf through their registered callback and the 146*7c478bd9Sstevel@tonic-gate * SUBSCRIBER_STATUS_CHG event. 147*7c478bd9Sstevel@tonic-gate * 148*7c478bd9Sstevel@tonic-gate * For this event, the event_details producer_type_status_mask will be set. 149*7c478bd9Sstevel@tonic-gate * Each bit in the mask corresponds to a different producer type. When the bit 150*7c478bd9Sstevel@tonic-gate * is on the ibmf was able to successfully subscribe for events from that 151*7c478bd9Sstevel@tonic-gate * producer. When the bit is off, ibmf was unable to subscribe and clients may 152*7c478bd9Sstevel@tonic-gate * not receive events from that producer type. 153*7c478bd9Sstevel@tonic-gate * 154*7c478bd9Sstevel@tonic-gate * For example, if the status_mask is 0xb then events will be received that 155*7c478bd9Sstevel@tonic-gate * correspond to CA's, switches, and subnet management traps. However, traps 156*7c478bd9Sstevel@tonic-gate * generated by routers may not be received. 157*7c478bd9Sstevel@tonic-gate * 158*7c478bd9Sstevel@tonic-gate * The ibmf re-registers for events when the port transitions to active. If the 159*7c478bd9Sstevel@tonic-gate * event status mask changes the ibmf will generate another 160*7c478bd9Sstevel@tonic-gate * SUBSCRIBER_STATUS_CHG event with the new producer type status mask. When 161*7c478bd9Sstevel@tonic-gate * clients register they should only expect to receive a SUBSCRIBER_STATUS_CHG 162*7c478bd9Sstevel@tonic-gate * event if one of the registrations failed. If all four registrations 163*7c478bd9Sstevel@tonic-gate * succeeded no event will be generated. 164*7c478bd9Sstevel@tonic-gate * 165*7c478bd9Sstevel@tonic-gate * If the port goes down, a SUBSCRIBER_STATUS_CHG event is not generated. 166*7c478bd9Sstevel@tonic-gate * Clients should realize that events will not be forwarded. If the port 167*7c478bd9Sstevel@tonic-gate * transitions back to active ibmf_saa will resubscribe on behalf of the client. 168*7c478bd9Sstevel@tonic-gate * If this subscription fails a SUBSCRIBER_STATUS_CHG event will be generated. 169*7c478bd9Sstevel@tonic-gate * 170*7c478bd9Sstevel@tonic-gate */ 171*7c478bd9Sstevel@tonic-gate 172*7c478bd9Sstevel@tonic-gate #define IBMF_SAA_EVENT_STATUS_MASK_PRODUCER_CA (1 << 0) 173*7c478bd9Sstevel@tonic-gate #define IBMF_SAA_EVENT_STATUS_MASK_PRODUCER_SWITCH (1 << 1) 174*7c478bd9Sstevel@tonic-gate #define IBMF_SAA_EVENT_STATUS_MASK_PRODUCER_ROUTER (1 << 2) 175*7c478bd9Sstevel@tonic-gate #define IBMF_SAA_EVENT_STATUS_MASK_PRODUCER_SM (1 << 3) 176*7c478bd9Sstevel@tonic-gate 177*7c478bd9Sstevel@tonic-gate /* 178*7c478bd9Sstevel@tonic-gate * structure passed as event_details argument of ibmf_saa subnet event 179*7c478bd9Sstevel@tonic-gate * callback. 180*7c478bd9Sstevel@tonic-gate * 181*7c478bd9Sstevel@tonic-gate * Only some of the structure members are valid for a given event as given 182*7c478bd9Sstevel@tonic-gate * below: 183*7c478bd9Sstevel@tonic-gate * 184*7c478bd9Sstevel@tonic-gate * member event type 185*7c478bd9Sstevel@tonic-gate * ------ ---------- 186*7c478bd9Sstevel@tonic-gate * ie_gid IBMF_SAA_EVENT_GID_AVAILABLE, 187*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_GID_UNAVAILABLE, 188*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_MCG_CREATED, and 189*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_MCG_DELETED 190*7c478bd9Sstevel@tonic-gate * ie_lid IBMF_SAA_EVENT_CAP_MASK_CHG and 191*7c478bd9Sstevel@tonic-gate * IBMF_SAA_EVENT_SYS_IMG_GUID_CHG 192*7c478bd9Sstevel@tonic-gate * ie_capability_mask IBMF_SAA_EVENT_CAP_MASK_CHG 193*7c478bd9Sstevel@tonic-gate * ie_sysimg_guid IBMF_SAA_EVENT_SYS_IMG_GUID_CHG 194*7c478bd9Sstevel@tonic-gate * ie_producer_type_status_mask IBMF_SAA_EVENT_SUBSCRIBER_STATUS_CHG 195*7c478bd9Sstevel@tonic-gate * 196*7c478bd9Sstevel@tonic-gate */ 197*7c478bd9Sstevel@tonic-gate typedef struct ibmf_saa_event_details_s { 198*7c478bd9Sstevel@tonic-gate ib_gid_t ie_gid; 199*7c478bd9Sstevel@tonic-gate ib_guid_t ie_sysimg_guid; 200*7c478bd9Sstevel@tonic-gate uint32_t ie_capability_mask; /* values defined in sm_attr.h */ 201*7c478bd9Sstevel@tonic-gate ib_lid_t ie_lid; 202*7c478bd9Sstevel@tonic-gate uint8_t ie_producer_event_status_mask; 203*7c478bd9Sstevel@tonic-gate } ibmf_saa_event_details_t; 204*7c478bd9Sstevel@tonic-gate 205*7c478bd9Sstevel@tonic-gate /* 206*7c478bd9Sstevel@tonic-gate * Callback invoked when one of the events the client subscribed for 207*7c478bd9Sstevel@tonic-gate * at ibmf_sa_session_open() time happens. 208*7c478bd9Sstevel@tonic-gate * 209*7c478bd9Sstevel@tonic-gate * This callback can occur before ibmf_sa_session_open() returns. 210*7c478bd9Sstevel@tonic-gate * 211*7c478bd9Sstevel@tonic-gate * Each callback is on a separate thread. ibmf clients may block in the event 212*7c478bd9Sstevel@tonic-gate * callback. However, under heavy system load ibmf may not be able to generate 213*7c478bd9Sstevel@tonic-gate * event callbacks. Also, event callbacks, including SUBSCRIBER_STATUS_CHG, 214*7c478bd9Sstevel@tonic-gate * could be dispatched out-of-order. 215*7c478bd9Sstevel@tonic-gate * 216*7c478bd9Sstevel@tonic-gate * Arguments: 217*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - Client's ibmf_saa_handle 218*7c478bd9Sstevel@tonic-gate * ibmf_saa_event - event that caused the callback 219*7c478bd9Sstevel@tonic-gate * event_details - additional data for the event 220*7c478bd9Sstevel@tonic-gate * callback_arg - event_callback_arg member of 221*7c478bd9Sstevel@tonic-gate * ibmf_saa_subnet_event_args_t 222*7c478bd9Sstevel@tonic-gate */ 223*7c478bd9Sstevel@tonic-gate typedef void (*ibmf_saa_subnet_event_cb_t)( 224*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t ibmf_saa_handle, 225*7c478bd9Sstevel@tonic-gate ibmf_saa_subnet_event_t ibmf_saa_event, 226*7c478bd9Sstevel@tonic-gate ibmf_saa_event_details_t *event_details, 227*7c478bd9Sstevel@tonic-gate void *callback_arg); 228*7c478bd9Sstevel@tonic-gate 229*7c478bd9Sstevel@tonic-gate typedef struct ibmf_saa_subnet_event_args_s { 230*7c478bd9Sstevel@tonic-gate 231*7c478bd9Sstevel@tonic-gate /* func to be called when a subnet event happens */ 232*7c478bd9Sstevel@tonic-gate ibmf_saa_subnet_event_cb_t is_event_callback; 233*7c478bd9Sstevel@tonic-gate 234*7c478bd9Sstevel@tonic-gate /* call back arg */ 235*7c478bd9Sstevel@tonic-gate void *is_event_callback_arg; 236*7c478bd9Sstevel@tonic-gate 237*7c478bd9Sstevel@tonic-gate } ibmf_saa_subnet_event_args_t; 238*7c478bd9Sstevel@tonic-gate 239*7c478bd9Sstevel@tonic-gate /* 240*7c478bd9Sstevel@tonic-gate * ibmf_sa_session_open(): 241*7c478bd9Sstevel@tonic-gate * 242*7c478bd9Sstevel@tonic-gate * Before using the ibmf_saa interface, consumers should register with the 243*7c478bd9Sstevel@tonic-gate * ibmf_saa interface by calling ibmf_sa_session_open(). Upon a successful 244*7c478bd9Sstevel@tonic-gate * registration, a handle is returned for use in subsequent interaction with the 245*7c478bd9Sstevel@tonic-gate * ibmf_saa interface; this handle is also provided as an argument to subnet 246*7c478bd9Sstevel@tonic-gate * event notification function. 247*7c478bd9Sstevel@tonic-gate * 248*7c478bd9Sstevel@tonic-gate * Consumers can register to be notified of subnet events such as GID 249*7c478bd9Sstevel@tonic-gate * being available/unavailable. Clients which provide a non-NULL event args 250*7c478bd9Sstevel@tonic-gate * structure will have the is_event_callback function called when an event is 251*7c478bd9Sstevel@tonic-gate * received or there is a failure in subscribing for events. This callback may 252*7c478bd9Sstevel@tonic-gate * be generated before the ibmf_sa_session_open() call returns. 253*7c478bd9Sstevel@tonic-gate * 254*7c478bd9Sstevel@tonic-gate * This interface blocks allocating memory, but not waiting for any packet 255*7c478bd9Sstevel@tonic-gate * responses. 256*7c478bd9Sstevel@tonic-gate * 257*7c478bd9Sstevel@tonic-gate * Arguments: 258*7c478bd9Sstevel@tonic-gate * port_guid - GUID of the port. 259*7c478bd9Sstevel@tonic-gate * event_args - subnet event registration details 260*7c478bd9Sstevel@tonic-gate * sm_key - only filled in if the consumer is an SM 261*7c478bd9Sstevel@tonic-gate * ibmf_version - version of the interface (IBMF_VERSION) 262*7c478bd9Sstevel@tonic-gate * flags - unused 263*7c478bd9Sstevel@tonic-gate * 264*7c478bd9Sstevel@tonic-gate * Return values: 265*7c478bd9Sstevel@tonic-gate * IBMF_SUCCESS - registration succeeded 266*7c478bd9Sstevel@tonic-gate * IBMF_BAD_PORT - registration failed; active port not found 267*7c478bd9Sstevel@tonic-gate * IBMF_BAD_PORT_STATE - registration failed; port found but not active or 268*7c478bd9Sstevel@tonic-gate * previous registration failed 269*7c478bd9Sstevel@tonic-gate * IBMF_NO_MEMORY - registration failed; could not allocate memory 270*7c478bd9Sstevel@tonic-gate * IBMF_NO_RESOURCES - registration failed due to a resource issue 271*7c478bd9Sstevel@tonic-gate * IBMF_BUSY - registration failed; too many clients registered 272*7c478bd9Sstevel@tonic-gate * for this port 273*7c478bd9Sstevel@tonic-gate * IBMF_TRANSPORT_FAILURE - failure with underlying transport framework 274*7c478bd9Sstevel@tonic-gate * IBMF_INVALID_ARG - ibmf_saa_handle arg was NULL 275*7c478bd9Sstevel@tonic-gate */ 276*7c478bd9Sstevel@tonic-gate int ibmf_sa_session_open( 277*7c478bd9Sstevel@tonic-gate ib_guid_t port_guid, 278*7c478bd9Sstevel@tonic-gate ib_smkey_t sm_key, 279*7c478bd9Sstevel@tonic-gate ibmf_saa_subnet_event_args_t *event_args, 280*7c478bd9Sstevel@tonic-gate uint_t ibmf_version, 281*7c478bd9Sstevel@tonic-gate uint_t flags, 282*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t *ibmf_saa_handle); 283*7c478bd9Sstevel@tonic-gate 284*7c478bd9Sstevel@tonic-gate /* 285*7c478bd9Sstevel@tonic-gate * ibmf_sa_session_close() 286*7c478bd9Sstevel@tonic-gate * 287*7c478bd9Sstevel@tonic-gate * Unregister a consumer of the SA_Access interface 288*7c478bd9Sstevel@tonic-gate * 289*7c478bd9Sstevel@tonic-gate * This interface blocks. 290*7c478bd9Sstevel@tonic-gate * 291*7c478bd9Sstevel@tonic-gate * Arguments: 292*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - handle returned from sa_session_open() 293*7c478bd9Sstevel@tonic-gate * flags - unused 294*7c478bd9Sstevel@tonic-gate * 295*7c478bd9Sstevel@tonic-gate * Return values: 296*7c478bd9Sstevel@tonic-gate * IBMF_SUCCESS - unregistration succeeded 297*7c478bd9Sstevel@tonic-gate * IBMF_BAD_HANDLE - unregistration failed; handle is not valid or 298*7c478bd9Sstevel@tonic-gate * session_close has already been called 299*7c478bd9Sstevel@tonic-gate * IBMF_INVALID_ARG - ibmf_saa_handle arg was NULL 300*7c478bd9Sstevel@tonic-gate * 301*7c478bd9Sstevel@tonic-gate * All outstanding callbacks will be canceled before this function returns. 302*7c478bd9Sstevel@tonic-gate */ 303*7c478bd9Sstevel@tonic-gate int ibmf_sa_session_close( 304*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t *ibmf_saa_handle, 305*7c478bd9Sstevel@tonic-gate uint_t flags); 306*7c478bd9Sstevel@tonic-gate 307*7c478bd9Sstevel@tonic-gate /* 308*7c478bd9Sstevel@tonic-gate * ibmf_sa_access 309*7c478bd9Sstevel@tonic-gate * 310*7c478bd9Sstevel@tonic-gate * Retrieve records from the SA given an AttributeID, ComponentMask, 311*7c478bd9Sstevel@tonic-gate * and a template 312*7c478bd9Sstevel@tonic-gate * 313*7c478bd9Sstevel@tonic-gate * This interface blocks if the callback parameter is NULL. 314*7c478bd9Sstevel@tonic-gate * 315*7c478bd9Sstevel@tonic-gate * Input Arguments: 316*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - handle returned from ibmf_sa_session_open() 317*7c478bd9Sstevel@tonic-gate * access_args - structure containing various parameters for the query 318*7c478bd9Sstevel@tonic-gate * flags - unsused 319*7c478bd9Sstevel@tonic-gate * 320*7c478bd9Sstevel@tonic-gate * Output Arguments: 321*7c478bd9Sstevel@tonic-gate * length - size of buffer returned 322*7c478bd9Sstevel@tonic-gate * result - pointer to buffer of records returned in response. 323*7c478bd9Sstevel@tonic-gate * Buffer is host-endian, unpacked can be cast to one of 324*7c478bd9Sstevel@tonic-gate * the record types in sa_recs.h 325*7c478bd9Sstevel@tonic-gate * 326*7c478bd9Sstevel@tonic-gate * Return values: 327*7c478bd9Sstevel@tonic-gate * IBMF_SUCCESS - query succeeded 328*7c478bd9Sstevel@tonic-gate * IBMF_BAD_HANDLE - sa session handle is invalid 329*7c478bd9Sstevel@tonic-gate * IBMF_BAD_PORT_STATE - port in incorrect state 330*7c478bd9Sstevel@tonic-gate * IBMF_INVALID_ARG - one of the pointer parameters was NULL 331*7c478bd9Sstevel@tonic-gate * IBMF_NO_RESOURCES - ibmf could not allocate ib resources or SA returned 332*7c478bd9Sstevel@tonic-gate * ERR_NO_RESOURCES 333*7c478bd9Sstevel@tonic-gate * IBMF_TRANS_TIMEOUT - transaction timed out 334*7c478bd9Sstevel@tonic-gate * IBMF_TRANS_FAILURE - transaction failure 335*7c478bd9Sstevel@tonic-gate * IBMF_NO_MEMORY - ibmf could not allocate memory 336*7c478bd9Sstevel@tonic-gate * IBMF_REQ_INVALID - send and recv buffer the same for a sequenced 337*7c478bd9Sstevel@tonic-gate * transaction or the SA returned an ERR_REQ_INVALID 338*7c478bd9Sstevel@tonic-gate * IBMF_NO_RECORDS - no records matched query 339*7c478bd9Sstevel@tonic-gate * IBMF_TOO_MANY_RECORDS- SA returned SA_ERR_TOO_MANY_RECORDS 340*7c478bd9Sstevel@tonic-gate * IBMF_INVALID_GID - SA returned SA_INVALID_GID 341*7c478bd9Sstevel@tonic-gate * IBMF_INSUFF_COMPS - SA returned SA_ERR_INSUFFICIENT_COMPS 342*7c478bd9Sstevel@tonic-gate * IBMF_UNSUPP_METHOD - SA returned MAD_STATUS_UNSUPP_METHOD 343*7c478bd9Sstevel@tonic-gate * IBMF_UNSUPP_METHOD_ATTR - SA returned MAD_STATUS_UNSUPP_METHOD_ATTR 344*7c478bd9Sstevel@tonic-gate * IBMF_INVALID_FIELD - SA returned MAD_STATUS_INVALID_FIELD 345*7c478bd9Sstevel@tonic-gate * IBMF_NO_ACTIVE_PORTS - no active ports found 346*7c478bd9Sstevel@tonic-gate * 347*7c478bd9Sstevel@tonic-gate * Upon successful completion, result points to a buffer containing the records. 348*7c478bd9Sstevel@tonic-gate * length is the size in bytes of the buffer returned in result. If there are 349*7c478bd9Sstevel@tonic-gate * no records or the call failed the length is 0. 350*7c478bd9Sstevel@tonic-gate * 351*7c478bd9Sstevel@tonic-gate * The consumer is responsible for freeing the memory associated with result. 352*7c478bd9Sstevel@tonic-gate */ 353*7c478bd9Sstevel@tonic-gate int ibmf_sa_access( 354*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t ibmf_saa_handle, 355*7c478bd9Sstevel@tonic-gate ibmf_saa_access_args_t *access_args, 356*7c478bd9Sstevel@tonic-gate uint_t flags, 357*7c478bd9Sstevel@tonic-gate size_t *length, 358*7c478bd9Sstevel@tonic-gate void **result); 359*7c478bd9Sstevel@tonic-gate 360*7c478bd9Sstevel@tonic-gate /* 361*7c478bd9Sstevel@tonic-gate * Helper Functions. 362*7c478bd9Sstevel@tonic-gate * Ease of use functions so that the consumer doesn't 363*7c478bd9Sstevel@tonic-gate * have to do the overhead of calling ibmf_sa_access() for 364*7c478bd9Sstevel@tonic-gate * commonly used queries 365*7c478bd9Sstevel@tonic-gate */ 366*7c478bd9Sstevel@tonic-gate 367*7c478bd9Sstevel@tonic-gate /* 368*7c478bd9Sstevel@tonic-gate * ibmf_saa_gid_to_pathrecords 369*7c478bd9Sstevel@tonic-gate * Given a source gid and a destination gid, return paths 370*7c478bd9Sstevel@tonic-gate * between the gids. 371*7c478bd9Sstevel@tonic-gate * 372*7c478bd9Sstevel@tonic-gate * This interface blocks. 373*7c478bd9Sstevel@tonic-gate * 374*7c478bd9Sstevel@tonic-gate * Input Arguments: 375*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - handle returned from ibmf_sa_session_open() 376*7c478bd9Sstevel@tonic-gate * sgid - source gid of path 377*7c478bd9Sstevel@tonic-gate * dgid - destination gid of path 378*7c478bd9Sstevel@tonic-gate * p_key - partition of path. This value may be wildcarded with 379*7c478bd9Sstevel@tonic-gate * IBMF_SAA_PKEY_WC. 380*7c478bd9Sstevel@tonic-gate * mtu - preferred MTU of the path. This argument may be 381*7c478bd9Sstevel@tonic-gate * wildcarded with IBMF_SAA_MTU_WC. 382*7c478bd9Sstevel@tonic-gate * reversible - if B_TRUE, ibmf will query only reversible paths 383*7c478bd9Sstevel@tonic-gate * see Infiniband Specification table 171 384*7c478bd9Sstevel@tonic-gate * num_paths - maximum number of paths to return 385*7c478bd9Sstevel@tonic-gate * numpaths should be checked for the actual number of 386*7c478bd9Sstevel@tonic-gate * records returned. 387*7c478bd9Sstevel@tonic-gate * flags - unused 388*7c478bd9Sstevel@tonic-gate * 389*7c478bd9Sstevel@tonic-gate * Output Arguments: 390*7c478bd9Sstevel@tonic-gate * num_paths - actual number of paths returned 391*7c478bd9Sstevel@tonic-gate * length - size of buffer returned 392*7c478bd9Sstevel@tonic-gate * result - pointer to buffer of path records returned in response 393*7c478bd9Sstevel@tonic-gate * 394*7c478bd9Sstevel@tonic-gate * Return values: 395*7c478bd9Sstevel@tonic-gate * Error codes are the same as ibmf_sa_access() return values 396*7c478bd9Sstevel@tonic-gate * 397*7c478bd9Sstevel@tonic-gate * Upon successful completion, result points to a buffer containing the records. 398*7c478bd9Sstevel@tonic-gate * length is the size in bytes of the buffer returned in result. If there are 399*7c478bd9Sstevel@tonic-gate * no records or the call failed the length is 0. 400*7c478bd9Sstevel@tonic-gate * 401*7c478bd9Sstevel@tonic-gate * The consumer is responsible for freeing the memory associated with result. 402*7c478bd9Sstevel@tonic-gate */ 403*7c478bd9Sstevel@tonic-gate int ibmf_saa_gid_to_pathrecords( 404*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t ibmf_saa_handle, 405*7c478bd9Sstevel@tonic-gate ib_gid_t sgid, 406*7c478bd9Sstevel@tonic-gate ib_gid_t dgid, 407*7c478bd9Sstevel@tonic-gate ib_pkey_t p_key, 408*7c478bd9Sstevel@tonic-gate ib_mtu_t mtu, 409*7c478bd9Sstevel@tonic-gate boolean_t reversible, 410*7c478bd9Sstevel@tonic-gate uint8_t *num_paths, 411*7c478bd9Sstevel@tonic-gate uint_t flags, 412*7c478bd9Sstevel@tonic-gate size_t *length, 413*7c478bd9Sstevel@tonic-gate sa_path_record_t **result); 414*7c478bd9Sstevel@tonic-gate /* 415*7c478bd9Sstevel@tonic-gate * ibmf_saa_paths_from_gid 416*7c478bd9Sstevel@tonic-gate * Given a source GID, return a path from the source gid 417*7c478bd9Sstevel@tonic-gate * to every other port on the subnet. It is assumed that the 418*7c478bd9Sstevel@tonic-gate * subnet is fully connected. Only one path per port on the subnet 419*7c478bd9Sstevel@tonic-gate * is returned. 420*7c478bd9Sstevel@tonic-gate * 421*7c478bd9Sstevel@tonic-gate * This interface blocks. 422*7c478bd9Sstevel@tonic-gate * 423*7c478bd9Sstevel@tonic-gate * Arguments: 424*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - handle returned from ibmf_sa_session_open() 425*7c478bd9Sstevel@tonic-gate * sgid - source gid of path 426*7c478bd9Sstevel@tonic-gate * pkey - paritition of path. This value may be wildcarded with 427*7c478bd9Sstevel@tonic-gate * IBMF_SAA_PKEY_WC. 428*7c478bd9Sstevel@tonic-gate * reversible - if B_TRUE, ibmf will query only reversible paths; 429*7c478bd9Sstevel@tonic-gate * see Infiniband Specification table 171 430*7c478bd9Sstevel@tonic-gate * flags - unused 431*7c478bd9Sstevel@tonic-gate * 432*7c478bd9Sstevel@tonic-gate * Output Arguments: 433*7c478bd9Sstevel@tonic-gate * num_paths - number of paths returned 434*7c478bd9Sstevel@tonic-gate * length - size of buffer returned 435*7c478bd9Sstevel@tonic-gate * result - pointer to buffer of path records returned in response 436*7c478bd9Sstevel@tonic-gate * 437*7c478bd9Sstevel@tonic-gate * Return values: 438*7c478bd9Sstevel@tonic-gate * Error codes are the same as ibmf_sa_access() return values 439*7c478bd9Sstevel@tonic-gate * 440*7c478bd9Sstevel@tonic-gate * Upon successful completion, result points to a buffer containing the records. 441*7c478bd9Sstevel@tonic-gate * and num_paths is the number of path records returned. length is the size 442*7c478bd9Sstevel@tonic-gate * in bytes of the buffer returned in result. If there are no records or the 443*7c478bd9Sstevel@tonic-gate * call failed the length is 0. 444*7c478bd9Sstevel@tonic-gate * 445*7c478bd9Sstevel@tonic-gate * The consumer is responsible for freeing the memory associated with result. 446*7c478bd9Sstevel@tonic-gate */ 447*7c478bd9Sstevel@tonic-gate int ibmf_saa_paths_from_gid( 448*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t ibmf_saa_handle, 449*7c478bd9Sstevel@tonic-gate ib_gid_t sgid, 450*7c478bd9Sstevel@tonic-gate ib_pkey_t pkey, 451*7c478bd9Sstevel@tonic-gate boolean_t reversible, 452*7c478bd9Sstevel@tonic-gate uint_t flags, 453*7c478bd9Sstevel@tonic-gate uint_t *num_paths, 454*7c478bd9Sstevel@tonic-gate size_t *length, 455*7c478bd9Sstevel@tonic-gate sa_path_record_t **result); 456*7c478bd9Sstevel@tonic-gate 457*7c478bd9Sstevel@tonic-gate /* 458*7c478bd9Sstevel@tonic-gate * ibmf_saa_name_to_service_record: 459*7c478bd9Sstevel@tonic-gate * Given a service name, return the service records associated 460*7c478bd9Sstevel@tonic-gate * with it. 461*7c478bd9Sstevel@tonic-gate * 462*7c478bd9Sstevel@tonic-gate * This interface blocks. 463*7c478bd9Sstevel@tonic-gate * 464*7c478bd9Sstevel@tonic-gate * Input Arguments: 465*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - handle returned from ibmf_sa_session_open() 466*7c478bd9Sstevel@tonic-gate * name - service name, a null terminated string 467*7c478bd9Sstevel@tonic-gate * p_key - partition that the service is requested on. This 468*7c478bd9Sstevel@tonic-gate * value may be wildcarded with IBMF_SAA_PKEY_WC. 469*7c478bd9Sstevel@tonic-gate * flags - unused 470*7c478bd9Sstevel@tonic-gate * 471*7c478bd9Sstevel@tonic-gate * Output Arguments: 472*7c478bd9Sstevel@tonic-gate * num_records - number of service records returned 473*7c478bd9Sstevel@tonic-gate * length - size of buffer returned 474*7c478bd9Sstevel@tonic-gate * result - pointer to buffer of service records returned in 475*7c478bd9Sstevel@tonic-gate * response 476*7c478bd9Sstevel@tonic-gate * 477*7c478bd9Sstevel@tonic-gate * Return values: 478*7c478bd9Sstevel@tonic-gate * Error codes are the same as ibmf_sa_access() return values 479*7c478bd9Sstevel@tonic-gate * 480*7c478bd9Sstevel@tonic-gate * Upon successful completion, result points to a buffer containing the records. 481*7c478bd9Sstevel@tonic-gate * and num_records is the number of service records returned. length is the 482*7c478bd9Sstevel@tonic-gate * size in bytes of the buffer returned in result. If there are no records or 483*7c478bd9Sstevel@tonic-gate * the call failed the length is 0. 484*7c478bd9Sstevel@tonic-gate * 485*7c478bd9Sstevel@tonic-gate * The consumer is responsible for freeing the memory associated with result. 486*7c478bd9Sstevel@tonic-gate */ 487*7c478bd9Sstevel@tonic-gate int ibmf_saa_name_to_service_record( 488*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t ibmf_saa_handle, 489*7c478bd9Sstevel@tonic-gate char *service_name, 490*7c478bd9Sstevel@tonic-gate ib_pkey_t p_key, 491*7c478bd9Sstevel@tonic-gate uint_t flags, 492*7c478bd9Sstevel@tonic-gate uint_t *num_records, 493*7c478bd9Sstevel@tonic-gate size_t *length, 494*7c478bd9Sstevel@tonic-gate sa_service_record_t **result); 495*7c478bd9Sstevel@tonic-gate 496*7c478bd9Sstevel@tonic-gate /* 497*7c478bd9Sstevel@tonic-gate * ibmf_saa_id_to_service_record: 498*7c478bd9Sstevel@tonic-gate * Given a service id, return the service records associated 499*7c478bd9Sstevel@tonic-gate * with it. 500*7c478bd9Sstevel@tonic-gate * 501*7c478bd9Sstevel@tonic-gate * This interface blocks. 502*7c478bd9Sstevel@tonic-gate * 503*7c478bd9Sstevel@tonic-gate * Input Arguments: 504*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - handle returned from ibmf_sa_session_open() 505*7c478bd9Sstevel@tonic-gate * id - service id 506*7c478bd9Sstevel@tonic-gate * p_key - partition that the service is requested on. This 507*7c478bd9Sstevel@tonic-gate * value may be wildcarded with IBMF_SAA_PKEY_WC. 508*7c478bd9Sstevel@tonic-gate * flags - unused 509*7c478bd9Sstevel@tonic-gate * 510*7c478bd9Sstevel@tonic-gate * Output Arguments: 511*7c478bd9Sstevel@tonic-gate * num_records - number of service records returned 512*7c478bd9Sstevel@tonic-gate * length - size of buffer returned 513*7c478bd9Sstevel@tonic-gate * result - pointer to buffer of service records returned in 514*7c478bd9Sstevel@tonic-gate * response 515*7c478bd9Sstevel@tonic-gate * 516*7c478bd9Sstevel@tonic-gate * Return values: 517*7c478bd9Sstevel@tonic-gate * Error codes are the same as ibmf_sa_access() return values 518*7c478bd9Sstevel@tonic-gate * 519*7c478bd9Sstevel@tonic-gate * Upon successful completion, result points to a buffer containing the records. 520*7c478bd9Sstevel@tonic-gate * and num_records is the number of service records returned. length is the 521*7c478bd9Sstevel@tonic-gate * size in bytes of the buffer returned in result. If there are no records or 522*7c478bd9Sstevel@tonic-gate * the call failed the length is 0. 523*7c478bd9Sstevel@tonic-gate * 524*7c478bd9Sstevel@tonic-gate * The consumer is responsible for freeing the memory associated with result. 525*7c478bd9Sstevel@tonic-gate */ 526*7c478bd9Sstevel@tonic-gate int ibmf_saa_id_to_service_record( 527*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t ibmf_saa_handle, 528*7c478bd9Sstevel@tonic-gate ib_svc_id_t service_id, 529*7c478bd9Sstevel@tonic-gate ib_pkey_t p_key, 530*7c478bd9Sstevel@tonic-gate uint_t flags, 531*7c478bd9Sstevel@tonic-gate uint_t *num_records, 532*7c478bd9Sstevel@tonic-gate size_t *length, 533*7c478bd9Sstevel@tonic-gate sa_service_record_t **result); 534*7c478bd9Sstevel@tonic-gate 535*7c478bd9Sstevel@tonic-gate /* 536*7c478bd9Sstevel@tonic-gate * ibmf_saa_update_service_record 537*7c478bd9Sstevel@tonic-gate * Given a pointer to a service record, either insert or delete it 538*7c478bd9Sstevel@tonic-gate * 539*7c478bd9Sstevel@tonic-gate * This interface blocks. 540*7c478bd9Sstevel@tonic-gate * 541*7c478bd9Sstevel@tonic-gate * Input Arguments: 542*7c478bd9Sstevel@tonic-gate * ibmf_saa_handle - handle returned from ibmf_sa_session_open() 543*7c478bd9Sstevel@tonic-gate * service_record - service record is to be inserted or deleted. To 544*7c478bd9Sstevel@tonic-gate * delete a service record the GID, ID, P_Key, and 545*7c478bd9Sstevel@tonic-gate * Service Key must match what is in the SA. 546*7c478bd9Sstevel@tonic-gate * access_type - indicates whether this is an insertion or deletion. 547*7c478bd9Sstevel@tonic-gate * valid values are IBMF_SAA_UPDATE or IBMF_SAA_DELETE 548*7c478bd9Sstevel@tonic-gate * flags - unused 549*7c478bd9Sstevel@tonic-gate * 550*7c478bd9Sstevel@tonic-gate * Ouptut Arguments 551*7c478bd9Sstevel@tonic-gate * none 552*7c478bd9Sstevel@tonic-gate * 553*7c478bd9Sstevel@tonic-gate * Return values: 554*7c478bd9Sstevel@tonic-gate * Error codes are the same as ibmf_sa_access() return values 555*7c478bd9Sstevel@tonic-gate */ 556*7c478bd9Sstevel@tonic-gate int ibmf_saa_update_service_record( 557*7c478bd9Sstevel@tonic-gate ibmf_saa_handle_t ibmf_saa_handle, 558*7c478bd9Sstevel@tonic-gate sa_service_record_t *service_record, 559*7c478bd9Sstevel@tonic-gate ibmf_saa_access_type_t access_type, 560*7c478bd9Sstevel@tonic-gate uint_t flags); 561*7c478bd9Sstevel@tonic-gate 562*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 563*7c478bd9Sstevel@tonic-gate } 564*7c478bd9Sstevel@tonic-gate #endif 565*7c478bd9Sstevel@tonic-gate 566*7c478bd9Sstevel@tonic-gate #endif /* _SYS_IB_MGT_IBMF_IBMF_SAA_H */ 567