10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 54703Shiremath * Common Development and Distribution License (the "License"). 64703Shiremath * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 210Sstevel@tonic-gate /* 2212163SRamaswamy.Tummala@Sun.COM * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. 230Sstevel@tonic-gate */ 240Sstevel@tonic-gate 250Sstevel@tonic-gate #ifndef _SYS_IB_IBTL_IBTI_COMMON_H 260Sstevel@tonic-gate #define _SYS_IB_IBTL_IBTI_COMMON_H 270Sstevel@tonic-gate 280Sstevel@tonic-gate /* 290Sstevel@tonic-gate * ibti_common.h 300Sstevel@tonic-gate * 310Sstevel@tonic-gate * This file contains the shared/common transport data types and function 320Sstevel@tonic-gate * prototypes. 330Sstevel@tonic-gate */ 3412163SRamaswamy.Tummala@Sun.COM #include <sys/types.h> 3512163SRamaswamy.Tummala@Sun.COM #include <sys/ib/ib_types.h> 3612163SRamaswamy.Tummala@Sun.COM #include <sys/ib/ibtl/ibtl_status.h> 370Sstevel@tonic-gate #include <sys/ib/ibtl/ibtl_types.h> 380Sstevel@tonic-gate #include <sys/ib/ibtl/ibti_cm.h> 390Sstevel@tonic-gate #include <sys/isa_defs.h> 400Sstevel@tonic-gate #include <sys/byteorder.h> 410Sstevel@tonic-gate 420Sstevel@tonic-gate #ifdef __cplusplus 430Sstevel@tonic-gate extern "C" { 440Sstevel@tonic-gate #endif 450Sstevel@tonic-gate 460Sstevel@tonic-gate /* 470Sstevel@tonic-gate * Max number of paths that can be requested in an ibt_get_paths() call, 480Sstevel@tonic-gate * if IBT_PATH_PERF or IBT_PATH_AVAIL flag (ibt_path_flags_t) is set. 490Sstevel@tonic-gate */ 500Sstevel@tonic-gate #define IBT_MAX_SPECIAL_PATHS 2 510Sstevel@tonic-gate 520Sstevel@tonic-gate /* 530Sstevel@tonic-gate * The name of DDI Event, generated when the properties of IOC device 540Sstevel@tonic-gate * node properties were modified. 550Sstevel@tonic-gate */ 560Sstevel@tonic-gate #define IB_PROP_UPDATE_EVENT "SUNW,IB:IB_PROP_UPDATE" 570Sstevel@tonic-gate 580Sstevel@tonic-gate 590Sstevel@tonic-gate /* Transport Interface version */ 60*12965SWilliam.Taylor@Oracle.COM typedef int ibt_version_t; 61*12965SWilliam.Taylor@Oracle.COM #define IBTI_V1 1 62*12965SWilliam.Taylor@Oracle.COM #define IBTI_V2 2 63*12965SWilliam.Taylor@Oracle.COM #define IBTI_V3 3 64*12965SWilliam.Taylor@Oracle.COM #define IBTI_V4 4 65*12965SWilliam.Taylor@Oracle.COM #define IBTI_V_CURR IBTI_V4 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* 680Sstevel@tonic-gate * Driver class type. Identifies a type of client driver so that 690Sstevel@tonic-gate * "IBTF Policy" decisions can be made on a driver class basis. 700Sstevel@tonic-gate * The last class should always be IBT_CLNT_NUM, and any new classes added 710Sstevel@tonic-gate * must be defined before IBT_CLNT_NUM. The class values must be above 0. 720Sstevel@tonic-gate * Any class values below or equal to 0 shall be invalid 730Sstevel@tonic-gate */ 740Sstevel@tonic-gate typedef enum ibt_clnt_class_e { 750Sstevel@tonic-gate IBT_STORAGE_DEV = 0x1, /* SCSI, FC, etc.. */ 760Sstevel@tonic-gate IBT_NETWORK_DEV, /* Network driver with associated client H/W */ 770Sstevel@tonic-gate IBT_GENERIC_DEV, /* Generic client H/W device driver */ 780Sstevel@tonic-gate IBT_NETWORK, /* Network driver with no associated */ 790Sstevel@tonic-gate /* client H/W, e.g., IPoIB */ 800Sstevel@tonic-gate IBT_GENERIC, /* A generic IB driver not */ 810Sstevel@tonic-gate /* associated with client H/W */ 820Sstevel@tonic-gate IBT_USER, /* A user application IBT interface driver */ 830Sstevel@tonic-gate IBT_IBMA, /* The IBMA Module */ 840Sstevel@tonic-gate IBT_CM, /* The CM Module */ 850Sstevel@tonic-gate IBT_DM, /* The DM Module */ 869076SRajkumar.Sivaprakasam@Sun.COM IBT_DM_AGENT, /* DM Agent Module */ 8711369SPramod.Gunjikar@Sun.COM IBT_GENERIC_MISC, /* Generic Misc Module */ 880Sstevel@tonic-gate IBT_CLASS_NUM /* Place holder for class count */ 890Sstevel@tonic-gate } ibt_clnt_class_t; 900Sstevel@tonic-gate 910Sstevel@tonic-gate #define IBT_TEST_DEV 999 /* Place holder for modules that test IBTL */ 920Sstevel@tonic-gate 930Sstevel@tonic-gate #define IBT_CLNT_DEVICE_CLASS(class) ((class) == IBT_STORAGE_DEV || \ 940Sstevel@tonic-gate (class) == IBT_NETWORK_DEV || \ 950Sstevel@tonic-gate (class) == IBT_GENERIC_DEV) 960Sstevel@tonic-gate 970Sstevel@tonic-gate #define IBT_CLNT_GENERAL_CLASS(class) ((class) == IBT_NETWORK || \ 980Sstevel@tonic-gate (class) == IBT_GENERIC || \ 999076SRajkumar.Sivaprakasam@Sun.COM (class) == IBT_DM_AGENT || \ 1009076SRajkumar.Sivaprakasam@Sun.COM (class) == IBT_TEST_DEV || \ 10111369SPramod.Gunjikar@Sun.COM (class) == IBT_GENERIC_MISC || \ 1020Sstevel@tonic-gate (class) == IBT_USER) 1030Sstevel@tonic-gate 1040Sstevel@tonic-gate #define IBT_CLNT_MGMT_CLASS(class) ((class) == IBT_IBMA || \ 1050Sstevel@tonic-gate (class) == IBT_CM || \ 1069076SRajkumar.Sivaprakasam@Sun.COM (class) == IBT_DM) 1079076SRajkumar.Sivaprakasam@Sun.COM 1089076SRajkumar.Sivaprakasam@Sun.COM /* 1099076SRajkumar.Sivaprakasam@Sun.COM * These are some special client classes which don't have a 'dip' hence have 1109076SRajkumar.Sivaprakasam@Sun.COM * to be handled specially in ibt_attach, where we bypass the check for a valid 1119076SRajkumar.Sivaprakasam@Sun.COM * dip if the client belongs to the class below. 1129076SRajkumar.Sivaprakasam@Sun.COM */ 1139076SRajkumar.Sivaprakasam@Sun.COM #define IBT_MISCMOD_CLIENTS(class) ((class) == IBT_IBMA || \ 1149076SRajkumar.Sivaprakasam@Sun.COM (class) == IBT_CM || \ 1150Sstevel@tonic-gate (class) == IBT_DM || \ 1169076SRajkumar.Sivaprakasam@Sun.COM (class) == IBT_DM_AGENT || \ 11711369SPramod.Gunjikar@Sun.COM (class) == IBT_GENERIC_MISC || \ 1180Sstevel@tonic-gate (class) == IBT_TEST_DEV) 1199076SRajkumar.Sivaprakasam@Sun.COM 1200Sstevel@tonic-gate /* 1210Sstevel@tonic-gate * Event record & status returns for asynchronous events and errors. 1220Sstevel@tonic-gate */ 1230Sstevel@tonic-gate typedef struct ibt_async_event_s { 1240Sstevel@tonic-gate uint64_t ev_fma_ena; /* FMA Error data */ 1250Sstevel@tonic-gate ibt_channel_hdl_t ev_chan_hdl; /* Channel handle */ 1260Sstevel@tonic-gate ibt_cq_hdl_t ev_cq_hdl; /* CQ handle */ 1270Sstevel@tonic-gate ib_guid_t ev_hca_guid; /* HCA node GUID */ 1288580SBill.Taylor@Sun.COM ibt_srq_hdl_t ev_srq_hdl; /* SRQ handle */ 1298580SBill.Taylor@Sun.COM ibt_port_change_t ev_port_flags; /* Port Change flags */ 1300Sstevel@tonic-gate uint8_t ev_port; /* HCA port */ 131*12965SWilliam.Taylor@Oracle.COM ibt_fc_syndrome_t ev_fc; /* FEXCH syndrome */ 1320Sstevel@tonic-gate } ibt_async_event_t; 1330Sstevel@tonic-gate 1340Sstevel@tonic-gate /* 1350Sstevel@tonic-gate * IBT Client Callback function typedefs. 1360Sstevel@tonic-gate * 1370Sstevel@tonic-gate * ibt_async_handler_t 1380Sstevel@tonic-gate * Pointer to an async event/error handler function. This function is 1390Sstevel@tonic-gate * called when an async event/error is detected on a HCA that is being 1400Sstevel@tonic-gate * used by the IBT client driver that registered the function. 1410Sstevel@tonic-gate */ 1420Sstevel@tonic-gate typedef void (*ibt_async_handler_t)(void *clnt_private, 1430Sstevel@tonic-gate ibt_hca_hdl_t hca_hdl, ibt_async_code_t code, ibt_async_event_t *event); 1440Sstevel@tonic-gate 1450Sstevel@tonic-gate /* 1460Sstevel@tonic-gate * IBT Client Memory Error Callback function typedefs. 1470Sstevel@tonic-gate * 1480Sstevel@tonic-gate * ibt_memory_handler_t 1490Sstevel@tonic-gate * Pointer to an memory event/error handler function. 1500Sstevel@tonic-gate */ 1510Sstevel@tonic-gate typedef void (*ibt_memory_handler_t)(void *clnt_private, 1520Sstevel@tonic-gate ibt_hca_hdl_t hca_hdl, ibt_mem_code_t code, ibt_mem_data_t *data); 1530Sstevel@tonic-gate 1540Sstevel@tonic-gate /* 1550Sstevel@tonic-gate * Define a client module information structure. All clients MUST 1560Sstevel@tonic-gate * define a global of type ibt_clnt_modinfo_t. A pointer to this global 1570Sstevel@tonic-gate * is passed into the IBTF by a client when calling ibt_attach(). 1580Sstevel@tonic-gate * This struct must persist during the life of the client. 1590Sstevel@tonic-gate * 1600Sstevel@tonic-gate * The client's mi_async_handler is called when an async event/error is 1610Sstevel@tonic-gate * detected on a HCA that is being used by this client. 1620Sstevel@tonic-gate */ 1630Sstevel@tonic-gate typedef struct ibt_clnt_modinfo_s { 1640Sstevel@tonic-gate ibt_version_t mi_ibt_version; /* TI version */ 1650Sstevel@tonic-gate ibt_clnt_class_t mi_clnt_class; /* Type of client */ 1660Sstevel@tonic-gate ibt_async_handler_t mi_async_handler; /* Async Handler */ 1670Sstevel@tonic-gate ibt_memory_handler_t mi_reserved; /* Memory handler */ 1680Sstevel@tonic-gate char *mi_clnt_name; /* Client Name. */ 1690Sstevel@tonic-gate } ibt_clnt_modinfo_t; 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate 1720Sstevel@tonic-gate /* 1730Sstevel@tonic-gate * Definitions for use with ibt_register_subnet_notices() 1740Sstevel@tonic-gate */ 1750Sstevel@tonic-gate typedef enum ibt_subnet_event_code_e { 1760Sstevel@tonic-gate IBT_SM_EVENT_MCG_CREATED = 1, 1770Sstevel@tonic-gate IBT_SM_EVENT_MCG_DELETED = 2, 1780Sstevel@tonic-gate IBT_SM_EVENT_AVAILABLE = 3, 1790Sstevel@tonic-gate IBT_SM_EVENT_UNAVAILABLE = 4, 1800Sstevel@tonic-gate IBT_SM_EVENT_GID_AVAIL = 5, 1810Sstevel@tonic-gate IBT_SM_EVENT_GID_UNAVAIL = 6 1820Sstevel@tonic-gate } ibt_subnet_event_code_t; 1830Sstevel@tonic-gate 1840Sstevel@tonic-gate typedef struct ibt_subnet_event_s { 1850Sstevel@tonic-gate ib_gid_t sm_notice_gid; 1860Sstevel@tonic-gate } ibt_subnet_event_t; 1870Sstevel@tonic-gate 1880Sstevel@tonic-gate typedef void (*ibt_sm_notice_handler_t)(void *private, ib_gid_t gid, 1890Sstevel@tonic-gate ibt_subnet_event_code_t code, ibt_subnet_event_t *event); 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate 1920Sstevel@tonic-gate /* 1930Sstevel@tonic-gate * MTU Request type. 1940Sstevel@tonic-gate */ 1950Sstevel@tonic-gate typedef struct ibt_mtu_req_s { 1960Sstevel@tonic-gate ib_mtu_t r_mtu; /* Requested MTU */ 1970Sstevel@tonic-gate ibt_selector_t r_selector; /* Qualifier for r_mtu */ 1980Sstevel@tonic-gate } ibt_mtu_req_t; 1990Sstevel@tonic-gate 2000Sstevel@tonic-gate 2010Sstevel@tonic-gate /* 2020Sstevel@tonic-gate * Qflags, used by ibt_resize_queues(). 2030Sstevel@tonic-gate */ 2040Sstevel@tonic-gate typedef enum ibt_qflags_e { 2050Sstevel@tonic-gate IBT_SEND_Q = 1 << 0, /* Op applies to the Send Q */ 2060Sstevel@tonic-gate IBT_RECV_Q = 1 << 1 /* Op applies to the Recv Q */ 2070Sstevel@tonic-gate } ibt_qflags_t; 2080Sstevel@tonic-gate 2090Sstevel@tonic-gate 2100Sstevel@tonic-gate /* 2110Sstevel@tonic-gate * ibt_cq_handler_t 2120Sstevel@tonic-gate * Pointer to a work request completion handler function. This function 2130Sstevel@tonic-gate * is called when a WR completes on a CQ that is being used by the IBTF 2140Sstevel@tonic-gate * client driver that registered the function. 2150Sstevel@tonic-gate */ 2160Sstevel@tonic-gate typedef void (*ibt_cq_handler_t)(ibt_cq_hdl_t ibt_cq, void *arg); 2170Sstevel@tonic-gate 2188580SBill.Taylor@Sun.COM /* default CQ handler ID */ 2198580SBill.Taylor@Sun.COM #define IBT_CQ_HID_DEFAULT (1) 2208580SBill.Taylor@Sun.COM 2210Sstevel@tonic-gate /* 2220Sstevel@tonic-gate * Service Data and flags. 2230Sstevel@tonic-gate * (IBTA Spec Release 1.1, Vol-1 Ref: 15.2.5.14.4) 2240Sstevel@tonic-gate * 2250Sstevel@tonic-gate * The ServiceData8.1 (sb_data8[0]) through ServiceData64.2 (sb_data64[1]) 2260Sstevel@tonic-gate * components together constitutes a 64-byte area in which any data may be 2270Sstevel@tonic-gate * placed. It is intended to be a convenient way for a service to provide its 2280Sstevel@tonic-gate * clients with some initial data. 2290Sstevel@tonic-gate * 2300Sstevel@tonic-gate * In addition, this 64-byte area is formally divided into a total of 30 2310Sstevel@tonic-gate * components, 16 8-bit (uint8_t) components, then 8 16-bit (uint16_t) 2320Sstevel@tonic-gate * components, then 6 32-bit (uint32_t) components, then 2 64-bit (uint64_t) 2330Sstevel@tonic-gate * components, thereby assigning ComponentMask bits (ibt_srv_data_flags_t) to 2340Sstevel@tonic-gate * variously-sized segments of the data. All data are in host endian format. 2350Sstevel@tonic-gate * This allows query operations (ibt_get_paths()) to be used which match 2360Sstevel@tonic-gate * parts of the Service Data, making it possible, for example, for 2370Sstevel@tonic-gate * service-specific parts of the ServiceData to serve as a binary-coded 2380Sstevel@tonic-gate * extension to the ServiceName for purposes of lookup. 2390Sstevel@tonic-gate */ 2400Sstevel@tonic-gate typedef enum ibt_srv_data_flags_e { 2410Sstevel@tonic-gate IBT_NO_SDATA = 0, 2420Sstevel@tonic-gate 2430Sstevel@tonic-gate IBT_SDATA8_0 = (1 << 0), 2440Sstevel@tonic-gate IBT_SDATA8_1 = (1 << 1), 2450Sstevel@tonic-gate IBT_SDATA8_2 = (1 << 2), 2460Sstevel@tonic-gate IBT_SDATA8_3 = (1 << 3), 2470Sstevel@tonic-gate IBT_SDATA8_4 = (1 << 4), 2480Sstevel@tonic-gate IBT_SDATA8_5 = (1 << 5), 2490Sstevel@tonic-gate IBT_SDATA8_6 = (1 << 6), 2500Sstevel@tonic-gate IBT_SDATA8_7 = (1 << 7), 2510Sstevel@tonic-gate IBT_SDATA8_8 = (1 << 8), 2520Sstevel@tonic-gate IBT_SDATA8_9 = (1 << 9), 2530Sstevel@tonic-gate IBT_SDATA8_10 = (1 << 10), 2540Sstevel@tonic-gate IBT_SDATA8_11 = (1 << 11), 2550Sstevel@tonic-gate IBT_SDATA8_12 = (1 << 12), 2560Sstevel@tonic-gate IBT_SDATA8_13 = (1 << 13), 2570Sstevel@tonic-gate IBT_SDATA8_14 = (1 << 14), 2580Sstevel@tonic-gate IBT_SDATA8_15 = (1 << 15), 2590Sstevel@tonic-gate 2600Sstevel@tonic-gate IBT_SDATA16_0 = (1 << 16), 2610Sstevel@tonic-gate IBT_SDATA16_1 = (1 << 17), 2620Sstevel@tonic-gate IBT_SDATA16_2 = (1 << 18), 2630Sstevel@tonic-gate IBT_SDATA16_3 = (1 << 19), 2640Sstevel@tonic-gate IBT_SDATA16_4 = (1 << 20), 2650Sstevel@tonic-gate IBT_SDATA16_5 = (1 << 21), 2660Sstevel@tonic-gate IBT_SDATA16_6 = (1 << 22), 2670Sstevel@tonic-gate IBT_SDATA16_7 = (1 << 23), 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate IBT_SDATA32_0 = (1 << 24), 2700Sstevel@tonic-gate IBT_SDATA32_1 = (1 << 25), 2710Sstevel@tonic-gate IBT_SDATA32_2 = (1 << 26), 2720Sstevel@tonic-gate IBT_SDATA32_3 = (1 << 27), 2730Sstevel@tonic-gate 2740Sstevel@tonic-gate IBT_SDATA64_0 = (1 << 28), 2750Sstevel@tonic-gate IBT_SDATA64_1 = (1 << 29), 2760Sstevel@tonic-gate 2770Sstevel@tonic-gate IBT_SDATA_ALL = 0x3FFFFFFF 2780Sstevel@tonic-gate } ibt_srv_data_flags_t; 2790Sstevel@tonic-gate 2800Sstevel@tonic-gate typedef struct ibt_srv_data_s { 2810Sstevel@tonic-gate uint8_t s_data8[16]; /* 8-bit service data fields. */ 2820Sstevel@tonic-gate uint16_t s_data16[8]; /* 16-bit service data fields. */ 2830Sstevel@tonic-gate uint32_t s_data32[4]; /* 32-bit service data fields. */ 2840Sstevel@tonic-gate uint64_t s_data64[2]; /* 64-bit service data fields. */ 2850Sstevel@tonic-gate } ibt_srv_data_t; 2860Sstevel@tonic-gate 2870Sstevel@tonic-gate /* 2880Sstevel@tonic-gate * Path flags, used in ibt_get_paths() 2890Sstevel@tonic-gate */ 2900Sstevel@tonic-gate typedef enum ibt_path_flags_e { 2910Sstevel@tonic-gate IBT_PATH_NO_FLAGS = 0, 2920Sstevel@tonic-gate IBT_PATH_APM = 1 << 0, /* APM is desired. */ 2930Sstevel@tonic-gate IBT_PATH_AVAIL = 1 << 2, 2940Sstevel@tonic-gate IBT_PATH_PERF = 1 << 3, 2950Sstevel@tonic-gate IBT_PATH_MULTI_SVC_DEST = 1 << 4, /* Multiple ServiceRecords */ 2960Sstevel@tonic-gate IBT_PATH_HOP = 1 << 5, /* pa_hop is specified. */ 2970Sstevel@tonic-gate IBT_PATH_PKEY = 1 << 6 /* pa_pkey is specified. */ 2980Sstevel@tonic-gate } ibt_path_flags_t; 2990Sstevel@tonic-gate 3000Sstevel@tonic-gate /* 3010Sstevel@tonic-gate * Path attributes. 3020Sstevel@tonic-gate * 3030Sstevel@tonic-gate * The ibt_path_attr_t structure is used to specify required attributes in a 3040Sstevel@tonic-gate * path from the requesting (source) node to a specified destination node. 3050Sstevel@tonic-gate * Attributes that are don't care should be set to NULL or '0'. 3060Sstevel@tonic-gate * A destination must be specified, where a destination can be defined as 3070Sstevel@tonic-gate * one of the following: 3080Sstevel@tonic-gate * 3090Sstevel@tonic-gate * o Service Name 3100Sstevel@tonic-gate * o Service ID (SID) 3110Sstevel@tonic-gate * o Array of DGIDs. 3120Sstevel@tonic-gate * o Service Name and Array of DGIDs. 3130Sstevel@tonic-gate */ 3140Sstevel@tonic-gate typedef struct ibt_path_attr_s { 3150Sstevel@tonic-gate ib_gid_t *pa_dgids; /* Array of DGIDs */ 3160Sstevel@tonic-gate ib_gid_t pa_sgid; 3170Sstevel@tonic-gate ib_guid_t pa_hca_guid; 3180Sstevel@tonic-gate char *pa_sname; /* ASCII Service name */ 3190Sstevel@tonic-gate /* NULL Terminated */ 3200Sstevel@tonic-gate ib_svc_id_t pa_sid; /* Service ID */ 3210Sstevel@tonic-gate ibt_srv_data_flags_t pa_sd_flags; /* Service Data flags. */ 3220Sstevel@tonic-gate ibt_srv_data_t pa_sdata; /* Service Data */ 3230Sstevel@tonic-gate uint8_t pa_hca_port_num; 3240Sstevel@tonic-gate uint8_t pa_num_dgids; /* size of pa_dgids array */ 3250Sstevel@tonic-gate uint8_t pa_sl:4; 3260Sstevel@tonic-gate ibt_mtu_req_t pa_mtu; 3270Sstevel@tonic-gate ibt_srate_req_t pa_srate; 3280Sstevel@tonic-gate ibt_pkt_lt_req_t pa_pkt_lt; /* Packet Life Time Request */ 3290Sstevel@tonic-gate uint_t pa_flow:20; 3300Sstevel@tonic-gate uint8_t pa_hop; /* IBT_PATH_HOP */ 3310Sstevel@tonic-gate uint8_t pa_tclass; 3320Sstevel@tonic-gate ib_pkey_t pa_pkey; /* IBT_PATH_PKEY */ 3330Sstevel@tonic-gate } ibt_path_attr_t; 3340Sstevel@tonic-gate 3350Sstevel@tonic-gate /* 3360Sstevel@tonic-gate * Path Information. 3370Sstevel@tonic-gate * 3380Sstevel@tonic-gate * The ibt_get_paths() performs SA Path record lookups to select a path(s) to 3390Sstevel@tonic-gate * a given destination(s), details of selected path(s) are returned in this 3400Sstevel@tonic-gate * structure. 3410Sstevel@tonic-gate * 3420Sstevel@tonic-gate * The ibt_path_info_t contains all the attributes of the best path(s), as 3430Sstevel@tonic-gate * as determined by IBTL, to the specified destination(s), including the 3440Sstevel@tonic-gate * local HCA and HCA port to use to access the fabric. 3450Sstevel@tonic-gate * 3460Sstevel@tonic-gate * The Service ID (pi_sid) and Service Data (pi_sdata) are returned only for 3470Sstevel@tonic-gate * lookups based on Service ID or/and Service Name. 3480Sstevel@tonic-gate */ 3490Sstevel@tonic-gate typedef struct ibt_path_info_s { 3500Sstevel@tonic-gate ib_guid_t pi_hca_guid; /* Local HCA GUID; 0 implies */ 3510Sstevel@tonic-gate /* this record is invalid */ 3520Sstevel@tonic-gate ib_svc_id_t pi_sid; /* Service ID */ 3530Sstevel@tonic-gate ibt_srv_data_t pi_sdata; /* Service Data */ 3540Sstevel@tonic-gate 3550Sstevel@tonic-gate ibt_cep_path_t pi_prim_cep_path; /* Contains CEP adds info */ 3560Sstevel@tonic-gate ibt_cep_path_t pi_alt_cep_path; /* RC & UC Only, valid if */ 3570Sstevel@tonic-gate /* cep_hca_port_num is not */ 3580Sstevel@tonic-gate /* '0' */ 3590Sstevel@tonic-gate ib_mtu_t pi_path_mtu; /* Common path MTU */ 3600Sstevel@tonic-gate ib_time_t pi_prim_pkt_lt; 3610Sstevel@tonic-gate ib_time_t pi_alt_pkt_lt; 3620Sstevel@tonic-gate } ibt_path_info_t; 3630Sstevel@tonic-gate 3640Sstevel@tonic-gate /* 3650Sstevel@tonic-gate * Optional Alternate Path attributes. 3660Sstevel@tonic-gate * 3670Sstevel@tonic-gate * The ibt_alt_path_attr_t structure is used to specify additional optional 3680Sstevel@tonic-gate * attributes when requesting an alternate path for an existing channel. 3690Sstevel@tonic-gate * 3700Sstevel@tonic-gate * Attributes that are don't care should be set to NULL or '0'. 3710Sstevel@tonic-gate */ 3720Sstevel@tonic-gate typedef struct ibt_alt_path_attr_s { 3730Sstevel@tonic-gate ib_gid_t apa_sgid; 3740Sstevel@tonic-gate ib_gid_t apa_dgid; 3750Sstevel@tonic-gate ibt_srate_req_t apa_srate; 3760Sstevel@tonic-gate ibt_pkt_lt_req_t apa_pkt_lt; /* Packet Life Time Request */ 3770Sstevel@tonic-gate uint_t apa_flow:20; 3780Sstevel@tonic-gate uint8_t apa_sl:4; 3790Sstevel@tonic-gate uint8_t apa_hop; 3800Sstevel@tonic-gate uint8_t apa_tclass; 3810Sstevel@tonic-gate } ibt_alt_path_attr_t; 3820Sstevel@tonic-gate 3830Sstevel@tonic-gate /* 3840Sstevel@tonic-gate * Path Information for Alternate Path - input to ibt_set_alt_path(). 3850Sstevel@tonic-gate */ 3860Sstevel@tonic-gate typedef struct ibt_alt_path_info_s { 3870Sstevel@tonic-gate ibt_cep_path_t ap_alt_cep_path; /* RC & UC Only, valid if */ 3880Sstevel@tonic-gate /* cep_hca_port_num is not */ 3890Sstevel@tonic-gate /* '0' */ 3900Sstevel@tonic-gate ib_time_t ap_alt_pkt_lt; 3910Sstevel@tonic-gate } ibt_alt_path_info_t; 3920Sstevel@tonic-gate 3930Sstevel@tonic-gate /* 3940Sstevel@tonic-gate * Open Channel flags, Used in ibt_open_rc_channel call 3950Sstevel@tonic-gate */ 3960Sstevel@tonic-gate typedef enum ibt_chan_open_flags_e { 3970Sstevel@tonic-gate IBT_OCHAN_NO_FLAGS = 0, 3980Sstevel@tonic-gate IBT_OCHAN_REDIRECTED = 1 << 0, 3990Sstevel@tonic-gate IBT_OCHAN_PORT_REDIRECTED = 1 << 1, 4000Sstevel@tonic-gate IBT_OCHAN_DUP = 1 << 2, 4010Sstevel@tonic-gate IBT_OCHAN_PORT_FIXED = 1 << 3, 4020Sstevel@tonic-gate IBT_OCHAN_OPAQUE1 = 1 << 4, 4030Sstevel@tonic-gate IBT_OCHAN_OPAQUE2 = 1 << 5, 4040Sstevel@tonic-gate IBT_OCHAN_OPAQUE3 = 1 << 6, 4050Sstevel@tonic-gate IBT_OCHAN_OPAQUE4 = 1 << 7, 40611369SPramod.Gunjikar@Sun.COM IBT_OCHAN_OPAQUE5 = 1 << 8, 40711369SPramod.Gunjikar@Sun.COM IBT_OCHAN_OPAQUE6 = 1 << 9 4080Sstevel@tonic-gate } ibt_chan_open_flags_t; 4090Sstevel@tonic-gate 4100Sstevel@tonic-gate /* 4110Sstevel@tonic-gate * Arguments for ibt_open_rc_channel(). 4120Sstevel@tonic-gate * 4130Sstevel@tonic-gate * oc_priv_data should be NULL or point to a buffer allocated by the caller, 4140Sstevel@tonic-gate * the size of which should be in oc_priv_data_len, where oc_priv_data_len <= 4150Sstevel@tonic-gate * IBT_REQ_PRIV_DATA_SZ. 4160Sstevel@tonic-gate * 4170Sstevel@tonic-gate * When ibt_open_rc_channel returns with ibt_cm_reason_t of 4180Sstevel@tonic-gate * IBT_CM_REDIRECT_PORT, the client can re-issue ibt_open_rc_channel setting 4190Sstevel@tonic-gate * new fields as follows: 4200Sstevel@tonic-gate * 4210Sstevel@tonic-gate * Set (ibt_chan_args_t)->oc_cm_cep_path = 4220Sstevel@tonic-gate * original (ibt_chan_open_args_t)->oc_path->pi_prim_cep_path. 4230Sstevel@tonic-gate * Set (ibt_chan_args_t)->oc_cm_pkt_lt = 4240Sstevel@tonic-gate * original (ibt_chan_open_args_t)->oc_prim_pkt_lt. 4250Sstevel@tonic-gate * Update (ibt_chan_args_t)->oc_path based on path information returned 4260Sstevel@tonic-gate * from ibt_get_paths using the gid in the return data below: 4270Sstevel@tonic-gate * (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info.ari_gid. 4280Sstevel@tonic-gate * Set flags to IBT_OCHAN_PORT_REDIRECTED. 4290Sstevel@tonic-gate * 4300Sstevel@tonic-gate * Note : oc_cm_path is not used for any other scenario, and must be set for 4310Sstevel@tonic-gate * IBT_OCHAN_PORT_REDIRECTED. 4320Sstevel@tonic-gate * 4330Sstevel@tonic-gate * When ibt_open_rc_channel returns with ibt_cm_reason_t of 4340Sstevel@tonic-gate * IBT_CM_REDIRECT_CM, the client can re-issue ibt_open_rc_channel setting 4350Sstevel@tonic-gate * new fields as follows: 4360Sstevel@tonic-gate * 4370Sstevel@tonic-gate * Update (ibt_chan_args_t)->oc_path based on path information returned 4380Sstevel@tonic-gate * from ibt_get_paths using the return data in 4390Sstevel@tonic-gate * (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info. 4400Sstevel@tonic-gate * 4410Sstevel@tonic-gate * Set (ibt_chan_args_t)->oc_cm_redirect_info = 4420Sstevel@tonic-gate * Returned (ibt_rc_returns_t)->rc_arej_info.ari_redirect_info. 4430Sstevel@tonic-gate * Set flags to IBT_OCHAN_REDIRECTED. 4440Sstevel@tonic-gate * 4450Sstevel@tonic-gate * Note: 4460Sstevel@tonic-gate * 4470Sstevel@tonic-gate * IBT_OCHAN_PORT_REDIRECTED flag cannot be used to specify a remote CM MAD 4480Sstevel@tonic-gate * address, that is on a different subnet than the RC connection itself. 4490Sstevel@tonic-gate * 4500Sstevel@tonic-gate * Not specified attributes should be set to "NULL" or "0". 4510Sstevel@tonic-gate */ 4520Sstevel@tonic-gate typedef struct ibt_chan_open_args_s { 4530Sstevel@tonic-gate ibt_path_info_t *oc_path; /* Primary & Alternate */ 4540Sstevel@tonic-gate ibt_cm_handler_t oc_cm_handler; /* cm_handler - required */ 4550Sstevel@tonic-gate void *oc_cm_clnt_private; /* First argument to */ 4560Sstevel@tonic-gate /* cm_handler */ 4570Sstevel@tonic-gate ibt_rnr_retry_cnt_t oc_path_rnr_retry_cnt; 4580Sstevel@tonic-gate uint8_t oc_path_retry_cnt:3; 4590Sstevel@tonic-gate uint8_t oc_rdma_ra_out; 4600Sstevel@tonic-gate uint8_t oc_rdma_ra_in; 4610Sstevel@tonic-gate ibt_priv_data_len_t oc_priv_data_len; /* Number of bytes of */ 4620Sstevel@tonic-gate /* REQ Private data */ 4630Sstevel@tonic-gate void *oc_priv_data; /* REQ private data */ 4640Sstevel@tonic-gate ibt_channel_hdl_t oc_dup_channel; /* IBT_OCHAN_DUP */ 4650Sstevel@tonic-gate ibt_redirect_info_t *oc_cm_redirect_info; /* Redirect params */ 4660Sstevel@tonic-gate /* for port and CM */ 4670Sstevel@tonic-gate /* redirection */ 4680Sstevel@tonic-gate ibt_cep_path_t *oc_cm_cep_path; /* Optional Path for */ 4690Sstevel@tonic-gate /* CM MADs on */ 4700Sstevel@tonic-gate /* port redirection */ 4710Sstevel@tonic-gate ib_time_t oc_cm_pkt_lt; /* Pkt life time for */ 4720Sstevel@tonic-gate /* CM MADs */ 4730Sstevel@tonic-gate uint32_t oc_opaque1:4; 4740Sstevel@tonic-gate uint32_t oc_opaque2:24; 4750Sstevel@tonic-gate uint32_t oc_opaque3; 4760Sstevel@tonic-gate uint32_t oc_opaque4; 4770Sstevel@tonic-gate } ibt_chan_open_args_t; 4780Sstevel@tonic-gate 4790Sstevel@tonic-gate 4800Sstevel@tonic-gate /* 4810Sstevel@tonic-gate * Define an optional RC return arguments structure. This contains return 4820Sstevel@tonic-gate * parameters from ibt_open_rc_channel() when called in BLOCKING mode. 4830Sstevel@tonic-gate * 4840Sstevel@tonic-gate * rc_priv_data should be NULL or point to a buffer allocated by the caller, 4850Sstevel@tonic-gate * the size of which should be in rc_priv_data_len, where rc_priv_data_len <= 4860Sstevel@tonic-gate * IBT_REP_PRIV_DATA_SZ. 4870Sstevel@tonic-gate */ 4880Sstevel@tonic-gate typedef struct ibt_rc_returns_s { 4890Sstevel@tonic-gate uint8_t rc_rdma_ra_in; /* Arbitrated resp resources */ 4900Sstevel@tonic-gate uint8_t rc_rdma_ra_out; /* Arbitrated initiator depth */ 4910Sstevel@tonic-gate ibt_arej_info_t rc_arej_info; 4920Sstevel@tonic-gate ibt_cm_reason_t rc_status; 4930Sstevel@tonic-gate uint8_t rc_failover_status; /* Failover status */ 4940Sstevel@tonic-gate ibt_priv_data_len_t rc_priv_data_len; 4950Sstevel@tonic-gate void *rc_priv_data; 4960Sstevel@tonic-gate } ibt_rc_returns_t; 4970Sstevel@tonic-gate 4980Sstevel@tonic-gate /* 4990Sstevel@tonic-gate * Define a callback function that can be used in Non-Blocking calls to 5000Sstevel@tonic-gate * ibt_recycle_rc(). 5010Sstevel@tonic-gate */ 5020Sstevel@tonic-gate 5030Sstevel@tonic-gate typedef void (*ibt_recycle_handler_t)(ibt_status_t ibt_status, void *arg); 5040Sstevel@tonic-gate 5050Sstevel@tonic-gate /* 5060Sstevel@tonic-gate * Define an optional return arguments structure from ibt_set_alt_path() 5070Sstevel@tonic-gate * This contains return parameters, when called in BLOCKING mode. 5080Sstevel@tonic-gate * 5090Sstevel@tonic-gate * ap_priv_data should be NULL or point to a buffer allocated by the caller, 5100Sstevel@tonic-gate * the size of which should be in ap_priv_data_len, where ap_priv_data_len <= 5110Sstevel@tonic-gate * IBT_APR_PRIV_DATA_SZ. 5120Sstevel@tonic-gate * The private data from APR is returned in ap_priv_data. 5130Sstevel@tonic-gate * The caller specifies amount of APR private data to be returned in 5140Sstevel@tonic-gate * ap_priv_data_len. 5150Sstevel@tonic-gate */ 5160Sstevel@tonic-gate typedef struct ibt_ap_returns_s { 5170Sstevel@tonic-gate ibt_ap_status_t ap_status; 5180Sstevel@tonic-gate boolean_t ap_arej_info_valid; 5190Sstevel@tonic-gate ibt_arej_info_t ap_arej_info; /* Only valid if redirect */ 5200Sstevel@tonic-gate ibt_priv_data_len_t ap_priv_data_len; 5210Sstevel@tonic-gate void *ap_priv_data; 5220Sstevel@tonic-gate } ibt_ap_returns_t; 5230Sstevel@tonic-gate 5240Sstevel@tonic-gate /* 5250Sstevel@tonic-gate * UD remote destination attributes. 5260Sstevel@tonic-gate * 5270Sstevel@tonic-gate * ud_sid, ud_addr, ud_pkt_lt and ud_pkey_ix must be specified. 5280Sstevel@tonic-gate * These values can be as returned in an ibt_path_info_t struct from an 5290Sstevel@tonic-gate * ibt_get_paths() call. 5300Sstevel@tonic-gate * 5310Sstevel@tonic-gate * ud_priv_data should be NULL or point to a buffer allocated by the caller, 5320Sstevel@tonic-gate * the size of which is in ud_priv_data_len, where ud_priv_data_len <= 5330Sstevel@tonic-gate * IBT_SIDR_REQ_PRIV_DATA_SZ. 5340Sstevel@tonic-gate */ 5350Sstevel@tonic-gate typedef struct ibt_ud_dest_attr_s { 5360Sstevel@tonic-gate ib_svc_id_t ud_sid; /* Service ID */ 5370Sstevel@tonic-gate ibt_adds_vect_t *ud_addr; /* Address Info */ 5380Sstevel@tonic-gate uint16_t ud_pkey_ix; /* Pkey Index */ 5390Sstevel@tonic-gate ib_time_t ud_pkt_lt; 5400Sstevel@tonic-gate ibt_cm_ud_handler_t ud_cm_handler; /* An optional CM UD event */ 5410Sstevel@tonic-gate /* which must be NULL */ 5420Sstevel@tonic-gate /* if not specified. */ 5430Sstevel@tonic-gate void *ud_cm_private; /* First arg to ud_cm_handler */ 5440Sstevel@tonic-gate ibt_priv_data_len_t ud_priv_data_len; 5450Sstevel@tonic-gate void *ud_priv_data; /* SIDR REQ private data */ 5460Sstevel@tonic-gate } ibt_ud_dest_attr_t; 5470Sstevel@tonic-gate 5480Sstevel@tonic-gate /* 5490Sstevel@tonic-gate * Define an optional UD return arguments structure. 5500Sstevel@tonic-gate * 5510Sstevel@tonic-gate * ud_priv_data should be NULL or point to a buffer allocated by the caller, 5520Sstevel@tonic-gate * the size of which should be in ud_priv_data_len, where ud_priv_data_len <= 5530Sstevel@tonic-gate * IBT_SIDR_REP_PRIV_DATA_SZ. 5540Sstevel@tonic-gate */ 5550Sstevel@tonic-gate typedef struct ibt_ud_returns_s { 5560Sstevel@tonic-gate ibt_sidr_status_t ud_status; 5570Sstevel@tonic-gate ibt_redirect_info_t ud_redirect; 5580Sstevel@tonic-gate ib_qpn_t ud_dqpn; /* Returned destination QPN */ 5590Sstevel@tonic-gate ib_qkey_t ud_qkey; /* Q_Key for destination QPN */ 5600Sstevel@tonic-gate ibt_priv_data_len_t ud_priv_data_len; 5610Sstevel@tonic-gate void *ud_priv_data; 5620Sstevel@tonic-gate } ibt_ud_returns_t; 5630Sstevel@tonic-gate 5640Sstevel@tonic-gate /* 5650Sstevel@tonic-gate * Multicast group attributes 5660Sstevel@tonic-gate * Not specified attributes should be set to "NULL" or "0". 5670Sstevel@tonic-gate * Used by ibt_join_mcg()/ibt_query_mcg(). 5680Sstevel@tonic-gate * 5690Sstevel@tonic-gate * mc_qkey, mc_pkey, mc_flow, mc_tclass, mc_sl, mc_join_state are required for 5700Sstevel@tonic-gate * create - ibt_join_mcg(). 5710Sstevel@tonic-gate */ 5720Sstevel@tonic-gate typedef struct ibt_mcg_attr_s { 5730Sstevel@tonic-gate ib_gid_t mc_mgid; /* MGID */ 5740Sstevel@tonic-gate ib_gid_t mc_pgid; /* SGID of the end port being */ 5750Sstevel@tonic-gate /* added to the MCG. */ 5760Sstevel@tonic-gate ib_qkey_t mc_qkey; /* Q_Key */ 5770Sstevel@tonic-gate ib_pkey_t mc_pkey; /* Partition key for this MCG */ 5780Sstevel@tonic-gate ibt_mtu_req_t mc_mtu_req; /* MTU */ 5790Sstevel@tonic-gate ibt_srate_req_t mc_rate_req; /* Static rate */ 5800Sstevel@tonic-gate ibt_pkt_lt_req_t mc_pkt_lt_req; /* Packet Life Time Request */ 5810Sstevel@tonic-gate uint_t mc_flow:20; /* FlowLabel. */ 5820Sstevel@tonic-gate uint8_t mc_hop; /* HopLimit */ 5830Sstevel@tonic-gate uint8_t mc_tclass; /* Traffic Class. */ 5840Sstevel@tonic-gate uint8_t mc_sl:4; /* Service Level */ 5850Sstevel@tonic-gate uint8_t mc_scope:4, /* Multicast Address Scope */ 5860Sstevel@tonic-gate mc_join_state:4; /* FULL For create */ 5870Sstevel@tonic-gate ib_lid_t mc_opaque1; 5880Sstevel@tonic-gate } ibt_mcg_attr_t; 5890Sstevel@tonic-gate 5900Sstevel@tonic-gate /* 5910Sstevel@tonic-gate * Multicast group attributes. 5920Sstevel@tonic-gate * returned by ibt_join_mcg()/ibt_query_mcg(). 5930Sstevel@tonic-gate */ 5940Sstevel@tonic-gate typedef struct ibt_mcg_info_s { 5950Sstevel@tonic-gate ibt_adds_vect_t mc_adds_vect; /* Address information */ 5960Sstevel@tonic-gate ib_mtu_t mc_mtu; /* MTU */ 5970Sstevel@tonic-gate ib_qkey_t mc_qkey; /* Q_Key */ 5980Sstevel@tonic-gate uint16_t mc_pkey_ix; /* Pkey Index */ 5990Sstevel@tonic-gate uint8_t mc_scope:4; /* Multicast Address Scope */ 6000Sstevel@tonic-gate clock_t mc_opaque2; 6010Sstevel@tonic-gate } ibt_mcg_info_t; 6020Sstevel@tonic-gate 6030Sstevel@tonic-gate /* 6040Sstevel@tonic-gate * Define a callback function that can be used in Non-Blocking calls to 6050Sstevel@tonic-gate * ibt_join_mcg(). 6060Sstevel@tonic-gate */ 6070Sstevel@tonic-gate typedef void (*ibt_mcg_handler_t)(void *arg, ibt_status_t retval, 6080Sstevel@tonic-gate ibt_mcg_info_t *mcg_info_p); 6090Sstevel@tonic-gate 6100Sstevel@tonic-gate 6110Sstevel@tonic-gate /* 6120Sstevel@tonic-gate * Service Flags - sd_flags 6130Sstevel@tonic-gate * 6140Sstevel@tonic-gate * IBT_SRV_PEER_TYPE_SID Peer-to-peer Service IDs. 6150Sstevel@tonic-gate */ 6160Sstevel@tonic-gate 6170Sstevel@tonic-gate typedef enum ibt_service_flags_e { 6180Sstevel@tonic-gate IBT_SRV_NO_FLAGS = 0x0, 6190Sstevel@tonic-gate IBT_SRV_PEER_TYPE_SID = 0x1 6200Sstevel@tonic-gate } ibt_service_flags_t; 6210Sstevel@tonic-gate 6220Sstevel@tonic-gate /* 6230Sstevel@tonic-gate * Define a Service ID Registration structure. 6240Sstevel@tonic-gate */ 6250Sstevel@tonic-gate typedef struct ibt_srv_desc_s { 6260Sstevel@tonic-gate ibt_cm_ud_handler_t sd_ud_handler; /* UD Service Handler */ 6270Sstevel@tonic-gate ibt_cm_handler_t sd_handler; /* Non-UD Service Handler */ 6280Sstevel@tonic-gate ibt_service_flags_t sd_flags; /* Flags */ 6290Sstevel@tonic-gate } ibt_srv_desc_t; 6300Sstevel@tonic-gate 6310Sstevel@tonic-gate /* 6320Sstevel@tonic-gate * Flag to indicate ibt_bind_service() to or NOT-to clean-up Stale matching 6330Sstevel@tonic-gate * Local Service Records with SA prior to binding the new request. 6340Sstevel@tonic-gate */ 6350Sstevel@tonic-gate #define IBT_SBIND_NO_FLAGS 0 6360Sstevel@tonic-gate #define IBT_SBIND_NO_CLEANUP 1 6370Sstevel@tonic-gate 6380Sstevel@tonic-gate /* 6390Sstevel@tonic-gate * Define a Service ID Binding structure (data for service records). 6400Sstevel@tonic-gate */ 6410Sstevel@tonic-gate typedef struct ibt_srv_bind_s { 6420Sstevel@tonic-gate uint64_t sb_key[2]; /* Service Key */ 6430Sstevel@tonic-gate char *sb_name; /* Service Name (up to 63 chars) */ 6440Sstevel@tonic-gate uint32_t sb_lease; /* Service Lease period (in seconds) */ 6450Sstevel@tonic-gate ib_pkey_t sb_pkey; /* Service P_Key */ 6460Sstevel@tonic-gate ibt_srv_data_t sb_data; /* Service Data */ 6470Sstevel@tonic-gate uint_t sb_flag; /* indicates to/not-to clean-up stale */ 6480Sstevel@tonic-gate /* matching local service records. */ 6490Sstevel@tonic-gate } ibt_srv_bind_t; 6500Sstevel@tonic-gate 6510Sstevel@tonic-gate /* 6520Sstevel@tonic-gate * ibt_cm_delay() flags. 6530Sstevel@tonic-gate * 6540Sstevel@tonic-gate * Refer to InfiniBand Architecture Release Volume 1 Rev 1.0a: 6550Sstevel@tonic-gate * Section 12.6.6 MRA 6560Sstevel@tonic-gate */ 6570Sstevel@tonic-gate typedef enum ibt_cmdelay_flags_e { 6580Sstevel@tonic-gate IBT_CM_DELAY_REQ = 0, 6590Sstevel@tonic-gate IBT_CM_DELAY_REP = 1, 6600Sstevel@tonic-gate IBT_CM_DELAY_LAP = 2 6610Sstevel@tonic-gate } ibt_cmdelay_flags_t; 6620Sstevel@tonic-gate 6630Sstevel@tonic-gate /* 6640Sstevel@tonic-gate * The payload for DDI events passed on IB_PROP_UPDATE_EVENT. 6650Sstevel@tonic-gate * This is passed as the bus nexus data to event_handler(9e). 6660Sstevel@tonic-gate */ 6670Sstevel@tonic-gate typedef struct ibt_prop_update_payload_s { 6680Sstevel@tonic-gate union { 6690Sstevel@tonic-gate struct { 6700Sstevel@tonic-gate uint32_t srv_updated:1; 6710Sstevel@tonic-gate uint32_t gid_updated:1; 6720Sstevel@tonic-gate } _ib_prop_update_struct; 6730Sstevel@tonic-gate uint32_t prop_updated; 6740Sstevel@tonic-gate } _ib_prop_update_union; 6750Sstevel@tonic-gate ibt_status_t ib_reprobe_status; 6760Sstevel@tonic-gate 6770Sstevel@tonic-gate #define ib_srv_prop_updated \ 6780Sstevel@tonic-gate _ib_prop_update_union._ib_prop_update_struct.srv_updated 6790Sstevel@tonic-gate #define ib_gid_prop_updated \ 6800Sstevel@tonic-gate _ib_prop_update_union._ib_prop_update_struct.gid_updated 6810Sstevel@tonic-gate #define ib_prop_updated \ 6820Sstevel@tonic-gate _ib_prop_update_union.prop_updated 6830Sstevel@tonic-gate } ibt_prop_update_payload_t; 6840Sstevel@tonic-gate 6850Sstevel@tonic-gate 6860Sstevel@tonic-gate /* 6870Sstevel@tonic-gate * FUNCTION PROTOTYPES. 6880Sstevel@tonic-gate */ 6890Sstevel@tonic-gate 6900Sstevel@tonic-gate /* 6910Sstevel@tonic-gate * ibt_attach() and ibt_detach(): 6920Sstevel@tonic-gate * These are the calls into IBTF used during client driver attach() and 693401Shiremath * detach(). 6940Sstevel@tonic-gate * 6950Sstevel@tonic-gate * The IBTF returns an ibt_clnt_hdl_t to the client. This handle is used 6960Sstevel@tonic-gate * to identify this client device in all subsequent calls into the IBTF. 6970Sstevel@tonic-gate * 6980Sstevel@tonic-gate * The ibt_detach() routine is called from a client driver's detach() 6990Sstevel@tonic-gate * routine to deregister itself from the IBTF. 7000Sstevel@tonic-gate */ 7010Sstevel@tonic-gate ibt_status_t ibt_attach(ibt_clnt_modinfo_t *mod_infop, dev_info_t *arg, 7020Sstevel@tonic-gate void *clnt_private, ibt_clnt_hdl_t *ibt_hdl_p); 7030Sstevel@tonic-gate 7040Sstevel@tonic-gate ibt_status_t ibt_detach(ibt_clnt_hdl_t ibt_hdl); 7050Sstevel@tonic-gate 7060Sstevel@tonic-gate /* 7070Sstevel@tonic-gate * HCA FUNCTIONS 7080Sstevel@tonic-gate */ 7090Sstevel@tonic-gate 7100Sstevel@tonic-gate /* 7110Sstevel@tonic-gate * ibt_get_hca_list() 7120Sstevel@tonic-gate * Returns the number of HCAs in a system and their node GUIDS. 7130Sstevel@tonic-gate * 7140Sstevel@tonic-gate * If hca_list_p is not NULL then the memory for the array of GUIDs is 7150Sstevel@tonic-gate * allocated by the IBTF and should be freed by the caller using 7160Sstevel@tonic-gate * ibt_free_hca_list(). If hca_list_p is NULL then no memory is allocated 7170Sstevel@tonic-gate * by ibt_get_hca_list and only the number of HCAs in a system is returned. 7180Sstevel@tonic-gate * 7190Sstevel@tonic-gate * It is assumed that the caller can block in kmem_alloc. 7200Sstevel@tonic-gate * 7210Sstevel@tonic-gate * ibt_free_hca_list() 7220Sstevel@tonic-gate * Free the memory allocated by ibt_get_hca_list(). 7230Sstevel@tonic-gate */ 7240Sstevel@tonic-gate uint_t ibt_get_hca_list(ib_guid_t **hca_list_p); 7250Sstevel@tonic-gate 7260Sstevel@tonic-gate void ibt_free_hca_list(ib_guid_t *hca_list, uint_t entries); 7270Sstevel@tonic-gate 7280Sstevel@tonic-gate /* 7290Sstevel@tonic-gate * ibt_open_hca() - Open/Close a HCA. HCA can only be opened/closed 7300Sstevel@tonic-gate * ibt_close_hca() once. ibt_open_hca() takes a client's ibt handle 7310Sstevel@tonic-gate * and a GUID and returns a unique IBT client HCA 7320Sstevel@tonic-gate * handle. 7330Sstevel@tonic-gate * 7340Sstevel@tonic-gate * These routines can not be called from interrupt context. 7350Sstevel@tonic-gate */ 7360Sstevel@tonic-gate ibt_status_t ibt_open_hca(ibt_clnt_hdl_t ibt_hdl, ib_guid_t hca_guid, 7370Sstevel@tonic-gate ibt_hca_hdl_t *hca_hdl); 7380Sstevel@tonic-gate 7390Sstevel@tonic-gate ibt_status_t ibt_close_hca(ibt_hca_hdl_t hca_hdl); 7400Sstevel@tonic-gate 7410Sstevel@tonic-gate 7420Sstevel@tonic-gate /* 7430Sstevel@tonic-gate * ibt_query_hca() 7440Sstevel@tonic-gate * ibt_query_hca_byguid() 7450Sstevel@tonic-gate * Returns the static attributes of the specified HCA 7460Sstevel@tonic-gate */ 7470Sstevel@tonic-gate ibt_status_t ibt_query_hca(ibt_hca_hdl_t hca_hdl, ibt_hca_attr_t *hca_attrs); 7480Sstevel@tonic-gate 7490Sstevel@tonic-gate ibt_status_t ibt_query_hca_byguid(ib_guid_t hca_guid, 7500Sstevel@tonic-gate ibt_hca_attr_t *hca_attrs); 7510Sstevel@tonic-gate 7520Sstevel@tonic-gate 7530Sstevel@tonic-gate /* 7540Sstevel@tonic-gate * ibt_query_hca_ports() 7550Sstevel@tonic-gate * ibt_query_hca_ports_byguid() 7560Sstevel@tonic-gate * Returns HCA port/ports attributes for the specified HCA port/ports. 7570Sstevel@tonic-gate * ibt_query_hca_ports() allocates the memory required for the 7580Sstevel@tonic-gate * ibt_hca_portinfo_t struct as well as the memory required for the SGID 7590Sstevel@tonic-gate * and P_Key tables contained within that struct. 7600Sstevel@tonic-gate * 7610Sstevel@tonic-gate * ibt_free_portinfo() 7620Sstevel@tonic-gate * Frees the memory allocated for a specified ibt_hca_portinfo_t struct. 7630Sstevel@tonic-gate */ 7640Sstevel@tonic-gate ibt_status_t ibt_query_hca_ports(ibt_hca_hdl_t hca_hdl, uint8_t port, 7650Sstevel@tonic-gate ibt_hca_portinfo_t **port_info_p, uint_t *ports_p, uint_t *size_p); 7660Sstevel@tonic-gate 7670Sstevel@tonic-gate ibt_status_t ibt_query_hca_ports_byguid(ib_guid_t hca_guid, uint8_t port, 7680Sstevel@tonic-gate ibt_hca_portinfo_t **port_info_p, uint_t *ports_p, uint_t *size_p); 7690Sstevel@tonic-gate 7700Sstevel@tonic-gate void ibt_free_portinfo(ibt_hca_portinfo_t *port_info, uint_t size); 7710Sstevel@tonic-gate 7720Sstevel@tonic-gate /* 7730Sstevel@tonic-gate * ibt_set_hca_private() - Set/get the client private data. 7740Sstevel@tonic-gate * ibt_get_hca_private() 7750Sstevel@tonic-gate */ 7760Sstevel@tonic-gate void ibt_set_hca_private(ibt_hca_hdl_t hca_hdl, void *clnt_private); 7770Sstevel@tonic-gate void *ibt_get_hca_private(ibt_hca_hdl_t hca_hdl); 7780Sstevel@tonic-gate 7790Sstevel@tonic-gate /* 7800Sstevel@tonic-gate * ibt_hca_handle_to_guid() 7810Sstevel@tonic-gate * A helper function to retrieve HCA GUID for the specified handle. 7820Sstevel@tonic-gate * Returns HCA GUID on which the specified Channel is allocated. Valid 7830Sstevel@tonic-gate * if it is non-NULL on return. 7840Sstevel@tonic-gate */ 7850Sstevel@tonic-gate ib_guid_t ibt_hca_handle_to_guid(ibt_hca_hdl_t hca); 7860Sstevel@tonic-gate 7870Sstevel@tonic-gate /* 7880Sstevel@tonic-gate * ibt_hca_guid_to_handle() 7890Sstevel@tonic-gate * A helper function to retrieve a hca handle from a HCA GUID. 7900Sstevel@tonic-gate */ 7910Sstevel@tonic-gate ibt_status_t ibt_hca_guid_to_handle(ibt_clnt_hdl_t ibt_hdl, ib_guid_t hca_guid, 7920Sstevel@tonic-gate ibt_hca_hdl_t *hca_hdl); 7930Sstevel@tonic-gate 7940Sstevel@tonic-gate /* 7950Sstevel@tonic-gate * CONNECTION ESTABLISHMENT/TEAR DOWN FUNCTIONS. 7960Sstevel@tonic-gate */ 7970Sstevel@tonic-gate 7980Sstevel@tonic-gate /* 7990Sstevel@tonic-gate * ibt_get_paths 8000Sstevel@tonic-gate * Finds the best path to a specified destination (as determined by the 8010Sstevel@tonic-gate * IBTL) that satisfies the requirements specified in an ibt_path_attr_t 8020Sstevel@tonic-gate * struct. 8030Sstevel@tonic-gate */ 8040Sstevel@tonic-gate ibt_status_t ibt_get_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags, 8050Sstevel@tonic-gate ibt_path_attr_t *attr, uint8_t max_paths, ibt_path_info_t *paths, 8060Sstevel@tonic-gate uint8_t *num_paths_p); 8070Sstevel@tonic-gate 8080Sstevel@tonic-gate 8090Sstevel@tonic-gate /* 8100Sstevel@tonic-gate * Callback function that can be used in ibt_aget_paths(), a Non-Blocking 8110Sstevel@tonic-gate * version of ibt_get_paths(). 8120Sstevel@tonic-gate */ 8130Sstevel@tonic-gate typedef void (*ibt_path_handler_t)(void *arg, ibt_status_t retval, 8140Sstevel@tonic-gate ibt_path_info_t *paths, uint8_t num_paths); 8150Sstevel@tonic-gate 8160Sstevel@tonic-gate /* 8170Sstevel@tonic-gate * Find path(s) to a given destination or service asynchronously. 8180Sstevel@tonic-gate * ibt_aget_paths() is a Non-Blocking version of ibt_get_paths(). 8190Sstevel@tonic-gate */ 8200Sstevel@tonic-gate ibt_status_t ibt_aget_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags, 8210Sstevel@tonic-gate ibt_path_attr_t *attr, uint8_t max_paths, ibt_path_handler_t func, 8220Sstevel@tonic-gate void *arg); 8230Sstevel@tonic-gate 8240Sstevel@tonic-gate /* 8250Sstevel@tonic-gate * ibt_get_alt_path 8260Sstevel@tonic-gate * Finds the best alternate path to a specified channel (as determined by 8270Sstevel@tonic-gate * the IBTL) that satisfies the requirements specified in an 8280Sstevel@tonic-gate * ibt_alt_path_attr_t struct. The specified channel must have been 8290Sstevel@tonic-gate * previously opened successfully using ibt_open_rc_channel. 8300Sstevel@tonic-gate */ 8310Sstevel@tonic-gate ibt_status_t ibt_get_alt_path(ibt_channel_hdl_t chan, ibt_path_flags_t flags, 8320Sstevel@tonic-gate ibt_alt_path_attr_t *attr, ibt_alt_path_info_t *alt_path); 8330Sstevel@tonic-gate 8340Sstevel@tonic-gate /* 8350Sstevel@tonic-gate * ibt_open_rc_channel 8360Sstevel@tonic-gate * ibt_open_rc_channel() opens a previously allocated RC communication 8370Sstevel@tonic-gate * channel. The IBTL initiates the channel establishment protocol. 8380Sstevel@tonic-gate */ 8390Sstevel@tonic-gate ibt_status_t ibt_open_rc_channel(ibt_channel_hdl_t rc_chan, 8400Sstevel@tonic-gate ibt_chan_open_flags_t flags, ibt_execution_mode_t mode, 8410Sstevel@tonic-gate ibt_chan_open_args_t *args, ibt_rc_returns_t *returns); 8420Sstevel@tonic-gate 8430Sstevel@tonic-gate /* 8440Sstevel@tonic-gate * ibt_close_rc_channel 8450Sstevel@tonic-gate * Close the specified channel. Outstanding work requests are flushed 8460Sstevel@tonic-gate * so that the client can do the associated clean up. After that, the 8470Sstevel@tonic-gate * client will usually deregister the previously registered memory, 8480Sstevel@tonic-gate * then free the channel by calling ibt_free_rc_channel(). 8490Sstevel@tonic-gate * 8500Sstevel@tonic-gate * This function will reuse CM event Handler provided in 8510Sstevel@tonic-gate * ibt_open_rc_channel(). 8520Sstevel@tonic-gate */ 8530Sstevel@tonic-gate ibt_status_t ibt_close_rc_channel(ibt_channel_hdl_t rc_chan, 8540Sstevel@tonic-gate ibt_execution_mode_t mode, void *priv_data, 8550Sstevel@tonic-gate ibt_priv_data_len_t priv_data_len, uint8_t *ret_status, 8560Sstevel@tonic-gate void *ret_priv_data, ibt_priv_data_len_t *ret_priv_data_len_p); 8570Sstevel@tonic-gate 8580Sstevel@tonic-gate /* 8590Sstevel@tonic-gate * ibt_prime_close_rc_channel 8600Sstevel@tonic-gate * 8610Sstevel@tonic-gate * Allocates resources required for a close rc channel operation. 8620Sstevel@tonic-gate * Calling ibt_prime_close_rc_channel() allows a channel to be 8630Sstevel@tonic-gate * subsequently closed in interrupt context. 8640Sstevel@tonic-gate * 8650Sstevel@tonic-gate * A call is first made to ibt_prime_close_rc_channel in non-interrupt 8660Sstevel@tonic-gate * context, followed by ibt_close_rc_channel in non-blocking mode from 8670Sstevel@tonic-gate * interrupt context 8680Sstevel@tonic-gate * 8690Sstevel@tonic-gate * ibt_prime_close_rc_channel() can only be called on a previously opened 8700Sstevel@tonic-gate * channel. 8710Sstevel@tonic-gate */ 8720Sstevel@tonic-gate ibt_status_t ibt_prime_close_rc_channel(ibt_channel_hdl_t rc_chan); 8730Sstevel@tonic-gate 8740Sstevel@tonic-gate /* 8750Sstevel@tonic-gate * ibt_recycle_rc 8760Sstevel@tonic-gate * 8770Sstevel@tonic-gate * Recycle a RC channel which has transitioned to Error state. The 8780Sstevel@tonic-gate * ibt_recycle_rc() function transitions the channel from Error 8790Sstevel@tonic-gate * state (IBT_STATE_ERROR) to the state ready for use by 8800Sstevel@tonic-gate * ibt_open_rc_channel. Basically, this function is very similar to 8810Sstevel@tonic-gate * ibt_alloc_rc_channel, but reuses an existing RC channel. 8820Sstevel@tonic-gate * 8830Sstevel@tonic-gate * Clients are allowed to make resource clean up/free calls in the CM handler 8840Sstevel@tonic-gate * 8850Sstevel@tonic-gate * Client(s) must not invoke blocking version (ie., func specified as NULL) of 8860Sstevel@tonic-gate * ibt_recycle_rc from cm callback for IBT_CM_EVENT_CONN_CLOSED 8870Sstevel@tonic-gate * 8880Sstevel@tonic-gate * Clients are strongly advised not to issue blocking calls from func, as this 8890Sstevel@tonic-gate * would block the CM threads, and could delay or block other client connections 8900Sstevel@tonic-gate * and ibtl related API invocations. 8910Sstevel@tonic-gate */ 8920Sstevel@tonic-gate ibt_status_t ibt_recycle_rc(ibt_channel_hdl_t rc_chan, ibt_cep_flags_t control, 8930Sstevel@tonic-gate uint8_t hca_port_num, ibt_recycle_handler_t func, void *arg); 8940Sstevel@tonic-gate 8950Sstevel@tonic-gate /* 8960Sstevel@tonic-gate * ibt_recycle_ud 8970Sstevel@tonic-gate * 8980Sstevel@tonic-gate * Recycle a UD channel which has transitioned to Error state. The 8990Sstevel@tonic-gate * ibt_recycle_ud() function transitions the channel from Error 9000Sstevel@tonic-gate * state (IBT_STATE_ERROR) to a usable state (IBT_STATE_RTS). 9010Sstevel@tonic-gate * Basically, this function is very similar to ibt_alloc_ud_channel, 9020Sstevel@tonic-gate * but reuses an existing UD channel. 9030Sstevel@tonic-gate */ 9040Sstevel@tonic-gate ibt_status_t ibt_recycle_ud(ibt_channel_hdl_t ud_chan, uint8_t hca_port_num, 9050Sstevel@tonic-gate uint16_t pkey_ix, ib_qkey_t qkey); 9060Sstevel@tonic-gate 9070Sstevel@tonic-gate /* 9080Sstevel@tonic-gate * MODIFY CHANNEL ATTRIBUTE FUNCTIONs. 9090Sstevel@tonic-gate */ 9100Sstevel@tonic-gate 9110Sstevel@tonic-gate /* 9120Sstevel@tonic-gate * ibt_pause_sendq 9130Sstevel@tonic-gate * ibt_unpause_sendq 9140Sstevel@tonic-gate * Place the send queue of the specified channel into the send queue 9150Sstevel@tonic-gate * drained state. 9160Sstevel@tonic-gate * Applicable for both RC and UD channels. 9170Sstevel@tonic-gate */ 9180Sstevel@tonic-gate ibt_status_t ibt_pause_sendq(ibt_channel_hdl_t chan, 9190Sstevel@tonic-gate ibt_cep_modify_flags_t modify_flags); 9200Sstevel@tonic-gate 9210Sstevel@tonic-gate ibt_status_t ibt_unpause_sendq(ibt_channel_hdl_t chan); 9220Sstevel@tonic-gate 9230Sstevel@tonic-gate /* 9240Sstevel@tonic-gate * ibt_resize_queues() 9250Sstevel@tonic-gate * Resize the SendQ/RecvQ sizes of a channel. 9260Sstevel@tonic-gate * 9270Sstevel@tonic-gate * Applicable for both RC and UD channels. 9280Sstevel@tonic-gate */ 9290Sstevel@tonic-gate ibt_status_t ibt_resize_queues(ibt_channel_hdl_t chan, ibt_qflags_t flags, 9300Sstevel@tonic-gate ibt_queue_sizes_t *request_sz, ibt_queue_sizes_t *actual_sz); 9310Sstevel@tonic-gate 9320Sstevel@tonic-gate /* 9330Sstevel@tonic-gate * ibt_query_queues() 9340Sstevel@tonic-gate * 9350Sstevel@tonic-gate * Query the SendQ/RecvQ sizes of a channel. 9360Sstevel@tonic-gate * Applicable for both RC and UD channels. 9370Sstevel@tonic-gate */ 9380Sstevel@tonic-gate ibt_status_t ibt_query_queues(ibt_channel_hdl_t chan, 9390Sstevel@tonic-gate ibt_queue_sizes_t *actual_sz); 9400Sstevel@tonic-gate 9410Sstevel@tonic-gate /* 9420Sstevel@tonic-gate * ibt_modify_rdma 9430Sstevel@tonic-gate * Enable/disable RDMA operations. 9440Sstevel@tonic-gate * 9450Sstevel@tonic-gate * Applicable for RC channels only. 9460Sstevel@tonic-gate */ 9470Sstevel@tonic-gate ibt_status_t ibt_modify_rdma(ibt_channel_hdl_t rc_chan, 9480Sstevel@tonic-gate ibt_cep_modify_flags_t modify_flags, ibt_cep_flags_t flags); 9490Sstevel@tonic-gate 9500Sstevel@tonic-gate 9510Sstevel@tonic-gate /* 9520Sstevel@tonic-gate * ibt_set_rdma_resource 9530Sstevel@tonic-gate * Change the number of resources to be used for incoming and outgoing 9540Sstevel@tonic-gate * RDMA reads & Atomics. 9550Sstevel@tonic-gate */ 9560Sstevel@tonic-gate ibt_status_t ibt_set_rdma_resource(ibt_channel_hdl_t rc_chan, 9570Sstevel@tonic-gate ibt_cep_modify_flags_t modify_flags, uint8_t rdma_ra_out, 9580Sstevel@tonic-gate uint8_t rdma_ra_in); 9590Sstevel@tonic-gate 9600Sstevel@tonic-gate /* 9610Sstevel@tonic-gate * ibt_change_port 9620Sstevel@tonic-gate * Change the primary physical port of an RC channel. (This is done only 9630Sstevel@tonic-gate * if HCA supports this capability). Can only be called on a paused 9640Sstevel@tonic-gate * channel. 9650Sstevel@tonic-gate * Applicable for RC channels only. 9660Sstevel@tonic-gate */ 9670Sstevel@tonic-gate ibt_status_t ibt_change_port(ibt_channel_hdl_t rc_chan, uint8_t port_num); 9680Sstevel@tonic-gate 9690Sstevel@tonic-gate 9700Sstevel@tonic-gate /* 9710Sstevel@tonic-gate * SERVICE REGISTRATION FUNCTIONS 9720Sstevel@tonic-gate */ 9730Sstevel@tonic-gate 9740Sstevel@tonic-gate /* 9750Sstevel@tonic-gate * ibt_register_service() 9760Sstevel@tonic-gate * ibt_deregister_service() 9770Sstevel@tonic-gate * Register/deregister a Service (range of Service IDs) with the IBTF. 9780Sstevel@tonic-gate * 9790Sstevel@tonic-gate * ibt_bind_service() 9800Sstevel@tonic-gate * ibt_unbind_service() 9810Sstevel@tonic-gate * ibt_unbind_all_services() 9820Sstevel@tonic-gate * Bind a Service to a given port (GID), and optionally create 9830Sstevel@tonic-gate * service record(s) with the SA for ibt_get_paths() to find. 9840Sstevel@tonic-gate */ 9850Sstevel@tonic-gate ibt_status_t ibt_register_service(ibt_clnt_hdl_t ibt_hdl, 9860Sstevel@tonic-gate ibt_srv_desc_t *service, ib_svc_id_t sid, int num_sids, 9870Sstevel@tonic-gate ibt_srv_hdl_t *srv_hdl_p, ib_svc_id_t *ret_sid_p); 9880Sstevel@tonic-gate 9890Sstevel@tonic-gate ibt_status_t ibt_deregister_service(ibt_clnt_hdl_t ibt_hdl, 9900Sstevel@tonic-gate ibt_srv_hdl_t srv_hdl); 9910Sstevel@tonic-gate 9920Sstevel@tonic-gate ibt_status_t ibt_bind_service(ibt_srv_hdl_t srv_hdl, ib_gid_t gid, 9930Sstevel@tonic-gate ibt_srv_bind_t *srv_bind, void *cm_private, ibt_sbind_hdl_t *sb_hdl_p); 9940Sstevel@tonic-gate 9950Sstevel@tonic-gate ibt_status_t ibt_unbind_service(ibt_srv_hdl_t srv_hdl, ibt_sbind_hdl_t sb_hdl); 9960Sstevel@tonic-gate ibt_status_t ibt_unbind_all_services(ibt_srv_hdl_t srv_hdl); 9970Sstevel@tonic-gate 9980Sstevel@tonic-gate /* 9990Sstevel@tonic-gate * ibt_cm_delay 10000Sstevel@tonic-gate * A client CM handler/srv_handler function can call this function to 10010Sstevel@tonic-gate * extend its response time to a CM event. 10020Sstevel@tonic-gate * Applicable for RC channels only. 10030Sstevel@tonic-gate */ 10040Sstevel@tonic-gate ibt_status_t ibt_cm_delay(ibt_cmdelay_flags_t flags, void *cm_session_id, 10050Sstevel@tonic-gate clock_t service_time, void *priv_data, ibt_priv_data_len_t priv_data_len); 10060Sstevel@tonic-gate 10070Sstevel@tonic-gate /* 10080Sstevel@tonic-gate * ibt_cm_proceed 10090Sstevel@tonic-gate * 10100Sstevel@tonic-gate * An IBT client calls ibt_cm_proceed() to proceed with a connection that 10110Sstevel@tonic-gate * previously deferred by the client returning IBT_CM_DEFER on a CM handler 10120Sstevel@tonic-gate * callback. CM events that can be deferred and continued with ibt_cm_proceed() 10130Sstevel@tonic-gate * are REQ_RCV, REP_RCV, LAP_RCV, and DREQ_RCV. 10140Sstevel@tonic-gate * 10150Sstevel@tonic-gate * NOTE : 10160Sstevel@tonic-gate * 10170Sstevel@tonic-gate * Typically CM completes processing of a client's CM handler return, with 10180Sstevel@tonic-gate * IBT_CM_DEFER status, before processing of the corresponding ibt_cm_proceed() 10190Sstevel@tonic-gate * is started. However a race exists where by CM may not have completed the 10200Sstevel@tonic-gate * client's handler return processing when ibt_cm_proceed() is called by a 10210Sstevel@tonic-gate * client. In this case ibt_cm_proceed() will block until processing of the 10220Sstevel@tonic-gate * client's CM handler return is complete. 10230Sstevel@tonic-gate * 10240Sstevel@tonic-gate * A client that returns IBT_CM_DEFER from the cm handler must 10250Sstevel@tonic-gate * subsequently make a call to ibt_cm_proceed(). It is illegal to call 10260Sstevel@tonic-gate * ibt_cm_proceed() on a channel that has not had the connection 10270Sstevel@tonic-gate * establishment deferred. 10280Sstevel@tonic-gate * 10290Sstevel@tonic-gate * Client cannot call ibt_cm_proceed from the cm handler. 10300Sstevel@tonic-gate */ 10310Sstevel@tonic-gate ibt_status_t ibt_cm_proceed(ibt_cm_event_type_t event, void *session_id, 10320Sstevel@tonic-gate ibt_cm_status_t status, ibt_cm_proceed_reply_t *cm_event_data, 10330Sstevel@tonic-gate void *priv_data, ibt_priv_data_len_t priv_data_len); 10340Sstevel@tonic-gate 10350Sstevel@tonic-gate /* 10360Sstevel@tonic-gate * ibt_cm_ud_proceed 10370Sstevel@tonic-gate * 10380Sstevel@tonic-gate * An IBT client calls ibt_cm_ud_proceed() to proceed with an 10390Sstevel@tonic-gate * IBT_CM_UD_EVENT_SIDR_REQ UD event that was previously deferred by the 10400Sstevel@tonic-gate * client returning IBT_CM_DEFER on a CM UD handler callback. 10410Sstevel@tonic-gate * NOTE : 10420Sstevel@tonic-gate * 10430Sstevel@tonic-gate * Typically CM completes processing of a client's CM handler return, with 10440Sstevel@tonic-gate * IBT_CM_DEFER status, before processing of the corresponding 10450Sstevel@tonic-gate * ibt_cm_ud_proceed() is started. However a race exists where by CM may not 10460Sstevel@tonic-gate * have completed the client's handler return processing when 10470Sstevel@tonic-gate * ibt_cm_ud_proceed() is called by a client. In this case ibt_cm_ud_proceed() 10480Sstevel@tonic-gate * will block until processing of the client's CM handler return is complete. 10490Sstevel@tonic-gate * 10500Sstevel@tonic-gate * A client that returns IBT_CM_DEFER from the cm handler must 10510Sstevel@tonic-gate * subsequently make a call to ibt_cm_ud_proceed(). It is illegal to call 10520Sstevel@tonic-gate * ibt_cm_ud_proceed() on a channel that has not had the connection 10530Sstevel@tonic-gate * establishment deferred. 10540Sstevel@tonic-gate * 10550Sstevel@tonic-gate * Client cannot call ibt_cm_ud_proceed from the cm handler. 10560Sstevel@tonic-gate */ 10570Sstevel@tonic-gate ibt_status_t ibt_cm_ud_proceed(void *session_id, ibt_channel_hdl_t ud_channel, 10580Sstevel@tonic-gate ibt_cm_status_t status, ibt_redirect_info_t *redirect_infop, 10590Sstevel@tonic-gate void *priv_data, ibt_priv_data_len_t priv_data_len); 10600Sstevel@tonic-gate 10610Sstevel@tonic-gate 10620Sstevel@tonic-gate /* 10630Sstevel@tonic-gate * COMPLETION QUEUES. 10640Sstevel@tonic-gate * 10650Sstevel@tonic-gate * ibt_alloc_cq_sched() 10660Sstevel@tonic-gate * Reserve CQ scheduling class resources 10670Sstevel@tonic-gate * 10680Sstevel@tonic-gate * ibt_free_cq_sched() 10690Sstevel@tonic-gate * Free CQ scheduling class resources 10700Sstevel@tonic-gate */ 10710Sstevel@tonic-gate ibt_status_t ibt_alloc_cq_sched(ibt_hca_hdl_t hca_hdl, 10720Sstevel@tonic-gate ibt_cq_sched_attr_t *attr, ibt_sched_hdl_t *sched_hdl_p); 10730Sstevel@tonic-gate 10740Sstevel@tonic-gate ibt_status_t ibt_free_cq_sched(ibt_hca_hdl_t hca_hdl, 1075*12965SWilliam.Taylor@Oracle.COM ibt_sched_hdl_t sched_hdl); 10760Sstevel@tonic-gate 10770Sstevel@tonic-gate /* 10780Sstevel@tonic-gate * ibt_alloc_cq() 10790Sstevel@tonic-gate * Allocate a completion queue. 10800Sstevel@tonic-gate */ 10810Sstevel@tonic-gate ibt_status_t ibt_alloc_cq(ibt_hca_hdl_t hca_hdl, ibt_cq_attr_t *cq_attr, 10820Sstevel@tonic-gate ibt_cq_hdl_t *ibt_cq_p, uint_t *real_size); 10830Sstevel@tonic-gate 10840Sstevel@tonic-gate /* 10850Sstevel@tonic-gate * ibt_free_cq() 10860Sstevel@tonic-gate * Free allocated CQ resources. 10870Sstevel@tonic-gate */ 10880Sstevel@tonic-gate ibt_status_t ibt_free_cq(ibt_cq_hdl_t ibt_cq); 10890Sstevel@tonic-gate 10900Sstevel@tonic-gate 10910Sstevel@tonic-gate /* 10920Sstevel@tonic-gate * ibt_enable_cq_notify() 10930Sstevel@tonic-gate * Enable notification requests on the specified CQ. 10940Sstevel@tonic-gate * Applicable for both RC and UD channels. 10950Sstevel@tonic-gate * 10960Sstevel@tonic-gate * Completion notifications are disabled by setting the completion 10970Sstevel@tonic-gate * handler to NULL by calling ibt_set_cq_handler(). 10980Sstevel@tonic-gate */ 10990Sstevel@tonic-gate ibt_status_t ibt_enable_cq_notify(ibt_cq_hdl_t ibt_cq, 11000Sstevel@tonic-gate ibt_cq_notify_flags_t notify_type); 11010Sstevel@tonic-gate 11020Sstevel@tonic-gate /* 11030Sstevel@tonic-gate * ibt_set_cq_handler() 11040Sstevel@tonic-gate * Register a work request completion handler with the IBTF. 11050Sstevel@tonic-gate * Applicable for both RC and UD channels. 11060Sstevel@tonic-gate * 11070Sstevel@tonic-gate * Completion notifications are disabled by setting the completion 11080Sstevel@tonic-gate * handler to NULL. When setting the handler to NULL, no additional 11090Sstevel@tonic-gate * calls to the CQ handler will be initiated. 11100Sstevel@tonic-gate * 11110Sstevel@tonic-gate * This function does not otherwise change the state of previous 11120Sstevel@tonic-gate * calls to ibt_enable_cq_notify(). 11130Sstevel@tonic-gate */ 11140Sstevel@tonic-gate void ibt_set_cq_handler(ibt_cq_hdl_t ibt_cq, 11150Sstevel@tonic-gate ibt_cq_handler_t completion_handler, void *arg); 11160Sstevel@tonic-gate 11170Sstevel@tonic-gate /* 11180Sstevel@tonic-gate * ibt_poll_cq() 11190Sstevel@tonic-gate * Poll the specified CQ for the completion of work requests (WRs). 11200Sstevel@tonic-gate * If the CQ contains completed WRs, up to num_wc of them are returned. 11210Sstevel@tonic-gate * Applicable for both RC and UD channels. 11220Sstevel@tonic-gate */ 11230Sstevel@tonic-gate ibt_status_t ibt_poll_cq(ibt_cq_hdl_t ibt_cq, ibt_wc_t *work_completions, 11240Sstevel@tonic-gate uint_t num_wc, uint_t *num_polled); 11250Sstevel@tonic-gate 11260Sstevel@tonic-gate /* 11270Sstevel@tonic-gate * ibt_query_cq() 11280Sstevel@tonic-gate * Return the total number of entries in the CQ. 11290Sstevel@tonic-gate */ 11308580SBill.Taylor@Sun.COM ibt_status_t ibt_query_cq(ibt_cq_hdl_t ibt_cq, uint_t *entries, 11318580SBill.Taylor@Sun.COM uint_t *count_p, uint_t *usec_p, ibt_cq_handler_id_t *hid_p); 11320Sstevel@tonic-gate 11330Sstevel@tonic-gate /* 1134*12965SWilliam.Taylor@Oracle.COM * ibt_query_cq_handler_id() 1135*12965SWilliam.Taylor@Oracle.COM * Return interrupt characteristics of the CQ handler 1136*12965SWilliam.Taylor@Oracle.COM */ 1137*12965SWilliam.Taylor@Oracle.COM ibt_status_t ibt_query_cq_handler_id(ibt_hca_hdl_t hca_hdl, 1138*12965SWilliam.Taylor@Oracle.COM ibt_cq_handler_id_t hid, ibt_cq_handler_attr_t *attrs); 1139*12965SWilliam.Taylor@Oracle.COM 1140*12965SWilliam.Taylor@Oracle.COM /* 11410Sstevel@tonic-gate * ibt_resize_cq() 11420Sstevel@tonic-gate * Change the size of a CQ. 11430Sstevel@tonic-gate */ 11440Sstevel@tonic-gate ibt_status_t ibt_resize_cq(ibt_cq_hdl_t ibt_cq, uint_t new_sz, uint_t *real_sz); 11450Sstevel@tonic-gate 11460Sstevel@tonic-gate /* 11478580SBill.Taylor@Sun.COM * ibt_modify_cq() 11488580SBill.Taylor@Sun.COM * Change the interrupt moderation values of a CQ. 11498580SBill.Taylor@Sun.COM * "count" is number of completions before interrupting. 11508580SBill.Taylor@Sun.COM * "usec" is the number of microseconds before interrupting. 11518580SBill.Taylor@Sun.COM */ 11528580SBill.Taylor@Sun.COM ibt_status_t ibt_modify_cq(ibt_cq_hdl_t ibt_cq, uint_t count, uint_t usec, 11538580SBill.Taylor@Sun.COM ibt_cq_handler_id_t hid); 11548580SBill.Taylor@Sun.COM 11558580SBill.Taylor@Sun.COM /* 11560Sstevel@tonic-gate * ibt_set_cq_private() 11570Sstevel@tonic-gate * ibt_get_cq_private() 11580Sstevel@tonic-gate * Set/get the client private data. 11590Sstevel@tonic-gate */ 11600Sstevel@tonic-gate void ibt_set_cq_private(ibt_cq_hdl_t ibt_cq, void *clnt_private); 11610Sstevel@tonic-gate void *ibt_get_cq_private(ibt_cq_hdl_t ibt_cq); 11620Sstevel@tonic-gate 11630Sstevel@tonic-gate 11640Sstevel@tonic-gate /* 11650Sstevel@tonic-gate * Memory Management Functions. 11660Sstevel@tonic-gate * Applicable for both RC and UD channels. 11670Sstevel@tonic-gate * 11680Sstevel@tonic-gate * ibt_register_mr() 11690Sstevel@tonic-gate * Prepares a virtually addressed memory region for use by a HCA. A 11700Sstevel@tonic-gate * description of the registered memory suitable for use in Work Requests 11710Sstevel@tonic-gate * (WRs) is returned in the ibt_mr_desc_t parameter. 11720Sstevel@tonic-gate * 11730Sstevel@tonic-gate * ibt_register_buf() 11740Sstevel@tonic-gate * Prepares a memory region described by a buf(9S) struct for use by a 11750Sstevel@tonic-gate * HCA. A description of the registered memory suitable for use in 11760Sstevel@tonic-gate * Work Requests (WRs) is returned in the ibt_mr_desc_t parameter. 11770Sstevel@tonic-gate * 11780Sstevel@tonic-gate * ibt_query_mr() 11790Sstevel@tonic-gate * Retrieves information about a specified memory region. 11800Sstevel@tonic-gate * 11810Sstevel@tonic-gate * ibt_deregister_mr() 11820Sstevel@tonic-gate * Remove a memory region from a HCA translation table, and free all 11830Sstevel@tonic-gate * resources associated with the memory region. 11840Sstevel@tonic-gate * 11850Sstevel@tonic-gate * ibt_reregister_mr() 11860Sstevel@tonic-gate * ibt_reregister_buf() 11870Sstevel@tonic-gate * Modify the attributes of an existing memory region. 11880Sstevel@tonic-gate * 11890Sstevel@tonic-gate * ibt_register_shared_mr() 11900Sstevel@tonic-gate * Given an existing memory region, a new memory region associated with 11910Sstevel@tonic-gate * the same physical locations is created. 11920Sstevel@tonic-gate * 11930Sstevel@tonic-gate * ibt_sync_mr() 11940Sstevel@tonic-gate * Sync a memory region for either RDMA reads or RDMA writes 11950Sstevel@tonic-gate * 11960Sstevel@tonic-gate * ibt_alloc_mw() 11970Sstevel@tonic-gate * Allocate a memory window. 11980Sstevel@tonic-gate * 11990Sstevel@tonic-gate * ibt_query_mw() 12000Sstevel@tonic-gate * Retrieves information about a specified memory window. 12010Sstevel@tonic-gate * 12020Sstevel@tonic-gate * ibt_free_mw() 12030Sstevel@tonic-gate * De-allocate the Memory Window. 12040Sstevel@tonic-gate */ 12050Sstevel@tonic-gate ibt_status_t ibt_register_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd, 12060Sstevel@tonic-gate ibt_mr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc); 12070Sstevel@tonic-gate 12080Sstevel@tonic-gate ibt_status_t ibt_register_buf(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd, 12090Sstevel@tonic-gate ibt_smr_attr_t *mem_bpattr, struct buf *bp, ibt_mr_hdl_t *mr_hdl_p, 12100Sstevel@tonic-gate ibt_mr_desc_t *mem_desc); 12110Sstevel@tonic-gate 12120Sstevel@tonic-gate ibt_status_t ibt_query_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl, 12130Sstevel@tonic-gate ibt_mr_query_attr_t *attr); 12140Sstevel@tonic-gate 12150Sstevel@tonic-gate ibt_status_t ibt_deregister_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl); 12160Sstevel@tonic-gate 12170Sstevel@tonic-gate ibt_status_t ibt_reregister_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl, 12180Sstevel@tonic-gate ibt_pd_hdl_t pd, ibt_mr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p, 12190Sstevel@tonic-gate ibt_mr_desc_t *mem_desc); 12200Sstevel@tonic-gate 12210Sstevel@tonic-gate ibt_status_t ibt_reregister_buf(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl, 12220Sstevel@tonic-gate ibt_pd_hdl_t pd, ibt_smr_attr_t *mem_bpattr, struct buf *bp, 12230Sstevel@tonic-gate ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc); 12240Sstevel@tonic-gate 12250Sstevel@tonic-gate ibt_status_t ibt_register_shared_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl, 12260Sstevel@tonic-gate ibt_pd_hdl_t pd, ibt_smr_attr_t *mem_sattr, ibt_mr_hdl_t *mr_hdl_p, 12270Sstevel@tonic-gate ibt_mr_desc_t *mem_desc); 12280Sstevel@tonic-gate 12290Sstevel@tonic-gate ibt_status_t ibt_sync_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_sync_t *mr_segments, 12300Sstevel@tonic-gate size_t num_segments); 12310Sstevel@tonic-gate 12320Sstevel@tonic-gate ibt_status_t ibt_alloc_mw(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd, 12330Sstevel@tonic-gate ibt_mw_flags_t flags, ibt_mw_hdl_t *mw_hdl_p, ibt_rkey_t *rkey); 12340Sstevel@tonic-gate 12350Sstevel@tonic-gate ibt_status_t ibt_query_mw(ibt_hca_hdl_t hca_hdl, ibt_mw_hdl_t mw_hdl, 12360Sstevel@tonic-gate ibt_mw_query_attr_t *mw_attr_p); 12370Sstevel@tonic-gate 12380Sstevel@tonic-gate ibt_status_t ibt_free_mw(ibt_hca_hdl_t hca_hdl, ibt_mw_hdl_t mw_hdl); 12390Sstevel@tonic-gate 12400Sstevel@tonic-gate /* 12410Sstevel@tonic-gate * ibt_alloc_lkey() 12420Sstevel@tonic-gate * Allocates physical buffer list resources for use in memory 12430Sstevel@tonic-gate * registrations. 12440Sstevel@tonic-gate * 12450Sstevel@tonic-gate * Applicable for both RC and UD channels. 12460Sstevel@tonic-gate */ 12470Sstevel@tonic-gate ibt_status_t ibt_alloc_lkey(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd, 12480Sstevel@tonic-gate ibt_lkey_flags_t flags, uint_t phys_buf_list_sz, ibt_mr_hdl_t *mr_p, 12490Sstevel@tonic-gate ibt_pmr_desc_t *mem_desc_p); 12500Sstevel@tonic-gate 12510Sstevel@tonic-gate 12520Sstevel@tonic-gate /* 12530Sstevel@tonic-gate * Physical Memory Management Functions. 12540Sstevel@tonic-gate * Applicable for both RC and UD channels. 12550Sstevel@tonic-gate * 12560Sstevel@tonic-gate * ibt_register_phys_mr() 12570Sstevel@tonic-gate * Prepares a physically addressed memory region for use by a HCA. 12580Sstevel@tonic-gate * 12590Sstevel@tonic-gate * ibt_reregister_phys_mr() 12600Sstevel@tonic-gate * Modify the attributes of an existing memory region. 12610Sstevel@tonic-gate */ 12620Sstevel@tonic-gate ibt_status_t ibt_register_phys_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd, 12630Sstevel@tonic-gate ibt_pmr_attr_t *mem_pattr, ibt_mr_hdl_t *mr_hdl_p, 12640Sstevel@tonic-gate ibt_pmr_desc_t *mem_desc_p); 12650Sstevel@tonic-gate 12660Sstevel@tonic-gate ibt_status_t ibt_reregister_phys_mr(ibt_hca_hdl_t hca_hdl, ibt_mr_hdl_t mr_hdl, 12670Sstevel@tonic-gate ibt_pd_hdl_t pd, ibt_pmr_attr_t *mem_pattr, ibt_mr_hdl_t *mr_hdl_p, 12680Sstevel@tonic-gate ibt_pmr_desc_t *mem_desc_p); 12690Sstevel@tonic-gate 12700Sstevel@tonic-gate 12710Sstevel@tonic-gate /* 1272*12965SWilliam.Taylor@Oracle.COM * Register DMA Memory Region 1273*12965SWilliam.Taylor@Oracle.COM */ 1274*12965SWilliam.Taylor@Oracle.COM ibt_status_t ibt_register_dma_mr(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd, 1275*12965SWilliam.Taylor@Oracle.COM ibt_dmr_attr_t *mem_attr, ibt_mr_hdl_t *mr_hdl_p, ibt_mr_desc_t *mem_desc); 1276*12965SWilliam.Taylor@Oracle.COM 1277*12965SWilliam.Taylor@Oracle.COM 1278*12965SWilliam.Taylor@Oracle.COM /* 12790Sstevel@tonic-gate * Address Translation. 12800Sstevel@tonic-gate */ 12810Sstevel@tonic-gate 12820Sstevel@tonic-gate /* 12830Sstevel@tonic-gate * ibt_map_mem_area() 12840Sstevel@tonic-gate * Translate a kernel virtual address range into HCA physical addresses. 12850Sstevel@tonic-gate * A set of physical addresses, that can be used with "Reserved L_Key", 12860Sstevel@tonic-gate * register physical, and "Fast Registration Work Request" operations 12870Sstevel@tonic-gate * is returned. 12880Sstevel@tonic-gate */ 12890Sstevel@tonic-gate ibt_status_t ibt_map_mem_area(ibt_hca_hdl_t hca_hdl, ibt_va_attr_t *va_attrs, 129011972SBill.Taylor@Sun.COM uint_t paddr_list_len, ibt_reg_req_t *reg_req, ibt_ma_hdl_t *ma_hdl_p); 12910Sstevel@tonic-gate 12920Sstevel@tonic-gate /* 12930Sstevel@tonic-gate * ibt_unmap_mem_area() 12940Sstevel@tonic-gate * Un pin physical pages pinned during an ibt_map_mem_area() call. 12950Sstevel@tonic-gate */ 12960Sstevel@tonic-gate ibt_status_t ibt_unmap_mem_area(ibt_hca_hdl_t hca_hdl, ibt_ma_hdl_t ma_hdl); 12970Sstevel@tonic-gate 12988580SBill.Taylor@Sun.COM /* ibt_map_mem_iov() */ 12998580SBill.Taylor@Sun.COM ibt_status_t ibt_map_mem_iov(ibt_hca_hdl_t hca_hdl, 13008580SBill.Taylor@Sun.COM ibt_iov_attr_t *iov_attr, ibt_all_wr_t *wr, ibt_mi_hdl_t *mi_hdl); 13018580SBill.Taylor@Sun.COM 13028580SBill.Taylor@Sun.COM /* ibt_unmap_mem_iov() */ 13038580SBill.Taylor@Sun.COM ibt_status_t ibt_unmap_mem_iov(ibt_hca_hdl_t hca_hdl, ibt_mi_hdl_t mi_hdl); 13048580SBill.Taylor@Sun.COM 13050Sstevel@tonic-gate /* 13060Sstevel@tonic-gate * Work Request Functions 13070Sstevel@tonic-gate * Applicable for RC and UD channels. 13080Sstevel@tonic-gate * 13090Sstevel@tonic-gate * ibt_post_send() 13100Sstevel@tonic-gate * Post send work requests to the specified channel. 13110Sstevel@tonic-gate * 13120Sstevel@tonic-gate * ibt_post_recv() 13130Sstevel@tonic-gate * ibt_post_srq() 13140Sstevel@tonic-gate * Post receive work requests to the specified channel. 13150Sstevel@tonic-gate */ 13160Sstevel@tonic-gate ibt_status_t ibt_post_send(ibt_channel_hdl_t chan, ibt_send_wr_t *wr_list, 13170Sstevel@tonic-gate uint_t num_wr, uint_t *posted); 13180Sstevel@tonic-gate 13190Sstevel@tonic-gate ibt_status_t ibt_post_recv(ibt_channel_hdl_t chan, ibt_recv_wr_t *wr_list, 13200Sstevel@tonic-gate uint_t num_wr, uint_t *posted); 13210Sstevel@tonic-gate 13220Sstevel@tonic-gate ibt_status_t ibt_post_srq(ibt_srq_hdl_t srq, ibt_recv_wr_t *wr_list, 13230Sstevel@tonic-gate uint_t num_wr, uint_t *posted); 13240Sstevel@tonic-gate 13250Sstevel@tonic-gate 13260Sstevel@tonic-gate /* 13270Sstevel@tonic-gate * Alternate Path Migration Functions. 13280Sstevel@tonic-gate * Applicable for RC channels only. 13290Sstevel@tonic-gate * 13300Sstevel@tonic-gate * 13310Sstevel@tonic-gate * ibt_get_alt_path() 13320Sstevel@tonic-gate * Finds the best alternate path to a specified channel (as determined by 13330Sstevel@tonic-gate * the IBTL) that satisfies the requirements specified in an 13340Sstevel@tonic-gate * ibt_alt_path_attr_t struct. The specified channel must have been 13350Sstevel@tonic-gate * previously opened successfully using ibt_open_rc_channel. 13360Sstevel@tonic-gate * This function also ensures that the service being accessed by the 13370Sstevel@tonic-gate * channel is available at the selected alternate port. 13380Sstevel@tonic-gate * 13390Sstevel@tonic-gate * Note: The apa_dgid must be on the same destination channel adapter, 13400Sstevel@tonic-gate * if specified. 13410Sstevel@tonic-gate * 13420Sstevel@tonic-gate * 13430Sstevel@tonic-gate * ibt_set_alt_path() 13440Sstevel@tonic-gate * Load the specified alternate path. Causes the CM to send an LAP message 13450Sstevel@tonic-gate * to the remote node. If successful, the local channel is updated with 13460Sstevel@tonic-gate * the new alternate path and the channel migration state is set to REARM. 13470Sstevel@tonic-gate * Can only be called on a previously opened RC channel. The channel must 13480Sstevel@tonic-gate * be either in RTS or paused state. 13490Sstevel@tonic-gate * 13500Sstevel@tonic-gate * 13510Sstevel@tonic-gate * ibt_migrate_path() 13520Sstevel@tonic-gate * Force the CI to use the alternate path. The alternate path becomes 13530Sstevel@tonic-gate * the primary path. A new alternate path should be loaded and enabled. 13540Sstevel@tonic-gate */ 13550Sstevel@tonic-gate ibt_status_t ibt_get_alt_path(ibt_channel_hdl_t rc_chan, ibt_path_flags_t flags, 13560Sstevel@tonic-gate ibt_alt_path_attr_t *attr, ibt_alt_path_info_t *alt_pathp); 13570Sstevel@tonic-gate 13580Sstevel@tonic-gate ibt_status_t ibt_set_alt_path(ibt_channel_hdl_t rc_chan, 13590Sstevel@tonic-gate ibt_execution_mode_t mode, ibt_alt_path_info_t *alt_pinfo, void *priv_data, 13600Sstevel@tonic-gate ibt_priv_data_len_t priv_data_len, ibt_ap_returns_t *ret_args); 13610Sstevel@tonic-gate 13620Sstevel@tonic-gate ibt_status_t ibt_migrate_path(ibt_channel_hdl_t rc_chan); 13630Sstevel@tonic-gate 13640Sstevel@tonic-gate 13650Sstevel@tonic-gate /* 13660Sstevel@tonic-gate * Multicast group Functions. 13670Sstevel@tonic-gate * Applicable for UD channels only. 13680Sstevel@tonic-gate */ 13690Sstevel@tonic-gate 13700Sstevel@tonic-gate /* 13710Sstevel@tonic-gate * ibt_attach_mcg() 13720Sstevel@tonic-gate * Attaches a UD channel to the specified multicast group. On successful 13730Sstevel@tonic-gate * completion, this channel will be provided with a copy of every 13740Sstevel@tonic-gate * multicast message addressed to the group specified by the MGID 13750Sstevel@tonic-gate * (mcg_info->mc_adds_vect.av_dgid) and received on the HCA port with 13760Sstevel@tonic-gate * which the channel is associated. 13770Sstevel@tonic-gate */ 13780Sstevel@tonic-gate ibt_status_t ibt_attach_mcg(ibt_channel_hdl_t ud_chan, 13790Sstevel@tonic-gate ibt_mcg_info_t *mcg_info); 13800Sstevel@tonic-gate 13810Sstevel@tonic-gate /* 13820Sstevel@tonic-gate * ibt_detach_mcg() 13830Sstevel@tonic-gate * Detach the specified UD channel from the specified multicast group. 13840Sstevel@tonic-gate */ 13850Sstevel@tonic-gate ibt_status_t ibt_detach_mcg(ibt_channel_hdl_t ud_chan, 13860Sstevel@tonic-gate ibt_mcg_info_t *mcg_info); 13870Sstevel@tonic-gate 13880Sstevel@tonic-gate /* 13890Sstevel@tonic-gate * ibt_join_mcg() 13900Sstevel@tonic-gate * Join a multicast group. The first full member "join" causes the MCG 13910Sstevel@tonic-gate * to be created. 13920Sstevel@tonic-gate */ 13930Sstevel@tonic-gate ibt_status_t ibt_join_mcg(ib_gid_t rgid, ibt_mcg_attr_t *mcg_attr, 13940Sstevel@tonic-gate ibt_mcg_info_t *mcg_info_p, ibt_mcg_handler_t func, void *arg); 13950Sstevel@tonic-gate 13960Sstevel@tonic-gate /* 13970Sstevel@tonic-gate * ibt_leave_mcg() 13980Sstevel@tonic-gate * The port associated with the port GID shall be removed from the 13990Sstevel@tonic-gate * multicast group specified by MGID (mc_gid) or from all the multicast 14000Sstevel@tonic-gate * groups of which it is a member if the MGID (mc_gid) is not specified 14010Sstevel@tonic-gate * (i.e. mc_gid.mgid_prefix must have 8-bits of 11111111 at the start of 14020Sstevel@tonic-gate * the GID to identify this as being a multicast GID). 14030Sstevel@tonic-gate * 14040Sstevel@tonic-gate * The last full member to leave causes the destruction of the Multicast 14050Sstevel@tonic-gate * Group. 14060Sstevel@tonic-gate */ 14070Sstevel@tonic-gate ibt_status_t ibt_leave_mcg(ib_gid_t rgid, ib_gid_t mc_gid, ib_gid_t port_gid, 14080Sstevel@tonic-gate uint8_t mc_join_state); 14090Sstevel@tonic-gate 14100Sstevel@tonic-gate /* 14110Sstevel@tonic-gate * ibt_query_mcg() 14120Sstevel@tonic-gate * Request information on multicast groups that match the parameters 14130Sstevel@tonic-gate * specified in mcg_attr. Information on each multicast group is returned 14140Sstevel@tonic-gate * to the caller in the form of an array of ibt_mcg_info_t. 14150Sstevel@tonic-gate * ibt_query_mcg() allocates the memory for this array and returns a 14160Sstevel@tonic-gate * pointer to the array (mcgs_p) and the number of entries in the array 14170Sstevel@tonic-gate * (entries_p). This memory should be freed by the client using 14180Sstevel@tonic-gate * ibt_free_mcg_info(). 14190Sstevel@tonic-gate */ 14200Sstevel@tonic-gate ibt_status_t ibt_query_mcg(ib_gid_t rgid, ibt_mcg_attr_t *mcg_attr, 14210Sstevel@tonic-gate uint_t mcgs_max_num, ibt_mcg_info_t **mcgs_info_p, uint_t *entries_p); 14220Sstevel@tonic-gate 14230Sstevel@tonic-gate /* 14240Sstevel@tonic-gate * ibt_free_mcg_info() 14250Sstevel@tonic-gate * Free the memory allocated by successful ibt_query_mcg() 14260Sstevel@tonic-gate */ 14270Sstevel@tonic-gate void ibt_free_mcg_info(ibt_mcg_info_t *mcgs_info, uint_t entries); 14280Sstevel@tonic-gate 14290Sstevel@tonic-gate 14300Sstevel@tonic-gate /* 14310Sstevel@tonic-gate * ibt_register_subnet_notices() 14320Sstevel@tonic-gate * Register a handler to be called for subnet notifications. 14330Sstevel@tonic-gate */ 14340Sstevel@tonic-gate void ibt_register_subnet_notices(ibt_clnt_hdl_t ibt_hdl, 14350Sstevel@tonic-gate ibt_sm_notice_handler_t sm_notice_handler, void *private); 14360Sstevel@tonic-gate 14370Sstevel@tonic-gate 14380Sstevel@tonic-gate /* 14390Sstevel@tonic-gate * Protection Domain Functions. 14400Sstevel@tonic-gate * 14410Sstevel@tonic-gate * ibt_alloc_pd() 14420Sstevel@tonic-gate * ibt_free_pd() 14430Sstevel@tonic-gate * Allocate/Release a protection domain 14440Sstevel@tonic-gate */ 14450Sstevel@tonic-gate ibt_status_t ibt_alloc_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_flags_t flags, 14460Sstevel@tonic-gate ibt_pd_hdl_t *pd); 14470Sstevel@tonic-gate ibt_status_t ibt_free_pd(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd); 14480Sstevel@tonic-gate 14490Sstevel@tonic-gate /* 14500Sstevel@tonic-gate * P_Key to P_Key Index conversion Functions. 14510Sstevel@tonic-gate * 14520Sstevel@tonic-gate * ibt_pkey2index_byguid 14530Sstevel@tonic-gate * ibt_pkey2index Convert a P_Key into a P_Key index. 14540Sstevel@tonic-gate * 14550Sstevel@tonic-gate * ibt_index2pkey_byguid 14560Sstevel@tonic-gate * ibt_index2pkey Convert a P_Key Index into a P_Key. 14570Sstevel@tonic-gate */ 14580Sstevel@tonic-gate ibt_status_t ibt_pkey2index(ibt_hca_hdl_t hca_hdl, uint8_t port_num, 14590Sstevel@tonic-gate ib_pkey_t pkey, uint16_t *pkey_ix); 14600Sstevel@tonic-gate 14610Sstevel@tonic-gate ibt_status_t ibt_index2pkey(ibt_hca_hdl_t hca_hdl, uint8_t port_num, 14620Sstevel@tonic-gate uint16_t pkey_ix, ib_pkey_t *pkey); 14630Sstevel@tonic-gate 14640Sstevel@tonic-gate ibt_status_t ibt_pkey2index_byguid(ib_guid_t hca_guid, uint8_t port_num, 14650Sstevel@tonic-gate ib_pkey_t pkey, uint16_t *pkey_ix); 14660Sstevel@tonic-gate 14670Sstevel@tonic-gate ibt_status_t ibt_index2pkey_byguid(ib_guid_t hca_guid, uint8_t port_num, 14680Sstevel@tonic-gate uint16_t pkey_ix, ib_pkey_t *pkey); 14690Sstevel@tonic-gate 14700Sstevel@tonic-gate /* 14710Sstevel@tonic-gate * ibt_ci_data_in() 14720Sstevel@tonic-gate * 14730Sstevel@tonic-gate * Pass CI specific userland data for CI objects to the CI. 14740Sstevel@tonic-gate */ 14750Sstevel@tonic-gate ibt_status_t ibt_ci_data_in(ibt_hca_hdl_t hca, ibt_ci_data_flags_t flags, 14760Sstevel@tonic-gate ibt_object_type_t object, void *ibt_object_handle, void *data_p, 14770Sstevel@tonic-gate size_t data_sz); 14780Sstevel@tonic-gate 14790Sstevel@tonic-gate /* 14800Sstevel@tonic-gate * ibt_ci_data_out() 14810Sstevel@tonic-gate * 14820Sstevel@tonic-gate * Obtain CI specific userland data for CI objects. 14830Sstevel@tonic-gate */ 14840Sstevel@tonic-gate ibt_status_t ibt_ci_data_out(ibt_hca_hdl_t hca, ibt_ci_data_flags_t flags, 14850Sstevel@tonic-gate ibt_object_type_t object, void *ibt_object_handle, void *data_p, 14860Sstevel@tonic-gate size_t data_sz); 14870Sstevel@tonic-gate 14880Sstevel@tonic-gate 14890Sstevel@tonic-gate /* 14900Sstevel@tonic-gate * Node Information. 14910Sstevel@tonic-gate */ 14920Sstevel@tonic-gate 14930Sstevel@tonic-gate /* Node type : n_node_type */ 14940Sstevel@tonic-gate #define IBT_NODE_TYPE_CHANNEL_ADAPTER 1 /* HCA or TCA */ 14950Sstevel@tonic-gate #define IBT_NODE_TYPE_SWITCH 2 14960Sstevel@tonic-gate #define IBT_NODE_TYPE_ROUTER 3 14970Sstevel@tonic-gate 14980Sstevel@tonic-gate typedef struct ibt_node_info_s { 14990Sstevel@tonic-gate ib_guid_t n_sys_img_guid; /* System Image GUID */ 15000Sstevel@tonic-gate ib_guid_t n_node_guid; /* Node GUID */ 15010Sstevel@tonic-gate ib_guid_t n_port_guid; /* Port GUID */ 15020Sstevel@tonic-gate uint16_t n_dev_id; /* Device ID */ 15030Sstevel@tonic-gate uint32_t n_revision; /* Device Revision */ 15040Sstevel@tonic-gate uint32_t n_vendor_id:24; /* Device Vendor ID */ 15050Sstevel@tonic-gate uint8_t n_num_ports; /* Number of ports on this node. */ 15060Sstevel@tonic-gate uint8_t n_port_num; /* Port number. */ 15070Sstevel@tonic-gate uint8_t n_node_type; /* Node type */ 15080Sstevel@tonic-gate char n_description[64]; /* NULL terminated ASCII string */ 15090Sstevel@tonic-gate } ibt_node_info_t; 15100Sstevel@tonic-gate 15110Sstevel@tonic-gate 15120Sstevel@tonic-gate /* 15130Sstevel@tonic-gate * ibt_gid_to_node_info() 15140Sstevel@tonic-gate * Retrieve node information for the specified GID. 15150Sstevel@tonic-gate */ 15160Sstevel@tonic-gate ibt_status_t ibt_gid_to_node_info(ib_gid_t gid, ibt_node_info_t *node_info_p); 15170Sstevel@tonic-gate 15180Sstevel@tonic-gate /* 15190Sstevel@tonic-gate * ibt_reprobe_dev 15200Sstevel@tonic-gate * Reprobe properties for IOC device node. 15210Sstevel@tonic-gate */ 15220Sstevel@tonic-gate ibt_status_t ibt_reprobe_dev(dev_info_t *dip); 15230Sstevel@tonic-gate 15240Sstevel@tonic-gate /* 15250Sstevel@tonic-gate * ibt_get_companion_port_gids() 15260Sstevel@tonic-gate * 15270Sstevel@tonic-gate * Get list of GID's available on a companion port(s) of the specified 15280Sstevel@tonic-gate * GID or list of GIDs available on a specified Node GUID/System Image 15290Sstevel@tonic-gate * GUID. 15300Sstevel@tonic-gate */ 15310Sstevel@tonic-gate ibt_status_t ibt_get_companion_port_gids(ib_gid_t gid, ib_guid_t hca_guid, 15320Sstevel@tonic-gate ib_guid_t sysimg_guid, ib_gid_t **gids_p, uint_t *num_gids_p); 15330Sstevel@tonic-gate 15340Sstevel@tonic-gate /* 15350Sstevel@tonic-gate * SHARED RECEIVE QUEUE 15360Sstevel@tonic-gate */ 15370Sstevel@tonic-gate 15380Sstevel@tonic-gate 15390Sstevel@tonic-gate /* 15400Sstevel@tonic-gate * ibt_alloc_srq() 15410Sstevel@tonic-gate * Allocate a shared receive queue. 15420Sstevel@tonic-gate */ 15430Sstevel@tonic-gate ibt_status_t ibt_alloc_srq(ibt_hca_hdl_t hca_hdl, ibt_srq_flags_t flags, 15440Sstevel@tonic-gate ibt_pd_hdl_t pd, ibt_srq_sizes_t *sizes, ibt_srq_hdl_t *ibt_srq_p, 15450Sstevel@tonic-gate ibt_srq_sizes_t *real_size_p); 15460Sstevel@tonic-gate 15470Sstevel@tonic-gate /* 15480Sstevel@tonic-gate * ibt_free_srq() 15490Sstevel@tonic-gate * Free allocated SRQ resources. 15500Sstevel@tonic-gate */ 15510Sstevel@tonic-gate ibt_status_t ibt_free_srq(ibt_srq_hdl_t ibt_srq); 15520Sstevel@tonic-gate 15530Sstevel@tonic-gate /* 15540Sstevel@tonic-gate * ibt_query_srq() 15550Sstevel@tonic-gate * Query a shared receive queue. 15560Sstevel@tonic-gate */ 15570Sstevel@tonic-gate ibt_status_t ibt_query_srq(ibt_srq_hdl_t ibt_srq, ibt_pd_hdl_t *pd_p, 15580Sstevel@tonic-gate ibt_srq_sizes_t *sizes_p, uint_t *limit_p); 15590Sstevel@tonic-gate 15600Sstevel@tonic-gate /* 15610Sstevel@tonic-gate * ibt_modify_srq() 15620Sstevel@tonic-gate * Modify a shared receive queue. 15630Sstevel@tonic-gate */ 15640Sstevel@tonic-gate ibt_status_t ibt_modify_srq(ibt_srq_hdl_t ibt_srq, ibt_srq_modify_flags_t flags, 15650Sstevel@tonic-gate uint_t size, uint_t limit, uint_t *real_size_p); 15660Sstevel@tonic-gate 15670Sstevel@tonic-gate /* 15680Sstevel@tonic-gate * ibt_set_srq_private() 15690Sstevel@tonic-gate * ibt_get_srq_private() 15700Sstevel@tonic-gate * Set/get the SRQ client private data. 15710Sstevel@tonic-gate */ 15720Sstevel@tonic-gate void ibt_set_srq_private(ibt_srq_hdl_t ibt_srq, void *clnt_private); 15730Sstevel@tonic-gate void *ibt_get_srq_private(ibt_srq_hdl_t ibt_srq); 15740Sstevel@tonic-gate 15750Sstevel@tonic-gate /* 15760Sstevel@tonic-gate * ibt_check_failure() 15770Sstevel@tonic-gate * Function to test for special case failures 15780Sstevel@tonic-gate */ 15790Sstevel@tonic-gate ibt_failure_type_t ibt_check_failure(ibt_status_t status, uint64_t *reserved_p); 15800Sstevel@tonic-gate 15810Sstevel@tonic-gate 15820Sstevel@tonic-gate /* 15830Sstevel@tonic-gate * ibt_hw_is_present() returns 0 when there is no IB hardware actively 15840Sstevel@tonic-gate * running. This is primarily useful for modules like rpcmod which needs a 15850Sstevel@tonic-gate * quick check to decide whether or not it should try to use InfiniBand. 15860Sstevel@tonic-gate */ 15870Sstevel@tonic-gate int ibt_hw_is_present(); 15880Sstevel@tonic-gate 15894703Shiremath /* 15904703Shiremath * Fast Memory Registration (FMR). 15914703Shiremath * 15924703Shiremath * ibt_create_fmr_pool 15934703Shiremath * Not fast-path. 15944703Shiremath * ibt_create_fmr_pool() verifies that the HCA supports FMR and allocates 15954703Shiremath * and initializes an "FMR pool". This pool contains state specific to 15964703Shiremath * this registration, including the watermark setting to determine when 15974703Shiremath * to sync, and the total number of FMR regions available within this pool. 15984703Shiremath * 15994703Shiremath * ibt_destroy_fmr_pool 16004703Shiremath * ibt_destroy_fmr_pool() deallocates all of the FMR regions in a specific 16014703Shiremath * pool. All state and information regarding the pool are destroyed and 16024703Shiremath * returned as free space once again. No more use of FMR regions in this 16034703Shiremath * pool are possible without a subsequent call to ibt_create_fmr_pool(). 16044703Shiremath * 16054703Shiremath * ibt_flush_fmr_pool 16064703Shiremath * ibt_flush_fmr_pool forces a flush to occur. At the client's request, 16074703Shiremath * any unmapped FMR regions (See 'ibt_deregister_mr())') are returned to 16084703Shiremath * a free state. This function allows for an asynchronous cleanup of 16094703Shiremath * formerly used FMR regions. Sync operation is also performed internally 16104703Shiremath * by HCA driver, when 'watermark' settings for the number of free FMR 16114703Shiremath * regions left in the "pool" is reached. 16124703Shiremath * 16134703Shiremath * ibt_register_physical_fmr 16144703Shiremath * ibt_register_physical_fmr() assigns a "free" entry from the FMR Pool. 16154703Shiremath * It first consults the "FMR cache" to see if this is a duplicate memory 16164703Shiremath * registration to something already in use. If not, then a free entry 16174703Shiremath * in the "pool" is marked used. 16184703Shiremath * 16194703Shiremath * ibt_deregister_fmr 16204703Shiremath * The ibt_deregister_fmr un-maps the resources reserved from the FMR 16214703Shiremath * pool by ibt_register_physical_fmr(). The ibt_deregister_fmr() will 16224703Shiremath * mark the region as free in the FMR Pool. 16234703Shiremath */ 16244703Shiremath ibt_status_t ibt_create_fmr_pool(ibt_hca_hdl_t hca_hdl, ibt_pd_hdl_t pd, 16254703Shiremath ibt_fmr_pool_attr_t *fmr_params, ibt_fmr_pool_hdl_t *fmr_pool_p); 16264703Shiremath 16274703Shiremath ibt_status_t ibt_destroy_fmr_pool(ibt_hca_hdl_t hca_hdl, 16284703Shiremath ibt_fmr_pool_hdl_t fmr_pool); 16294703Shiremath 16304703Shiremath ibt_status_t ibt_flush_fmr_pool(ibt_hca_hdl_t hca_hdl, 16314703Shiremath ibt_fmr_pool_hdl_t fmr_pool); 16324703Shiremath 16334703Shiremath ibt_status_t ibt_register_physical_fmr(ibt_hca_hdl_t hca_hdl, 16344703Shiremath ibt_fmr_pool_hdl_t fmr_pool, ibt_pmr_attr_t *mem_pattr, 16354703Shiremath ibt_mr_hdl_t *mr_hdl_p, ibt_pmr_desc_t *mem_desc_p); 16364703Shiremath 16374703Shiremath ibt_status_t ibt_deregister_fmr(ibt_hca_hdl_t hca, ibt_mr_hdl_t mr_hdl); 16384703Shiremath 16394703Shiremath /* 16404703Shiremath * IP SUPPORT 16414703Shiremath */ 16424703Shiremath 16434703Shiremath /* 16444703Shiremath * IP get_paths 16454703Shiremath * Returns an array (or single) of paths and source IP addresses. In the 16464703Shiremath * simplest form just the destination IP address is specified, and one path 16474703Shiremath * is requested, then one ibt_path_info_t struct and one source IP. 16484703Shiremath * 16494703Shiremath * More than one path can be requested to a single destination, in which case 16504703Shiremath * the requested number of ibt_path_info_t's are returned, and the same 16514703Shiremath * number of SRC IP address, with the first SRC IP address corrosponding 16524703Shiremath * to the first ibt_path_info_t, etc. 16534703Shiremath * 16544703Shiremath * Restrictions on the source end point can be specified, in the form of a 16554703Shiremath * source IP address (this implicitly defines the HCA, HCA port and Pkey) 16564703Shiremath * HCA, HCA port, and sgid (implicitly defines HCA and HCA port). 16574703Shiremath * Combinations are allowed but they must be consistent. 16584703Shiremath * 16594703Shiremath * Path attributes can also be specified, these can also affect local HCA 16604703Shiremath * selection. 16614703Shiremath * 16624703Shiremath * ibt_get_ip_paths() internally does (among other things): 16634703Shiremath * 16644703Shiremath * o ibt_get_list_of_ibd_ipaddr_and_macaddr( OUT list_ipaddr_macaddr) 16654703Shiremath * 16664703Shiremath * o extract_pkey_and_sgid(IN list_ipaddr_macaddr, OUT list_pkey_and_sgid) 16674703Shiremath * 16684703Shiremath * o map_dst_ip_addr(IN dst_ip_addr, OUT dst_pkey, OUT dgid) - See Note 16694703Shiremath * 16704703Shiremath * o filter_by_pkey(IN list_pkey_and_sgid, IN dst_pkey, OUT list_of_sgid) 16714703Shiremath * 16724703Shiremath * o do_multipath_query(IN list_of_sgid, IN dst_pkey, IN dgid, OUT path_list) 16734703Shiremath * 16744703Shiremath * o pick_a_good_path(IN path_list, OUT the_path) 16754703Shiremath * 16764703Shiremath * o find_matching_src_ip(IN the_path, IN list_ipaddr_macaddr, OUT src_ip) 16774703Shiremath * 16784703Shiremath * The ibd instance which got the ARP response is only on one P_Key 16794703Shiremath * knowing the ibd instance (or which IPonIB MCG) got the ARP response 16804703Shiremath * determins the P_Key associated with a dgid. If the proposedi "ip2mac()" 16814703Shiremath * API is used to get an IP to GID translations, then returned 'sockaddr_dl' 16824703Shiremath * contains the interface name and index. 16834703Shiremath * 16844703Shiremath * 16854703Shiremath * Example: 16864703Shiremath * ip_path_attr.ipa_dst_ip = dst_ip_addr; 16874703Shiremath * ip_path_attr.ipa_ndst = 1; 16884703Shiremath * ip_path_attr.ipa_max_paths = 1; 16894703Shiremath * 16904703Shiremath * status = ibt_get_ip_paths(clnt_hdl, flags, &ip_path_attr, &paths, 16914703Shiremath * &num_paths_p, &src_ip); 16924703Shiremath * 16934703Shiremath * sid = ibt_get_ip_sid(protocol_num, dst_port); 16944703Shiremath * path_info->sid = sid; 16954703Shiremath * 16964703Shiremath * ip_cm_info.src_addr = src_ip; 16974703Shiremath * ip_cm_info.dst_addr = dst_ip_addr; 16984703Shiremath * ip_cm_info.src_port = src_port 16994703Shiremath * 17004703Shiremath * ibt_format_ip_private_data(ip_cm_info, priv_data_len, &priv_data); 17014703Shiremath * ibt_open_rc_channel(chan, private_data); 17024703Shiremath */ 17034703Shiremath typedef struct ibt_ip_path_attr_s { 17044703Shiremath ibt_ip_addr_t *ipa_dst_ip; /* Required */ 17054703Shiremath ibt_ip_addr_t ipa_src_ip; /* Optional */ 17064703Shiremath ib_guid_t ipa_hca_guid; /* Optional */ 17074703Shiremath uint8_t ipa_hca_port_num; /* Optional */ 17084703Shiremath uint8_t ipa_max_paths; /* Required */ 17094703Shiremath uint8_t ipa_ndst; /* Required */ 17104703Shiremath uint8_t ipa_sl:4; /* Optional */ 17114703Shiremath ibt_mtu_req_t ipa_mtu; /* Optional */ 17124703Shiremath ibt_srate_req_t ipa_srate; /* Optional */ 17134703Shiremath ibt_pkt_lt_req_t ipa_pkt_lt; /* Optional */ 17144703Shiremath uint_t ipa_flow:20; /* Optional */ 17154703Shiremath uint8_t ipa_hop; /* Optional */ 17164703Shiremath uint8_t ipa_tclass; /* Optional */ 1717*12965SWilliam.Taylor@Oracle.COM zoneid_t ipa_zoneid; /* Default 0 = Global Zone */ 17184703Shiremath } ibt_ip_path_attr_t; 17194703Shiremath 17204703Shiremath /* 17214703Shiremath * Path SRC IP addresses 17224703Shiremath */ 17234703Shiremath typedef struct ibt_path_ip_src_s { 17244703Shiremath ibt_ip_addr_t ip_primary; 17254703Shiremath ibt_ip_addr_t ip_alternate; 17264703Shiremath } ibt_path_ip_src_t; 17274703Shiremath 17284703Shiremath 17294703Shiremath ibt_status_t ibt_get_ip_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags, 17304703Shiremath ibt_ip_path_attr_t *attr, ibt_path_info_t *paths_p, uint8_t *num_paths_p, 17314703Shiremath ibt_path_ip_src_t *src_ip_p); 17324703Shiremath 1733*12965SWilliam.Taylor@Oracle.COM /* 1734*12965SWilliam.Taylor@Oracle.COM * ibt_get_src_ip() 1735*12965SWilliam.Taylor@Oracle.COM * Get List of IP-Address that matches the parameters specified in 1736*12965SWilliam.Taylor@Oracle.COM * srcip_attr. As a given MAC address can have both IPv4 and IPv6 1737*12965SWilliam.Taylor@Oracle.COM * addressed configured, caller can optional request to return only 1738*12965SWilliam.Taylor@Oracle.COM * the desired family by specifying the "sip_family" field. If 1739*12965SWilliam.Taylor@Oracle.COM * "sip_family" is AF_UNSPEC, then all assigned IP address (IPv4 1740*12965SWilliam.Taylor@Oracle.COM * and/or IPv6) will be returned. In case of IPv6 address, scope_id 1741*12965SWilliam.Taylor@Oracle.COM * for that specific address will also be returned. 1742*12965SWilliam.Taylor@Oracle.COM * "sip_zoneid" will specify the zones the user is interested in. 1743*12965SWilliam.Taylor@Oracle.COM * 1744*12965SWilliam.Taylor@Oracle.COM * Information on each ip-address is returned to the caller in the 1745*12965SWilliam.Taylor@Oracle.COM * form of an array of ibt_srcip_info_t. ibt_get_src_ip() allocates the 1746*12965SWilliam.Taylor@Oracle.COM * memory for this array and returns a pointer to the array (src_info_p) 1747*12965SWilliam.Taylor@Oracle.COM * and the number of entries in the array (entries_p). This memory 1748*12965SWilliam.Taylor@Oracle.COM * should be freed by the client using ibt_free_srcip_info(). 1749*12965SWilliam.Taylor@Oracle.COM * 1750*12965SWilliam.Taylor@Oracle.COM * ibt_free_srcip_info() 1751*12965SWilliam.Taylor@Oracle.COM * Free the memory allocated by successful ibt_get_src_ip() 1752*12965SWilliam.Taylor@Oracle.COM */ 1753*12965SWilliam.Taylor@Oracle.COM typedef struct ibt_srcip_attr_s { 1754*12965SWilliam.Taylor@Oracle.COM ib_gid_t sip_gid; /* REQUIRED: Local Port GID */ 1755*12965SWilliam.Taylor@Oracle.COM zoneid_t sip_zoneid; /* Zero means Global Zone */ 1756*12965SWilliam.Taylor@Oracle.COM ib_pkey_t sip_pkey; /* Optional */ 1757*12965SWilliam.Taylor@Oracle.COM sa_family_t sip_family; /* Optional : IPv4 or IPv6 */ 1758*12965SWilliam.Taylor@Oracle.COM } ibt_srcip_attr_t; 1759*12965SWilliam.Taylor@Oracle.COM 1760*12965SWilliam.Taylor@Oracle.COM /* 1761*12965SWilliam.Taylor@Oracle.COM * ip_flag : Flag to indicate whether the returned list of ip-address 1762*12965SWilliam.Taylor@Oracle.COM * has any duplicate records. 1763*12965SWilliam.Taylor@Oracle.COM */ 1764*12965SWilliam.Taylor@Oracle.COM #define IBT_IPADDR_NO_FLAGS 0 1765*12965SWilliam.Taylor@Oracle.COM #define IBT_IPADDR_DUPLICATE 1 1766*12965SWilliam.Taylor@Oracle.COM 1767*12965SWilliam.Taylor@Oracle.COM typedef struct ibt_srcip_info_s { 1768*12965SWilliam.Taylor@Oracle.COM ibt_ip_addr_t ip_addr; 1769*12965SWilliam.Taylor@Oracle.COM zoneid_t ip_zoneid; /* ZoneId of this ip-addr */ 1770*12965SWilliam.Taylor@Oracle.COM uint_t ip_flag; /* Flag to indicate any gotchas */ 1771*12965SWilliam.Taylor@Oracle.COM } ibt_srcip_info_t; 1772*12965SWilliam.Taylor@Oracle.COM 1773*12965SWilliam.Taylor@Oracle.COM ibt_status_t ibt_get_src_ip(ibt_srcip_attr_t *srcip_attr, 1774*12965SWilliam.Taylor@Oracle.COM ibt_srcip_info_t **src_info_p, uint_t *entries_p); 1775*12965SWilliam.Taylor@Oracle.COM 1776*12965SWilliam.Taylor@Oracle.COM void ibt_free_srcip_info(ibt_srcip_info_t *src_info, uint_t entries); 1777*12965SWilliam.Taylor@Oracle.COM 17784703Shiremath 17794703Shiremath /* 17804703Shiremath * Callback function that can be used in ibt_aget_ip_paths(), a Non-Blocking 17814703Shiremath * version of ibt_get_ip_paths(). 17824703Shiremath */ 17834703Shiremath typedef void (*ibt_ip_path_handler_t)(void *arg, ibt_status_t retval, 17844703Shiremath ibt_path_info_t *paths_p, uint8_t num_paths, ibt_path_ip_src_t *src_ip_p); 17854703Shiremath 17864703Shiremath /* 17874703Shiremath * Find path(s) to a given destination or service asynchronously. 17884703Shiremath * ibt_aget_ip_paths() is a Non-Blocking version of ibt_get_ip_paths(). 17894703Shiremath */ 17904703Shiremath ibt_status_t ibt_aget_ip_paths(ibt_clnt_hdl_t ibt_hdl, ibt_path_flags_t flags, 17914703Shiremath ibt_ip_path_attr_t *attr, ibt_ip_path_handler_t func, void *arg); 17924703Shiremath 17934703Shiremath /* 17944703Shiremath * IP RDMA protocol functions 17954703Shiremath */ 17964703Shiremath 17974703Shiremath /* 17984703Shiremath * IBTF manages the port number space for non well known ports. If a ULP 17994703Shiremath * is not using TCP/UDP and a well known port, then ibt_get_ip_sid() returns 18004703Shiremath * an sid based on the IP protocol number '0' (reserved) and an IBTF assigned 18014703Shiremath * port number. ibt_release_ip_sid() should be used to release the hold 18024703Shiremath * of SID created by ibt_get_ip_sid(). 18034703Shiremath */ 18044703Shiremath ib_svc_id_t ibt_get_ip_sid(uint8_t protocol_num, in_port_t dst_port); 18054703Shiremath ibt_status_t ibt_release_ip_sid(ib_svc_id_t sid); 18064703Shiremath 18074703Shiremath uint8_t ibt_get_ip_protocol_num(ib_svc_id_t sid); 18084703Shiremath in_port_t ibt_get_ip_dst_port(ib_svc_id_t sid); 18094703Shiremath 18104703Shiremath /* 18114703Shiremath * Functions to format/extract the RDMA IP CM private data 18124703Shiremath */ 18134703Shiremath typedef struct ibt_ip_cm_info_s { 18144703Shiremath ibt_ip_addr_t src_addr; 18154703Shiremath ibt_ip_addr_t dst_addr; 18164703Shiremath in_port_t src_port; 18174703Shiremath } ibt_ip_cm_info_t; 18184703Shiremath 18194703Shiremath /* 18204703Shiremath * If a ULP is using IP addressing as defined by the RDMA IP CM Service IBTA 18214703Shiremath * Annex 11, then it must always allocate a private data buffer for use in 18224703Shiremath * the ibt_open_rc_channel(9F) call. The minimum size of the buffer is 18234703Shiremath * IBT_IP_HDR_PRIV_DATA_SZ, if the ULP has no ULP specific private data. 18244703Shiremath * This allows ibt_format_ip_private_data() to place the RDMA IP CM service 18254703Shiremath * hello message in the private data of the REQ. If the ULP has some ULP 18264703Shiremath * specific private data then it should allocate a buffer big enough to 18274703Shiremath * contain that data plus an additional IBT_IP_HDR_PRIV_DATA_SZ bytes. 18284703Shiremath * The ULP should place its ULP specific private data at offset 18294703Shiremath * IBT_IP_HDR_PRIV_DATA_SZ in the allocated buffer before calling 18304703Shiremath * ibt_format_ip_private_data(). 18314703Shiremath */ 18324703Shiremath ibt_status_t ibt_format_ip_private_data(ibt_ip_cm_info_t *ip_cm_info, 18334703Shiremath ibt_priv_data_len_t priv_data_len, void *priv_data_p); 18344703Shiremath ibt_status_t ibt_get_ip_data(ibt_priv_data_len_t priv_data_len, 18354703Shiremath void *priv_data, ibt_ip_cm_info_t *ip_info_p); 18364703Shiremath 18374703Shiremath /* 18384703Shiremath * The ibt_alt_ip_path_attr_t structure is used to specify additional optional 18394703Shiremath * attributes when requesting an alternate path for an existing channel. 18404703Shiremath * 18414703Shiremath * Attributes that are don't care should be set to NULL or '0'. 18424703Shiremath */ 18434703Shiremath typedef struct ibt_alt_ip_path_attr_s { 18444703Shiremath ibt_ip_addr_t apa_dst_ip; 18454703Shiremath ibt_ip_addr_t apa_src_ip; 18464703Shiremath ibt_srate_req_t apa_srate; 18474703Shiremath ibt_pkt_lt_req_t apa_pkt_lt; /* Packet Life Time Request */ 18484703Shiremath uint_t apa_flow:20; 18494703Shiremath uint8_t apa_sl:4; 18504703Shiremath uint8_t apa_hop; 18514703Shiremath uint8_t apa_tclass; 1852*12965SWilliam.Taylor@Oracle.COM zoneid_t apa_zoneid; /* Default 0 = Global Zone */ 18534703Shiremath } ibt_alt_ip_path_attr_t; 18544703Shiremath 18554703Shiremath ibt_status_t ibt_get_ip_alt_path(ibt_channel_hdl_t rc_chan, 18564703Shiremath ibt_path_flags_t flags, ibt_alt_ip_path_attr_t *attr, 18574703Shiremath ibt_alt_path_info_t *alt_path); 18580Sstevel@tonic-gate 18590Sstevel@tonic-gate /* 18600Sstevel@tonic-gate * CONTRACT PRIVATE ONLY INTERFACES 18610Sstevel@tonic-gate * 18620Sstevel@tonic-gate * DO NOT USE THE FOLLOWING FUNCTIONS WITHOUT SIGNING THE CONTRACT 18630Sstevel@tonic-gate * WITH IBTF GROUP. 18640Sstevel@tonic-gate */ 18650Sstevel@tonic-gate 18660Sstevel@tonic-gate /* Define an Address Record structure (data for ATS service records). */ 18670Sstevel@tonic-gate typedef struct ibt_ar_s { 18680Sstevel@tonic-gate ib_gid_t ar_gid; /* GID of local HCA port */ 18690Sstevel@tonic-gate ib_pkey_t ar_pkey; /* P_Key valid on port of ar_gid */ 18700Sstevel@tonic-gate uint8_t ar_data[16]; /* Data affiliated with GID/P_Key */ 18710Sstevel@tonic-gate } ibt_ar_t; 18720Sstevel@tonic-gate 18730Sstevel@tonic-gate /* 18740Sstevel@tonic-gate * ibt_register_ar() 18750Sstevel@tonic-gate * ibt_deregister_ar() 18760Sstevel@tonic-gate * Register/deregister an Address Record with the SA. 18770Sstevel@tonic-gate * ibt_query_ar() 18780Sstevel@tonic-gate * Query the SA for Address Records matching either GID/P_Key or Data. 18790Sstevel@tonic-gate */ 18800Sstevel@tonic-gate ibt_status_t ibt_register_ar(ibt_clnt_hdl_t ibt_hdl, ibt_ar_t *arp); 18810Sstevel@tonic-gate 18820Sstevel@tonic-gate ibt_status_t ibt_deregister_ar(ibt_clnt_hdl_t ibt_hdl, ibt_ar_t *arp); 18830Sstevel@tonic-gate 18840Sstevel@tonic-gate ibt_status_t ibt_query_ar(ib_gid_t *sgid, ibt_ar_t *queryp, ibt_ar_t *resultp); 18850Sstevel@tonic-gate 18860Sstevel@tonic-gate 18870Sstevel@tonic-gate /* 18880Sstevel@tonic-gate * ibt_modify_system_image() 18890Sstevel@tonic-gate * ibt_modify_system_image_byguid() 18900Sstevel@tonic-gate * Modify specified HCA's system image GUID. 18910Sstevel@tonic-gate */ 18920Sstevel@tonic-gate ibt_status_t ibt_modify_system_image(ibt_hca_hdl_t hca_hdl, ib_guid_t sys_guid); 18930Sstevel@tonic-gate 18940Sstevel@tonic-gate ibt_status_t ibt_modify_system_image_byguid(ib_guid_t hca_guid, 18950Sstevel@tonic-gate ib_guid_t sys_guid); 18960Sstevel@tonic-gate 18970Sstevel@tonic-gate 18980Sstevel@tonic-gate /* 18990Sstevel@tonic-gate * ibt_modify_port() 19000Sstevel@tonic-gate * ibt_modify_port_byguid() 19010Sstevel@tonic-gate * Modify the specified port, or all ports attribute(s). 19020Sstevel@tonic-gate */ 19030Sstevel@tonic-gate ibt_status_t ibt_modify_port(ibt_hca_hdl_t hca_hdl, uint8_t port, 19040Sstevel@tonic-gate ibt_port_modify_flags_t flags, uint8_t init_type); 19050Sstevel@tonic-gate 19060Sstevel@tonic-gate ibt_status_t ibt_modify_port_byguid(ib_guid_t hca_guid, uint8_t port, 19070Sstevel@tonic-gate ibt_port_modify_flags_t flags, uint8_t init_type); 19080Sstevel@tonic-gate 19090Sstevel@tonic-gate 19100Sstevel@tonic-gate /* 19110Sstevel@tonic-gate * ibt_get_port_state() 19120Sstevel@tonic-gate * ibt_get_port_state_byguid() 19130Sstevel@tonic-gate * Return the most commonly requested attributes of an HCA port. 19140Sstevel@tonic-gate * If the link state is not IBT_PORT_ACTIVE, the other returned values 19150Sstevel@tonic-gate * are undefined. 19160Sstevel@tonic-gate */ 19170Sstevel@tonic-gate ibt_status_t ibt_get_port_state(ibt_hca_hdl_t hca_hdl, uint8_t port, 19180Sstevel@tonic-gate ib_gid_t *sgid_p, ib_lid_t *base_lid_p); 19190Sstevel@tonic-gate 19200Sstevel@tonic-gate ibt_status_t ibt_get_port_state_byguid(ib_guid_t hca_guid, uint8_t port, 19210Sstevel@tonic-gate ib_gid_t *sgid_p, ib_lid_t *base_lid_p); 19220Sstevel@tonic-gate 19238580SBill.Taylor@Sun.COM /* 19248580SBill.Taylor@Sun.COM * ibt_alloc_io_mem() 19258580SBill.Taylor@Sun.COM * ibt_free_io_mem() 19268580SBill.Taylor@Sun.COM * Allocate and deallocate dma-able memory. 19278580SBill.Taylor@Sun.COM */ 19288580SBill.Taylor@Sun.COM ibt_status_t ibt_alloc_io_mem(ibt_hca_hdl_t, size_t, ibt_mr_flags_t, 19298580SBill.Taylor@Sun.COM caddr_t *, ibt_mem_alloc_hdl_t *); 19308580SBill.Taylor@Sun.COM 19318580SBill.Taylor@Sun.COM ibt_status_t ibt_free_io_mem(ibt_hca_hdl_t, ibt_mem_alloc_hdl_t); 19328580SBill.Taylor@Sun.COM 193312163SRamaswamy.Tummala@Sun.COM /* 193412163SRamaswamy.Tummala@Sun.COM * Interfaces to get IB partition information. 193512163SRamaswamy.Tummala@Sun.COM */ 193612163SRamaswamy.Tummala@Sun.COM 193712163SRamaswamy.Tummala@Sun.COM typedef struct ibt_part_attr_s { 193812163SRamaswamy.Tummala@Sun.COM datalink_id_t pa_dlinkid; 193912163SRamaswamy.Tummala@Sun.COM datalink_id_t pa_plinkid; 194012163SRamaswamy.Tummala@Sun.COM uint8_t pa_port; 194112163SRamaswamy.Tummala@Sun.COM ib_guid_t pa_hca_guid; 194212163SRamaswamy.Tummala@Sun.COM ib_guid_t pa_port_guid; 194312163SRamaswamy.Tummala@Sun.COM ib_pkey_t pa_pkey; 194412163SRamaswamy.Tummala@Sun.COM } ibt_part_attr_t; 194512163SRamaswamy.Tummala@Sun.COM 194612163SRamaswamy.Tummala@Sun.COM void ibt_register_part_attr_cb( 194712163SRamaswamy.Tummala@Sun.COM ibt_status_t (*)(datalink_id_t, ibt_part_attr_t *), 194812163SRamaswamy.Tummala@Sun.COM ibt_status_t (*)(ibt_part_attr_t **, int *)); 194912163SRamaswamy.Tummala@Sun.COM void ibt_unregister_part_attr_cb(void); 195012163SRamaswamy.Tummala@Sun.COM 195112163SRamaswamy.Tummala@Sun.COM ibt_status_t ibt_get_part_attr(datalink_id_t, ibt_part_attr_t *); 195212163SRamaswamy.Tummala@Sun.COM ibt_status_t ibt_get_all_part_attr(ibt_part_attr_t **, int *); 195312163SRamaswamy.Tummala@Sun.COM ibt_status_t ibt_free_part_attr(ibt_part_attr_t *, int); 195412163SRamaswamy.Tummala@Sun.COM 1955*12965SWilliam.Taylor@Oracle.COM 1956*12965SWilliam.Taylor@Oracle.COM /* 1957*12965SWilliam.Taylor@Oracle.COM * ibt_lid_to_node_info() 1958*12965SWilliam.Taylor@Oracle.COM * Retrieve node record information for the specified LID. 1959*12965SWilliam.Taylor@Oracle.COM */ 1960*12965SWilliam.Taylor@Oracle.COM ibt_status_t ibt_lid_to_node_info(ib_lid_t lid, ibt_node_info_t *node_info_p); 1961*12965SWilliam.Taylor@Oracle.COM 1962*12965SWilliam.Taylor@Oracle.COM 19630Sstevel@tonic-gate #ifdef __cplusplus 19640Sstevel@tonic-gate } 19650Sstevel@tonic-gate #endif 19660Sstevel@tonic-gate 19670Sstevel@tonic-gate #endif /* _SYS_IB_IBTL_IBTI_COMMON_H */ 1968