linux/include/uapi/rdma/rdma_user_cm.h
<<
>>
Prefs
   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
  41#define RDMA_USER_CM_ABI_VERSION        4
  42
  43#define RDMA_MAX_PRIVATE_DATA           256
  44
  45enum {
  46        RDMA_USER_CM_CMD_CREATE_ID,
  47        RDMA_USER_CM_CMD_DESTROY_ID,
  48        RDMA_USER_CM_CMD_BIND_IP,
  49        RDMA_USER_CM_CMD_RESOLVE_IP,
  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,
  61        RDMA_USER_CM_CMD_NOTIFY,
  62        RDMA_USER_CM_CMD_JOIN_IP_MCAST,
  63        RDMA_USER_CM_CMD_LEAVE_MCAST,
  64        RDMA_USER_CM_CMD_MIGRATE_ID,
  65        RDMA_USER_CM_CMD_QUERY,
  66        RDMA_USER_CM_CMD_BIND,
  67        RDMA_USER_CM_CMD_RESOLVE_ADDR,
  68        RDMA_USER_CM_CMD_JOIN_MCAST
  69};
  70
  71/*
  72 * command ABI structures.
  73 */
  74struct rdma_ucm_cmd_hdr {
  75        __u32 cmd;
  76        __u16 in;
  77        __u16 out;
  78};
  79
  80struct rdma_ucm_create_id {
  81        __u64 uid;
  82        __u64 response;
  83        __u16 ps;
  84        __u8  qp_type;
  85        __u8  reserved[5];
  86};
  87
  88struct rdma_ucm_create_id_resp {
  89        __u32 id;
  90};
  91
  92struct rdma_ucm_destroy_id {
  93        __u64 response;
  94        __u32 id;
  95        __u32 reserved;
  96};
  97
  98struct rdma_ucm_destroy_id_resp {
  99        __u32 events_reported;
 100};
 101
 102struct rdma_ucm_bind_ip {
 103        __u64 response;
 104        struct sockaddr_in6 addr;
 105        __u32 id;
 106};
 107
 108struct rdma_ucm_bind {
 109        __u32 id;
 110        __u16 addr_size;
 111        __u16 reserved;
 112        struct sockaddr_storage addr;
 113};
 114
 115struct rdma_ucm_resolve_ip {
 116        struct sockaddr_in6 src_addr;
 117        struct sockaddr_in6 dst_addr;
 118        __u32 id;
 119        __u32 timeout_ms;
 120};
 121
 122struct rdma_ucm_resolve_addr {
 123        __u32 id;
 124        __u32 timeout_ms;
 125        __u16 src_size;
 126        __u16 dst_size;
 127        __u32 reserved;
 128        struct sockaddr_storage src_addr;
 129        struct sockaddr_storage dst_addr;
 130};
 131
 132struct rdma_ucm_resolve_route {
 133        __u32 id;
 134        __u32 timeout_ms;
 135};
 136
 137enum {
 138        RDMA_USER_CM_QUERY_ADDR,
 139        RDMA_USER_CM_QUERY_PATH,
 140        RDMA_USER_CM_QUERY_GID
 141};
 142
 143struct rdma_ucm_query {
 144        __u64 response;
 145        __u32 id;
 146        __u32 option;
 147};
 148
 149struct rdma_ucm_query_route_resp {
 150        __u64 node_guid;
 151        struct ib_user_path_rec ib_route[2];
 152        struct sockaddr_in6 src_addr;
 153        struct sockaddr_in6 dst_addr;
 154        __u32 num_paths;
 155        __u8 port_num;
 156        __u8 reserved[3];
 157};
 158
 159struct rdma_ucm_query_addr_resp {
 160        __u64 node_guid;
 161        __u8  port_num;
 162        __u8  reserved;
 163        __u16 pkey;
 164        __u16 src_size;
 165        __u16 dst_size;
 166        struct sockaddr_storage src_addr;
 167        struct sockaddr_storage dst_addr;
 168};
 169
 170struct rdma_ucm_query_path_resp {
 171        __u32 num_paths;
 172        __u32 reserved;
 173        struct ib_path_rec_data path_data[0];
 174};
 175
 176struct rdma_ucm_conn_param {
 177        __u32 qp_num;
 178        __u32 qkey;
 179        __u8  private_data[RDMA_MAX_PRIVATE_DATA];
 180        __u8  private_data_len;
 181        __u8  srq;
 182        __u8  responder_resources;
 183        __u8  initiator_depth;
 184        __u8  flow_control;
 185        __u8  retry_count;
 186        __u8  rnr_retry_count;
 187        __u8  valid;
 188};
 189
 190struct rdma_ucm_ud_param {
 191        __u32 qp_num;
 192        __u32 qkey;
 193        struct ib_uverbs_ah_attr ah_attr;
 194        __u8  private_data[RDMA_MAX_PRIVATE_DATA];
 195        __u8  private_data_len;
 196        __u8  reserved[7];
 197};
 198
 199struct rdma_ucm_connect {
 200        struct rdma_ucm_conn_param conn_param;
 201        __u32 id;
 202        __u32 reserved;
 203};
 204
 205struct rdma_ucm_listen {
 206        __u32 id;
 207        __u32 backlog;
 208};
 209
 210struct rdma_ucm_accept {
 211        __u64 uid;
 212        struct rdma_ucm_conn_param conn_param;
 213        __u32 id;
 214        __u32 reserved;
 215};
 216
 217struct rdma_ucm_reject {
 218        __u32 id;
 219        __u8  private_data_len;
 220        __u8  reserved[3];
 221        __u8  private_data[RDMA_MAX_PRIVATE_DATA];
 222};
 223
 224struct rdma_ucm_disconnect {
 225        __u32 id;
 226};
 227
 228struct rdma_ucm_init_qp_attr {
 229        __u64 response;
 230        __u32 id;
 231        __u32 qp_state;
 232};
 233
 234struct rdma_ucm_notify {
 235        __u32 id;
 236        __u32 event;
 237};
 238
 239struct rdma_ucm_join_ip_mcast {
 240        __u64 response;         /* rdma_ucm_create_id_resp */
 241        __u64 uid;
 242        struct sockaddr_in6 addr;
 243        __u32 id;
 244};
 245
 246struct rdma_ucm_join_mcast {
 247        __u64 response;         /* rdma_ucma_create_id_resp */
 248        __u64 uid;
 249        __u32 id;
 250        __u16 addr_size;
 251        __u16 reserved;
 252        struct sockaddr_storage addr;
 253};
 254
 255struct rdma_ucm_get_event {
 256        __u64 response;
 257};
 258
 259struct rdma_ucm_event_resp {
 260        __u64 uid;
 261        __u32 id;
 262        __u32 event;
 263        __u32 status;
 264        union {
 265                struct rdma_ucm_conn_param conn;
 266                struct rdma_ucm_ud_param   ud;
 267        } param;
 268};
 269
 270/* Option levels */
 271enum {
 272        RDMA_OPTION_ID          = 0,
 273        RDMA_OPTION_IB          = 1
 274};
 275
 276/* Option details */
 277enum {
 278        RDMA_OPTION_ID_TOS       = 0,
 279        RDMA_OPTION_ID_REUSEADDR = 1,
 280        RDMA_OPTION_ID_AFONLY    = 2,
 281        RDMA_OPTION_IB_PATH      = 1
 282};
 283
 284struct rdma_ucm_set_option {
 285        __u64 optval;
 286        __u32 id;
 287        __u32 level;
 288        __u32 optname;
 289        __u32 optlen;
 290};
 291
 292struct rdma_ucm_migrate_id {
 293        __u64 response;
 294        __u32 id;
 295        __u32 fd;
 296};
 297
 298struct rdma_ucm_migrate_resp {
 299        __u32 events_reported;
 300};
 301
 302#endif /* RDMA_USER_CM_H */
 303