Sean Hefty | 7521663 | 2006-11-30 16:53:41 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2006 Intel Corporation. All rights reserved. |
| 3 | * |
| 4 | * This software is available to you under a choice of one of two |
| 5 | * licenses. You may choose to be licensed under the terms of the GNU |
| 6 | * General Public License (GPL) Version 2, available from the file |
| 7 | * COPYING in the main directory of this source tree, or the |
| 8 | * OpenIB.org BSD license below: |
| 9 | * |
| 10 | * Redistribution and use in source and binary forms, with or |
| 11 | * without modification, are permitted provided that the following |
| 12 | * conditions are met: |
| 13 | * |
| 14 | * - Redistributions of source code must retain the above |
| 15 | * copyright notice, this list of conditions and the following |
| 16 | * disclaimer. |
| 17 | * |
| 18 | * - Redistributions in binary form must reproduce the above |
| 19 | * copyright notice, this list of conditions and the following |
| 20 | * disclaimer in the documentation and/or other materials |
| 21 | * provided with the distribution. |
| 22 | * |
| 23 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 24 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 25 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 26 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 27 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 28 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 29 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 30 | * SOFTWARE. |
| 31 | */ |
| 32 | |
| 33 | #ifndef RDMA_USER_CM_H |
| 34 | #define RDMA_USER_CM_H |
| 35 | |
| 36 | #include <linux/types.h> |
| 37 | #include <linux/in6.h> |
| 38 | #include <rdma/ib_user_verbs.h> |
| 39 | #include <rdma/ib_user_sa.h> |
| 40 | |
Sean Hefty | c8f6a36 | 2007-02-15 17:00:18 -0800 | [diff] [blame] | 41 | #define RDMA_USER_CM_ABI_VERSION 4 |
Sean Hefty | 7521663 | 2006-11-30 16:53:41 -0800 | [diff] [blame] | 42 | |
| 43 | #define RDMA_MAX_PRIVATE_DATA 256 |
| 44 | |
| 45 | enum { |
| 46 | RDMA_USER_CM_CMD_CREATE_ID, |
| 47 | RDMA_USER_CM_CMD_DESTROY_ID, |
| 48 | RDMA_USER_CM_CMD_BIND_ADDR, |
| 49 | RDMA_USER_CM_CMD_RESOLVE_ADDR, |
| 50 | RDMA_USER_CM_CMD_RESOLVE_ROUTE, |
| 51 | RDMA_USER_CM_CMD_QUERY_ROUTE, |
| 52 | RDMA_USER_CM_CMD_CONNECT, |
| 53 | RDMA_USER_CM_CMD_LISTEN, |
| 54 | RDMA_USER_CM_CMD_ACCEPT, |
| 55 | RDMA_USER_CM_CMD_REJECT, |
| 56 | RDMA_USER_CM_CMD_DISCONNECT, |
| 57 | RDMA_USER_CM_CMD_INIT_QP_ATTR, |
| 58 | RDMA_USER_CM_CMD_GET_EVENT, |
| 59 | RDMA_USER_CM_CMD_GET_OPTION, |
| 60 | RDMA_USER_CM_CMD_SET_OPTION, |
Sean Hefty | c8f6a36 | 2007-02-15 17:00:18 -0800 | [diff] [blame] | 61 | RDMA_USER_CM_CMD_NOTIFY, |
| 62 | RDMA_USER_CM_CMD_JOIN_MCAST, |
Sean Hefty | 88314e4 | 2007-11-14 00:29:50 -0800 | [diff] [blame] | 63 | RDMA_USER_CM_CMD_LEAVE_MCAST, |
| 64 | RDMA_USER_CM_CMD_MIGRATE_ID |
Sean Hefty | 7521663 | 2006-11-30 16:53:41 -0800 | [diff] [blame] | 65 | }; |
| 66 | |
| 67 | /* |
| 68 | * command ABI structures. |
| 69 | */ |
| 70 | struct rdma_ucm_cmd_hdr { |
| 71 | __u32 cmd; |
| 72 | __u16 in; |
| 73 | __u16 out; |
| 74 | }; |
| 75 | |
| 76 | struct rdma_ucm_create_id { |
| 77 | __u64 uid; |
| 78 | __u64 response; |
| 79 | __u16 ps; |
| 80 | __u8 reserved[6]; |
| 81 | }; |
| 82 | |
| 83 | struct rdma_ucm_create_id_resp { |
| 84 | __u32 id; |
| 85 | }; |
| 86 | |
| 87 | struct rdma_ucm_destroy_id { |
| 88 | __u64 response; |
| 89 | __u32 id; |
| 90 | __u32 reserved; |
| 91 | }; |
| 92 | |
| 93 | struct rdma_ucm_destroy_id_resp { |
| 94 | __u32 events_reported; |
| 95 | }; |
| 96 | |
| 97 | struct rdma_ucm_bind_addr { |
| 98 | __u64 response; |
| 99 | struct sockaddr_in6 addr; |
| 100 | __u32 id; |
| 101 | }; |
| 102 | |
| 103 | struct rdma_ucm_resolve_addr { |
| 104 | struct sockaddr_in6 src_addr; |
| 105 | struct sockaddr_in6 dst_addr; |
| 106 | __u32 id; |
| 107 | __u32 timeout_ms; |
| 108 | }; |
| 109 | |
| 110 | struct rdma_ucm_resolve_route { |
| 111 | __u32 id; |
| 112 | __u32 timeout_ms; |
| 113 | }; |
| 114 | |
| 115 | struct rdma_ucm_query_route { |
| 116 | __u64 response; |
| 117 | __u32 id; |
| 118 | __u32 reserved; |
| 119 | }; |
| 120 | |
| 121 | struct rdma_ucm_query_route_resp { |
| 122 | __u64 node_guid; |
| 123 | struct ib_user_path_rec ib_route[2]; |
| 124 | struct sockaddr_in6 src_addr; |
| 125 | struct sockaddr_in6 dst_addr; |
| 126 | __u32 num_paths; |
| 127 | __u8 port_num; |
| 128 | __u8 reserved[3]; |
| 129 | }; |
| 130 | |
| 131 | struct rdma_ucm_conn_param { |
| 132 | __u32 qp_num; |
| 133 | __u32 reserved; |
| 134 | __u8 private_data[RDMA_MAX_PRIVATE_DATA]; |
| 135 | __u8 private_data_len; |
| 136 | __u8 srq; |
| 137 | __u8 responder_resources; |
| 138 | __u8 initiator_depth; |
| 139 | __u8 flow_control; |
| 140 | __u8 retry_count; |
| 141 | __u8 rnr_retry_count; |
| 142 | __u8 valid; |
| 143 | }; |
| 144 | |
| 145 | struct rdma_ucm_ud_param { |
| 146 | __u32 qp_num; |
| 147 | __u32 qkey; |
| 148 | struct ib_uverbs_ah_attr ah_attr; |
| 149 | __u8 private_data[RDMA_MAX_PRIVATE_DATA]; |
| 150 | __u8 private_data_len; |
| 151 | __u8 reserved[7]; |
| 152 | }; |
| 153 | |
| 154 | struct rdma_ucm_connect { |
| 155 | struct rdma_ucm_conn_param conn_param; |
| 156 | __u32 id; |
| 157 | __u32 reserved; |
| 158 | }; |
| 159 | |
| 160 | struct rdma_ucm_listen { |
| 161 | __u32 id; |
| 162 | __u32 backlog; |
| 163 | }; |
| 164 | |
| 165 | struct rdma_ucm_accept { |
| 166 | __u64 uid; |
| 167 | struct rdma_ucm_conn_param conn_param; |
| 168 | __u32 id; |
| 169 | __u32 reserved; |
| 170 | }; |
| 171 | |
| 172 | struct rdma_ucm_reject { |
| 173 | __u32 id; |
| 174 | __u8 private_data_len; |
| 175 | __u8 reserved[3]; |
| 176 | __u8 private_data[RDMA_MAX_PRIVATE_DATA]; |
| 177 | }; |
| 178 | |
| 179 | struct rdma_ucm_disconnect { |
| 180 | __u32 id; |
| 181 | }; |
| 182 | |
| 183 | struct rdma_ucm_init_qp_attr { |
| 184 | __u64 response; |
| 185 | __u32 id; |
| 186 | __u32 qp_state; |
| 187 | }; |
| 188 | |
| 189 | struct rdma_ucm_notify { |
| 190 | __u32 id; |
| 191 | __u32 event; |
| 192 | }; |
| 193 | |
Sean Hefty | c8f6a36 | 2007-02-15 17:00:18 -0800 | [diff] [blame] | 194 | struct rdma_ucm_join_mcast { |
| 195 | __u64 response; /* rdma_ucm_create_id_resp */ |
| 196 | __u64 uid; |
| 197 | struct sockaddr_in6 addr; |
| 198 | __u32 id; |
| 199 | }; |
| 200 | |
Sean Hefty | 7521663 | 2006-11-30 16:53:41 -0800 | [diff] [blame] | 201 | struct rdma_ucm_get_event { |
| 202 | __u64 response; |
| 203 | }; |
| 204 | |
| 205 | struct rdma_ucm_event_resp { |
| 206 | __u64 uid; |
| 207 | __u32 id; |
| 208 | __u32 event; |
| 209 | __u32 status; |
| 210 | union { |
| 211 | struct rdma_ucm_conn_param conn; |
| 212 | struct rdma_ucm_ud_param ud; |
| 213 | } param; |
| 214 | }; |
| 215 | |
Sean Hefty | 7ce8640 | 2007-08-08 15:51:13 -0700 | [diff] [blame] | 216 | /* Option levels */ |
| 217 | enum { |
Sean Hefty | a7ca1f0 | 2009-11-16 09:30:33 -0800 | [diff] [blame] | 218 | RDMA_OPTION_ID = 0, |
| 219 | RDMA_OPTION_IB = 1 |
Sean Hefty | 7ce8640 | 2007-08-08 15:51:13 -0700 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | /* Option details */ |
| 223 | enum { |
Hefty, Sean | a9bb791 | 2011-05-09 22:06:10 -0700 | [diff] [blame^] | 224 | RDMA_OPTION_ID_TOS = 0, |
| 225 | RDMA_OPTION_ID_REUSEADDR = 1, |
| 226 | RDMA_OPTION_IB_PATH = 1 |
Sean Hefty | 7ce8640 | 2007-08-08 15:51:13 -0700 | [diff] [blame] | 227 | }; |
| 228 | |
| 229 | struct rdma_ucm_set_option { |
| 230 | __u64 optval; |
| 231 | __u32 id; |
| 232 | __u32 level; |
| 233 | __u32 optname; |
| 234 | __u32 optlen; |
| 235 | }; |
| 236 | |
Sean Hefty | 88314e4 | 2007-11-14 00:29:50 -0800 | [diff] [blame] | 237 | struct rdma_ucm_migrate_id { |
| 238 | __u64 response; |
| 239 | __u32 id; |
| 240 | __u32 fd; |
| 241 | }; |
| 242 | |
| 243 | struct rdma_ucm_migrate_resp { |
| 244 | __u32 events_reported; |
| 245 | }; |
| 246 | |
Sean Hefty | 7521663 | 2006-11-30 16:53:41 -0800 | [diff] [blame] | 247 | #endif /* RDMA_USER_CM_H */ |