1/* 2 * Copyright (c) 2005 Topspin Communications. All rights reserved. 3 * Copyright (c) 2005 Intel Corporation. All rights reserved. 4 * 5 * This software is available to you under a choice of one of two 6 * licenses. You may choose to be licensed under the terms of the GNU 7 * General Public License (GPL) Version 2, available from the file 8 * COPYING in the main directory of this source tree, or the 9 * OpenIB.org BSD license below: 10 * 11 * Redistribution and use in source and binary forms, with or 12 * without modification, are permitted provided that the following 13 * conditions are met: 14 * 15 * - Redistributions of source code must retain the above 16 * copyright notice, this list of conditions and the following 17 * disclaimer. 18 * 19 * - Redistributions in binary form must reproduce the above 20 * copyright notice, this list of conditions and the following 21 * disclaimer in the documentation and/or other materials 22 * provided with the distribution. 23 * 24 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 28 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 29 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 30 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 31 * SOFTWARE. 32 * 33 * $Id$ 34 */ 35 36#ifndef CM_ABI_H 37#define CM_ABI_H 38 39#include <infiniband/types.h> 40#include <infiniband/sa.h> 41#include <infiniband/marshall.h> 42 43/* 44 * This file must be kept in sync with the kernel's version of ib_user_cm.h 45 */ 46 47#define IB_USER_CM_MIN_ABI_VERSION 4 48#define IB_USER_CM_MAX_ABI_VERSION 5 49 50enum { 51 IB_USER_CM_CMD_CREATE_ID, 52 IB_USER_CM_CMD_DESTROY_ID, 53 IB_USER_CM_CMD_ATTR_ID, 54 55 IB_USER_CM_CMD_LISTEN, 56 IB_USER_CM_CMD_NOTIFY, 57 IB_USER_CM_CMD_ESTABLISH = IB_USER_CM_CMD_NOTIFY, /* ABI 4 support */ 58 59 IB_USER_CM_CMD_SEND_REQ, 60 IB_USER_CM_CMD_SEND_REP, 61 IB_USER_CM_CMD_SEND_RTU, 62 IB_USER_CM_CMD_SEND_DREQ, 63 IB_USER_CM_CMD_SEND_DREP, 64 IB_USER_CM_CMD_SEND_REJ, 65 IB_USER_CM_CMD_SEND_MRA, 66 IB_USER_CM_CMD_SEND_LAP, 67 IB_USER_CM_CMD_SEND_APR, 68 IB_USER_CM_CMD_SEND_SIDR_REQ, 69 IB_USER_CM_CMD_SEND_SIDR_REP, 70 71 IB_USER_CM_CMD_EVENT, 72 IB_USER_CM_CMD_INIT_QP_ATTR, 73}; 74/* 75 * command ABI structures. 76 */ 77struct cm_abi_cmd_hdr { 78 __u32 cmd; 79 __u16 in; 80 __u16 out; 81}; 82 83struct cm_abi_create_id { 84 __u64 uid; 85 __u64 response; 86}; 87 88struct cm_abi_create_id_resp { 89 __u32 id; 90}; 91 92struct cm_abi_destroy_id { 93 __u64 response; 94 __u32 id; 95 __u32 reserved; 96}; 97 98struct cm_abi_destroy_id_resp { 99 __u32 events_reported; 100}; 101 102struct cm_abi_attr_id { 103 __u64 response; 104 __u32 id; 105 __u32 reserved; 106}; 107 108struct cm_abi_attr_id_resp { 109 __u64 service_id; 110 __u64 service_mask; 111 __u32 local_id; 112 __u32 remote_id; 113}; 114 115struct cm_abi_init_qp_attr { 116 __u64 response; 117 __u32 id; 118 __u32 qp_state; 119}; 120 121struct cm_abi_listen { 122 __u64 service_id; 123 __u64 service_mask; 124 __u32 id; 125 __u32 reserved; 126}; 127 128struct cm_abi_establish { /* ABI 4 support */ 129 __u32 id; 130}; 131 132struct cm_abi_notify { 133 __u32 id; 134 __u32 event; 135}; 136 137struct cm_abi_private_data { 138 __u64 data; 139 __u32 id; 140 __u8 len; 141 __u8 reserved[3]; 142}; 143 144struct cm_abi_req { 145 __u32 id; 146 __u32 qpn; 147 __u32 qp_type; 148 __u32 psn; 149 __u64 sid; 150 __u64 data; 151 __u64 primary_path; 152 __u64 alternate_path; 153 __u8 len; 154 __u8 peer_to_peer; 155 __u8 responder_resources; 156 __u8 initiator_depth; 157 __u8 remote_cm_response_timeout; 158 __u8 flow_control; 159 __u8 local_cm_response_timeout; 160 __u8 retry_count; 161 __u8 rnr_retry_count; 162 __u8 max_cm_retries; 163 __u8 srq; 164 __u8 reserved[5]; 165}; 166 167struct cm_abi_rep { 168 __u64 uid; 169 __u64 data; 170 __u32 id; 171 __u32 qpn; 172 __u32 psn; 173 __u8 len; 174 __u8 responder_resources; 175 __u8 initiator_depth; 176 __u8 target_ack_delay; 177 __u8 failover_accepted; 178 __u8 flow_control; 179 __u8 rnr_retry_count; 180 __u8 srq; 181 __u8 reserved[4]; 182}; 183 184struct cm_abi_info { 185 __u32 id; 186 __u32 status; 187 __u64 info; 188 __u64 data; 189 __u8 info_len; 190 __u8 data_len; 191 __u8 reserved[6]; 192}; 193 194struct cm_abi_mra { 195 __u64 data; 196 __u32 id; 197 __u8 len; 198 __u8 timeout; 199 __u8 reserved[2]; 200}; 201 202struct cm_abi_lap { 203 __u64 path; 204 __u64 data; 205 __u32 id; 206 __u8 len; 207 __u8 reserved[3]; 208}; 209 210struct cm_abi_sidr_req { 211 __u32 id; 212 __u32 timeout; 213 __u64 sid; 214 __u64 data; 215 __u64 path; 216 __u16 pkey; 217 __u8 len; 218 __u8 max_cm_retries; 219 __u8 reserved[4]; 220}; 221 222struct cm_abi_sidr_rep { 223 __u32 id; 224 __u32 qpn; 225 __u32 qkey; 226 __u32 status; 227 __u64 info; 228 __u64 data; 229 __u8 info_len; 230 __u8 data_len; 231 __u8 reserved[6]; 232}; 233/* 234 * event notification ABI structures. 235 */ 236struct cm_abi_event_get { 237 __u64 response; 238 __u64 data; 239 __u64 info; 240 __u8 data_len; 241 __u8 info_len; 242 __u8 reserved[6]; 243}; 244 245struct cm_abi_req_event_resp { 246 struct ibv_kern_path_rec primary_path; 247 struct ibv_kern_path_rec alternate_path; 248 __u64 remote_ca_guid; 249 __u32 remote_qkey; 250 __u32 remote_qpn; 251 __u32 qp_type; 252 __u32 starting_psn; 253 __u8 responder_resources; 254 __u8 initiator_depth; 255 __u8 local_cm_response_timeout; 256 __u8 flow_control; 257 __u8 remote_cm_response_timeout; 258 __u8 retry_count; 259 __u8 rnr_retry_count; 260 __u8 srq; 261 __u8 port; 262 __u8 reserved[7]; 263}; 264 265struct cm_abi_rep_event_resp { 266 __u64 remote_ca_guid; 267 __u32 remote_qkey; 268 __u32 remote_qpn; 269 __u32 starting_psn; 270 __u8 responder_resources; 271 __u8 initiator_depth; 272 __u8 target_ack_delay; 273 __u8 failover_accepted; 274 __u8 flow_control; 275 __u8 rnr_retry_count; 276 __u8 srq; 277 __u8 reserved[5]; 278}; 279 280struct cm_abi_rej_event_resp { 281 __u32 reason; 282 /* ari in cm_abi_event_get info field. */ 283}; 284 285struct cm_abi_mra_event_resp { 286 __u8 timeout; 287 __u8 reserved[3]; 288}; 289 290struct cm_abi_lap_event_resp { 291 struct ibv_kern_path_rec path; 292}; 293 294struct cm_abi_apr_event_resp { 295 __u32 status; 296 /* apr info in cm_abi_event_get info field. */ 297}; 298 299struct cm_abi_sidr_req_event_resp { 300 __u16 pkey; 301 __u8 port; 302 __u8 reserved; 303}; 304 305struct cm_abi_sidr_rep_event_resp { 306 __u32 status; 307 __u32 qkey; 308 __u32 qpn; 309 /* info in cm_abi_event_get info field. */ 310}; 311 312#define CM_ABI_PRES_DATA 0x01 313#define CM_ABI_PRES_INFO 0x02 314#define CM_ABI_PRES_PRIMARY 0x04 315#define CM_ABI_PRES_ALTERNATE 0x08 316 317struct cm_abi_event_resp { 318 __u64 uid; 319 __u32 id; 320 __u32 event; 321 __u32 present; 322 __u32 reserved; 323 union { 324 struct cm_abi_req_event_resp req_resp; 325 struct cm_abi_rep_event_resp rep_resp; 326 struct cm_abi_rej_event_resp rej_resp; 327 struct cm_abi_mra_event_resp mra_resp; 328 struct cm_abi_lap_event_resp lap_resp; 329 struct cm_abi_apr_event_resp apr_resp; 330 331 struct cm_abi_sidr_req_event_resp sidr_req_resp; 332 struct cm_abi_sidr_rep_event_resp sidr_rep_resp; 333 334 __u32 send_status; 335 } u; 336}; 337 338#endif /* CM_ABI_H */ 339