1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* 23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 */ 26 27 #ifndef _SYS_IB_IBTL_IMPL_IBTL_CM_H 28 #define _SYS_IB_IBTL_IMPL_IBTL_CM_H 29 30 #pragma ident "%Z%%M% %I% %E% SMI" 31 32 /* 33 * ibtl_cm.h 34 * 35 * All data structures and function prototypes that are specific to the 36 * IBTL <-> IBCM private interface. 37 */ 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 /* 44 * ibt_ud_dest_t is defined in ibtl_ci_types.h, it holds all the 45 * information needed to reach a UD destination. 46 * 47 * typedef struct ibt_ud_dest_s { 48 * ibc_ah_hdl_t ud_ah; * Address handle * 49 * ib_qpn_t ud_dst_qpn; * Destination QPN * 50 * ib_qkey_t ud_qkey; * Q_Key * 51 * 52 * * The following fields are CM-only, i.e., opaque to the CI * 53 * struct ibtl_hca_s *ud_hca; * IBTL HCA handle * 54 * } ibt_ud_dest_t; 55 */ 56 #define ud_dest_hca ud_dest_opaque1 57 58 /* CM private data */ 59 void ibtl_cm_set_chan_private(ibt_channel_hdl_t chan, void *cm_private); 60 void *ibtl_cm_get_chan_private(ibt_channel_hdl_t chan); 61 void ibtl_cm_release_chan_private(ibt_channel_hdl_t chan); 62 void ibtl_cm_wait_chan_private(ibt_channel_hdl_t chan); 63 64 /* 65 * ibtl_cm_get_hca_port() helper function will retrieve these for the 66 * specified SGID value. 67 */ 68 typedef struct ibtl_cm_hca_port_s { 69 ib_guid_t hp_hca_guid; /* HCA GUID. */ 70 ib_guid_t hp_port_guid; /* Port GUID. */ 71 ib_lid_t hp_base_lid; /* Base LID of Port. */ 72 uint8_t hp_port; /* HCA Port Number. */ 73 uint8_t hp_sgid_ix; /* SGID Index in SGID Table. */ 74 uint8_t hp_lmc:3; /* Local mask control */ 75 ib_mtu_t hp_mtu; /* Max transfer unit - pkt */ 76 } ibtl_cm_hca_port_t; 77 78 /* 79 * ibtl_cm_get_hca_port() 80 * 81 * A helper function to get HCA node GUID, Base LID, SGID Index, 82 * port number, LMC and MTU for the specified SGID. 83 * 84 * sgid Input Source GID. 85 * 86 * hca_guid Optional HCA Guid. 87 * 88 * hca_port Pointer to ibtl_cm_hca_port_t structure, 89 */ 90 ibt_status_t ibtl_cm_get_hca_port(ib_gid_t sgid, ib_guid_t hca_guid, 91 ibtl_cm_hca_port_t *hca_port); 92 93 94 ibt_status_t ibtl_cm_get_local_comp_gids(ib_guid_t hca_guid, ib_gid_t sgid, 95 ib_gid_t **gids_p, uint_t *num_gids_p); 96 97 int ibtl_cm_is_multi_sm(ib_guid_t hca_guid); 98 99 /* 100 * ibtl_cm_get_1st_full_pkey_ix() 101 * 102 * A helper function to get P_Key Index of the first full member P_Key 103 * available on the specified HCA and Port combination. 104 * 105 * hca_guid HCA GUID. 106 * 107 * port HCA port number. 108 */ 109 uint16_t ibtl_cm_get_1st_full_pkey_ix(ib_guid_t hca_guid, uint8_t port); 110 111 112 /* 113 * Functions to support CM and clients to reliably free RC QPs. 114 * 115 * ibtl_cm_chan_is_open() 116 * 117 * Inform IBTL that the connection has been established on this 118 * channel so that a later call to ibtl_cm_chan_is_closed() 119 * will be required to free the QPN used by this channel. 120 * 121 * ibtl_cm_chan_is_closing() 122 * 123 * Inform IBTL that the TIMEWAIT delay for the connection has been 124 * started for this channel so that the QP can be freed. 125 * 126 * ibtl_cm_is_chan_closing() 127 * 128 * Returns 1 if the connection on this channel has been moved to TIME WAIT 129 * 130 * ibtl_cm_is_chan_closed() 131 * 132 * Returns 1 if the connection on this channel has completed TIME WAIT 133 * 134 * ibtl_cm_chan_is_closed() 135 * 136 * Inform IBTL that the TIMEWAIT delay for the connection has been 137 * reached for this channel so that the QPN can be reused. 138 * 139 * rc_chan Channel Handle 140 * 141 * ibtl_cm_chan_is_reused() 142 * 143 * Inform IBTL that the channel is going to be re-used for another 144 * connection. 145 * 146 * rc_chan Channel Handle 147 */ 148 void ibtl_cm_chan_is_open(ibt_channel_hdl_t rc_chan); 149 void ibtl_cm_chan_is_closing(ibt_channel_hdl_t rc_chan); 150 void ibtl_cm_chan_is_closed(ibt_channel_hdl_t rc_chan); 151 void ibtl_cm_chan_is_reused(ibt_channel_hdl_t rc_chan); 152 int ibtl_cm_is_chan_closing(ibt_channel_hdl_t rc_chan); 153 int ibtl_cm_is_chan_closed(ibt_channel_hdl_t rc_chan); 154 155 /* 156 * ibtl_cm_get_chan_type() 157 * 158 * A helper function to get channel transport type. 159 */ 160 ibt_tran_srv_t ibtl_cm_get_chan_type(ibt_channel_hdl_t chan); 161 162 /* 163 * ibtl_cm_change_service_cnt() 164 * 165 * Inform IBTL that service registration count has changed 166 * so that it can correctly manage whether or not it should 167 * allow ibt_detach() to succeed. 168 */ 169 void ibtl_cm_change_service_cnt(ibt_clnt_hdl_t ibt_hdl, int delta_num_sids); 170 171 /* 172 * ibtl_cm_query_hca_ports_byguid() 173 * 174 * Use the cached copy of the portinfo. 175 */ 176 ibt_status_t ibtl_cm_query_hca_ports_byguid(ib_guid_t hca_guid, uint8_t port, 177 ibt_hca_portinfo_t **port_info_p, uint_t *ports_p, uint_t *size_p); 178 179 180 /* 181 * ibtl_cm_get_active_plist 182 * 183 * Returns a list of active source points which satisfy the desired 184 * attribute. The memory allocated for the array "port_list_p" should 185 * be freed by the caller using ibtl_cm_free_active_plist(). 186 * 187 * ibtl_cm_free_active_plist 188 * 189 * Frees the memory allocated in ibtl_cm_get_active_plist(). 190 */ 191 192 #define IBTL_CM_SIMPLE_SETUP 0 193 #define IBTL_CM_MULTI_SM (1 << 0) 194 #define IBTL_CM_MULTI_HCA (1 << 1) 195 196 typedef struct ibtl_cm_port_list_s { 197 ib_guid_t p_hca_guid; 198 ib_gid_t p_sgid; 199 ib_lid_t p_base_lid; 200 ib_mtu_t p_mtu; 201 uint8_t p_sgid_ix; 202 uint8_t p_port_num; 203 uint8_t p_count; 204 uint8_t p_multi; 205 void *p_saa_hdl; 206 } ibtl_cm_port_list_t; 207 208 ibt_status_t ibtl_cm_get_active_plist(ibt_path_attr_t *attr, 209 ibt_path_flags_t flags, ibtl_cm_port_list_t **port_list_p); 210 211 void ibtl_cm_free_active_plist(ibtl_cm_port_list_t *port_list); 212 213 /* 214 * Functions to support ibt_register_subnet_notices and the 215 * related callbacks. 216 * 217 * ibtl_cm_set_sm_notice_handler 218 * Pass the handler into IBTL where it will actually be used. 219 * 220 * ibtl_cm_sm_notice_handler 221 * Post an event to interested IBT clients. 222 * 223 * ibtl_cm_sm_notice_init_failure 224 * Inform the client that callbacks are not working. 225 */ 226 void ibtl_cm_sm_notice_handler(ib_gid_t sgid, ibt_subnet_event_code_t code, 227 ibt_subnet_event_t *event); 228 229 void ibtl_cm_set_sm_notice_handler(ibt_clnt_hdl_t ibt_hdl, 230 ibt_sm_notice_handler_t sm_notice_handler, void *private); 231 232 /* pass all failing sgids at once */ 233 typedef struct ibtl_cm_sm_init_fail_s { 234 int smf_num_sgids; 235 ibt_clnt_hdl_t smf_ibt_hdl; 236 ib_gid_t smf_sgid[1]; 237 } ibtl_cm_sm_init_fail_t; 238 239 void ibtl_cm_sm_notice_init_failure(ibtl_cm_sm_init_fail_t *ifail); 240 241 #ifdef __cplusplus 242 } 243 #endif 244 245 #endif /* _SYS_IB_IBTL_IMPL_IBTL_CM_H */ 246