1219820Sjeff/* 2219820Sjeff * Copyright (c) 2005-2006 Intel Corporation. All rights reserved. 3219820Sjeff * 4219820Sjeff * This software is available to you under a choice of one of two 5219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 6219820Sjeff * General Public License (GPL) Version 2, available from the file 7219820Sjeff * COPYING in the main directory of this source tree, or the 8219820Sjeff * OpenIB.org BSD license below: 9219820Sjeff * 10219820Sjeff * Redistribution and use in source and binary forms, with or 11219820Sjeff * without modification, are permitted provided that the following 12219820Sjeff * conditions are met: 13219820Sjeff * 14219820Sjeff * - Redistributions of source code must retain the above 15219820Sjeff * copyright notice, this list of conditions and the following 16219820Sjeff * disclaimer. 17219820Sjeff * 18219820Sjeff * - Redistributions in binary form must reproduce the above 19219820Sjeff * copyright notice, this list of conditions and the following 20219820Sjeff * disclaimer in the documentation and/or other materials 21219820Sjeff * provided with the distribution. 22219820Sjeff * 23219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30219820Sjeff * SOFTWARE. 31219820Sjeff */ 32219820Sjeff 33219820Sjeff#ifndef RDMA_USER_CM_H 34219820Sjeff#define RDMA_USER_CM_H 35219820Sjeff 36219820Sjeff#include <linux/types.h> 37219820Sjeff#include <linux/in6.h> 38219820Sjeff#include <rdma/ib_user_verbs.h> 39219820Sjeff#include <rdma/ib_user_sa.h> 40219820Sjeff 41219820Sjeff#define RDMA_USER_CM_ABI_VERSION 4 42219820Sjeff 43219820Sjeff#define RDMA_MAX_PRIVATE_DATA 256 44219820Sjeff 45219820Sjeffenum { 46219820Sjeff RDMA_USER_CM_CMD_CREATE_ID, 47219820Sjeff RDMA_USER_CM_CMD_DESTROY_ID, 48219820Sjeff RDMA_USER_CM_CMD_BIND_ADDR, 49219820Sjeff RDMA_USER_CM_CMD_RESOLVE_ADDR, 50219820Sjeff RDMA_USER_CM_CMD_RESOLVE_ROUTE, 51219820Sjeff RDMA_USER_CM_CMD_QUERY_ROUTE, 52219820Sjeff RDMA_USER_CM_CMD_CONNECT, 53219820Sjeff RDMA_USER_CM_CMD_LISTEN, 54219820Sjeff RDMA_USER_CM_CMD_ACCEPT, 55219820Sjeff RDMA_USER_CM_CMD_REJECT, 56219820Sjeff RDMA_USER_CM_CMD_DISCONNECT, 57219820Sjeff RDMA_USER_CM_CMD_INIT_QP_ATTR, 58219820Sjeff RDMA_USER_CM_CMD_GET_EVENT, 59219820Sjeff RDMA_USER_CM_CMD_GET_OPTION, 60219820Sjeff RDMA_USER_CM_CMD_SET_OPTION, 61219820Sjeff RDMA_USER_CM_CMD_NOTIFY, 62219820Sjeff RDMA_USER_CM_CMD_JOIN_MCAST, 63219820Sjeff RDMA_USER_CM_CMD_LEAVE_MCAST, 64219820Sjeff RDMA_USER_CM_CMD_MIGRATE_ID 65219820Sjeff}; 66219820Sjeff 67219820Sjeff/* 68219820Sjeff * command ABI structures. 69219820Sjeff */ 70219820Sjeffstruct rdma_ucm_cmd_hdr { 71219820Sjeff __u32 cmd; 72219820Sjeff __u16 in; 73219820Sjeff __u16 out; 74219820Sjeff}; 75219820Sjeff 76219820Sjeffstruct rdma_ucm_create_id { 77219820Sjeff __u64 uid; 78219820Sjeff __u64 response; 79219820Sjeff __u16 ps; 80219820Sjeff __u8 reserved[6]; 81219820Sjeff}; 82219820Sjeff 83219820Sjeffstruct rdma_ucm_create_id_resp { 84219820Sjeff __u32 id; 85219820Sjeff}; 86219820Sjeff 87219820Sjeffstruct rdma_ucm_destroy_id { 88219820Sjeff __u64 response; 89219820Sjeff __u32 id; 90219820Sjeff __u32 reserved; 91219820Sjeff}; 92219820Sjeff 93219820Sjeffstruct rdma_ucm_destroy_id_resp { 94219820Sjeff __u32 events_reported; 95219820Sjeff}; 96219820Sjeff 97219820Sjeffstruct rdma_ucm_bind_addr { 98219820Sjeff __u64 response; 99219820Sjeff struct sockaddr_in6 addr; 100219820Sjeff __u32 id; 101219820Sjeff}; 102219820Sjeff 103219820Sjeffstruct rdma_ucm_resolve_addr { 104219820Sjeff struct sockaddr_in6 src_addr; 105219820Sjeff struct sockaddr_in6 dst_addr; 106219820Sjeff __u32 id; 107219820Sjeff __u32 timeout_ms; 108219820Sjeff}; 109219820Sjeff 110219820Sjeffstruct rdma_ucm_resolve_route { 111219820Sjeff __u32 id; 112219820Sjeff __u32 timeout_ms; 113219820Sjeff}; 114219820Sjeff 115219820Sjeffstruct rdma_ucm_query_route { 116219820Sjeff __u64 response; 117219820Sjeff __u32 id; 118219820Sjeff __u32 reserved; 119219820Sjeff}; 120219820Sjeff 121219820Sjeffstruct rdma_ucm_query_route_resp { 122219820Sjeff __u64 node_guid; 123219820Sjeff struct ib_user_path_rec ib_route[2]; 124219820Sjeff struct sockaddr_in6 src_addr; 125219820Sjeff struct sockaddr_in6 dst_addr; 126219820Sjeff __u32 num_paths; 127219820Sjeff __u8 port_num; 128219820Sjeff __u8 reserved[3]; 129219820Sjeff}; 130219820Sjeff 131219820Sjeffstruct rdma_ucm_conn_param { 132219820Sjeff __u32 qp_num; 133219820Sjeff __u32 reserved; 134219820Sjeff __u8 private_data[RDMA_MAX_PRIVATE_DATA]; 135219820Sjeff __u8 private_data_len; 136219820Sjeff __u8 srq; 137219820Sjeff __u8 responder_resources; 138219820Sjeff __u8 initiator_depth; 139219820Sjeff __u8 flow_control; 140219820Sjeff __u8 retry_count; 141219820Sjeff __u8 rnr_retry_count; 142219820Sjeff __u8 valid; 143219820Sjeff}; 144219820Sjeff 145219820Sjeffstruct rdma_ucm_ud_param { 146219820Sjeff __u32 qp_num; 147219820Sjeff __u32 qkey; 148219820Sjeff struct ib_uverbs_ah_attr ah_attr; 149219820Sjeff __u8 private_data[RDMA_MAX_PRIVATE_DATA]; 150219820Sjeff __u8 private_data_len; 151219820Sjeff __u8 reserved[7]; 152219820Sjeff}; 153219820Sjeff 154219820Sjeffstruct rdma_ucm_connect { 155219820Sjeff struct rdma_ucm_conn_param conn_param; 156219820Sjeff __u32 id; 157219820Sjeff __u32 reserved; 158219820Sjeff}; 159219820Sjeff 160219820Sjeffstruct rdma_ucm_listen { 161219820Sjeff __u32 id; 162219820Sjeff __u32 backlog; 163219820Sjeff}; 164219820Sjeff 165219820Sjeffstruct rdma_ucm_accept { 166219820Sjeff __u64 uid; 167219820Sjeff struct rdma_ucm_conn_param conn_param; 168219820Sjeff __u32 id; 169219820Sjeff __u32 reserved; 170219820Sjeff}; 171219820Sjeff 172219820Sjeffstruct rdma_ucm_reject { 173219820Sjeff __u32 id; 174219820Sjeff __u8 private_data_len; 175219820Sjeff __u8 reserved[3]; 176219820Sjeff __u8 private_data[RDMA_MAX_PRIVATE_DATA]; 177219820Sjeff}; 178219820Sjeff 179219820Sjeffstruct rdma_ucm_disconnect { 180219820Sjeff __u32 id; 181219820Sjeff}; 182219820Sjeff 183219820Sjeffstruct rdma_ucm_init_qp_attr { 184219820Sjeff __u64 response; 185219820Sjeff __u32 id; 186219820Sjeff __u32 qp_state; 187219820Sjeff}; 188219820Sjeff 189219820Sjeffstruct rdma_ucm_notify { 190219820Sjeff __u32 id; 191219820Sjeff __u32 event; 192219820Sjeff}; 193219820Sjeff 194219820Sjeffstruct rdma_ucm_join_mcast { 195219820Sjeff __u64 response; /* rdma_ucm_create_id_resp */ 196219820Sjeff __u64 uid; 197219820Sjeff struct sockaddr_in6 addr; 198219820Sjeff __u32 id; 199219820Sjeff}; 200219820Sjeff 201219820Sjeffstruct rdma_ucm_get_event { 202219820Sjeff __u64 response; 203219820Sjeff}; 204219820Sjeff 205219820Sjeffstruct rdma_ucm_event_resp { 206219820Sjeff __u64 uid; 207219820Sjeff __u32 id; 208219820Sjeff __u32 event; 209219820Sjeff __u32 status; 210219820Sjeff union { 211219820Sjeff struct rdma_ucm_conn_param conn; 212219820Sjeff struct rdma_ucm_ud_param ud; 213219820Sjeff } param; 214219820Sjeff}; 215219820Sjeff 216219820Sjeff/* Option levels */ 217219820Sjeffenum { 218219820Sjeff RDMA_OPTION_ID = 0, 219219820Sjeff RDMA_OPTION_IB = 1 220219820Sjeff}; 221219820Sjeff 222219820Sjeff/* Option details */ 223219820Sjeffenum { 224219820Sjeff RDMA_OPTION_ID_TOS = 0, 225219820Sjeff RDMA_OPTION_IB_PATH = 1 226219820Sjeff}; 227219820Sjeff 228219820Sjeffstruct rdma_ucm_set_option { 229219820Sjeff __u64 optval; 230219820Sjeff __u32 id; 231219820Sjeff __u32 level; 232219820Sjeff __u32 optname; 233219820Sjeff __u32 optlen; 234219820Sjeff}; 235219820Sjeff 236219820Sjeffstruct rdma_ucm_migrate_id { 237219820Sjeff __u64 response; 238219820Sjeff __u32 id; 239219820Sjeff __u32 fd; 240219820Sjeff}; 241219820Sjeff 242219820Sjeffstruct rdma_ucm_migrate_resp { 243219820Sjeff __u32 events_reported; 244219820Sjeff}; 245219820Sjeff 246219820Sjeff#endif /* RDMA_USER_CM_H */ 247