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