^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2004, 2005 Intel Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2004 Topspin Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Copyright (c) 2019, Mellanox Technologies inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #ifndef IB_CM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #define IB_CM_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <rdma/ib_mad.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <rdma/ib_sa.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <rdma/rdma_cm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) enum ib_cm_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) IB_CM_IDLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) IB_CM_LISTEN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) IB_CM_REQ_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) IB_CM_REQ_RCVD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) IB_CM_MRA_REQ_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) IB_CM_MRA_REQ_RCVD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) IB_CM_REP_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) IB_CM_REP_RCVD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) IB_CM_MRA_REP_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) IB_CM_MRA_REP_RCVD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) IB_CM_ESTABLISHED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) IB_CM_DREQ_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) IB_CM_DREQ_RCVD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) IB_CM_TIMEWAIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) IB_CM_SIDR_REQ_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) IB_CM_SIDR_REQ_RCVD
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) enum ib_cm_lap_state {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) IB_CM_LAP_UNINIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) IB_CM_LAP_IDLE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) IB_CM_LAP_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) IB_CM_LAP_RCVD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) IB_CM_MRA_LAP_SENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) IB_CM_MRA_LAP_RCVD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) enum ib_cm_event_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) IB_CM_REQ_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) IB_CM_REQ_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) IB_CM_REP_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) IB_CM_REP_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) IB_CM_RTU_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) IB_CM_USER_ESTABLISHED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) IB_CM_DREQ_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) IB_CM_DREQ_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) IB_CM_DREP_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) IB_CM_TIMEWAIT_EXIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) IB_CM_MRA_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) IB_CM_REJ_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) IB_CM_LAP_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) IB_CM_LAP_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) IB_CM_APR_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) IB_CM_SIDR_REQ_ERROR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) IB_CM_SIDR_REQ_RECEIVED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) IB_CM_SIDR_REP_RECEIVED
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) enum ib_cm_data_size {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) IB_CM_REQ_PRIVATE_DATA_SIZE = 92,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) IB_CM_MRA_PRIVATE_DATA_SIZE = 222,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) IB_CM_REJ_PRIVATE_DATA_SIZE = 148,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) IB_CM_REP_PRIVATE_DATA_SIZE = 196,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) IB_CM_RTU_PRIVATE_DATA_SIZE = 224,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) IB_CM_DREQ_PRIVATE_DATA_SIZE = 220,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) IB_CM_DREP_PRIVATE_DATA_SIZE = 224,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) IB_CM_REJ_ARI_LENGTH = 72,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) IB_CM_LAP_PRIVATE_DATA_SIZE = 168,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) IB_CM_APR_PRIVATE_DATA_SIZE = 148,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) IB_CM_APR_INFO_LENGTH = 72,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) IB_CM_SIDR_REQ_PRIVATE_DATA_SIZE = 216,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) IB_CM_SIDR_REP_PRIVATE_DATA_SIZE = 136,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) IB_CM_SIDR_REP_INFO_LENGTH = 72,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) struct ib_cm_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) struct ib_cm_req_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct ib_cm_id *listen_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) /* P_Key that was used by the GMP's BTH header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) u16 bth_pkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) u8 port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) struct sa_path_rec *primary_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) struct sa_path_rec *alternate_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * SGID attribute of the primary path. Currently only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * useful for RoCE. Alternate path GID attributes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * are not yet supported.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) const struct ib_gid_attr *ppath_sgid_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) __be64 remote_ca_guid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) u32 remote_qkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) u32 remote_qpn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) enum ib_qp_type qp_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) u32 starting_psn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) u8 responder_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) u8 initiator_depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) unsigned int local_cm_response_timeout:5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) unsigned int flow_control:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) unsigned int remote_cm_response_timeout:5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) unsigned int retry_count:3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) unsigned int rnr_retry_count:3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) unsigned int srq:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) struct rdma_ucm_ece ece;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct ib_cm_rep_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) __be64 remote_ca_guid;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) u32 remote_qkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) u32 remote_qpn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) u32 starting_psn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) u8 responder_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) u8 initiator_depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) unsigned int target_ack_delay:5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) unsigned int failover_accepted:2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) unsigned int flow_control:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) unsigned int rnr_retry_count:3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) unsigned int srq:1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) struct rdma_ucm_ece ece;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) enum ib_cm_rej_reason {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) IB_CM_REJ_NO_QP = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) IB_CM_REJ_NO_EEC = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) IB_CM_REJ_NO_RESOURCES = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) IB_CM_REJ_TIMEOUT = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) IB_CM_REJ_UNSUPPORTED = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) IB_CM_REJ_INVALID_COMM_ID = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) IB_CM_REJ_INVALID_COMM_INSTANCE = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) IB_CM_REJ_INVALID_SERVICE_ID = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) IB_CM_REJ_INVALID_TRANSPORT_TYPE = 9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) IB_CM_REJ_STALE_CONN = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) IB_CM_REJ_RDC_NOT_EXIST = 11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) IB_CM_REJ_INVALID_GID = 12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) IB_CM_REJ_INVALID_LID = 13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) IB_CM_REJ_INVALID_SL = 14,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) IB_CM_REJ_INVALID_TRAFFIC_CLASS = 15,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) IB_CM_REJ_INVALID_HOP_LIMIT = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) IB_CM_REJ_INVALID_PACKET_RATE = 17,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) IB_CM_REJ_INVALID_ALT_GID = 18,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) IB_CM_REJ_INVALID_ALT_LID = 19,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) IB_CM_REJ_INVALID_ALT_SL = 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS = 21,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) IB_CM_REJ_INVALID_ALT_HOP_LIMIT = 22,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) IB_CM_REJ_INVALID_ALT_PACKET_RATE = 23,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) IB_CM_REJ_PORT_CM_REDIRECT = 24,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) IB_CM_REJ_PORT_REDIRECT = 25,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) IB_CM_REJ_INVALID_MTU = 26,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES = 27,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) IB_CM_REJ_CONSUMER_DEFINED = 28,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) IB_CM_REJ_INVALID_RNR_RETRY = 29,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID = 30,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) IB_CM_REJ_INVALID_CLASS_VERSION = 31,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) IB_CM_REJ_INVALID_FLOW_LABEL = 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) IB_CM_REJ_INVALID_ALT_FLOW_LABEL = 33,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) IB_CM_REJ_VENDOR_OPTION_NOT_SUPPORTED = 35,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) struct ib_cm_rej_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) enum ib_cm_rej_reason reason;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) void *ari;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) u8 ari_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) struct ib_cm_mra_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) u8 service_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) struct ib_cm_lap_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) struct sa_path_rec *alternate_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) enum ib_cm_apr_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) IB_CM_APR_SUCCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) IB_CM_APR_INVALID_COMM_ID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) IB_CM_APR_UNSUPPORTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) IB_CM_APR_REJECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) IB_CM_APR_REDIRECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) IB_CM_APR_IS_CURRENT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) IB_CM_APR_INVALID_QPN_EECN,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) IB_CM_APR_INVALID_LID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) IB_CM_APR_INVALID_GID,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) IB_CM_APR_INVALID_FLOW_LABEL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) IB_CM_APR_INVALID_TCLASS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) IB_CM_APR_INVALID_HOP_LIMIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) IB_CM_APR_INVALID_PACKET_RATE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) IB_CM_APR_INVALID_SL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) struct ib_cm_apr_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) enum ib_cm_apr_status ap_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) void *apr_info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) u8 info_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) struct ib_cm_sidr_req_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct ib_cm_id *listen_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) __be64 service_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) * SGID attribute of the request. Currently only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * useful for RoCE.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) const struct ib_gid_attr *sgid_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) /* P_Key that was used by the GMP's BTH header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) u16 bth_pkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) u8 port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) u16 pkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) enum ib_cm_sidr_status {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) IB_SIDR_SUCCESS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) IB_SIDR_UNSUPPORTED,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) IB_SIDR_REJECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) IB_SIDR_NO_QP,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) IB_SIDR_REDIRECT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) IB_SIDR_UNSUPPORTED_VERSION
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) struct ib_cm_sidr_rep_event_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) enum ib_cm_sidr_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) u32 qkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) u32 qpn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) void *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) const struct ib_gid_attr *sgid_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) u8 info_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) struct ib_cm_event {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) enum ib_cm_event_type event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) struct ib_cm_req_event_param req_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) struct ib_cm_rep_event_param rep_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) /* No data for RTU received events. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) struct ib_cm_rej_event_param rej_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) struct ib_cm_mra_event_param mra_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) struct ib_cm_lap_event_param lap_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) struct ib_cm_apr_event_param apr_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) /* No data for DREQ/DREP received events. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) struct ib_cm_sidr_req_event_param sidr_req_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) struct ib_cm_sidr_rep_event_param sidr_rep_rcvd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) enum ib_wc_status send_status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) } param;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #define CM_REQ_ATTR_ID cpu_to_be16(0x0010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #define CM_MRA_ATTR_ID cpu_to_be16(0x0011)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) #define CM_REJ_ATTR_ID cpu_to_be16(0x0012)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) #define CM_REP_ATTR_ID cpu_to_be16(0x0013)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) #define CM_RTU_ATTR_ID cpu_to_be16(0x0014)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) #define CM_DREQ_ATTR_ID cpu_to_be16(0x0015)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) #define CM_DREP_ATTR_ID cpu_to_be16(0x0016)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) #define CM_SIDR_REQ_ATTR_ID cpu_to_be16(0x0017)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) #define CM_SIDR_REP_ATTR_ID cpu_to_be16(0x0018)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) #define CM_LAP_ATTR_ID cpu_to_be16(0x0019)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) #define CM_APR_ATTR_ID cpu_to_be16(0x001A)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * ib_cm_handler - User-defined callback to process communication events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) * @cm_id: Communication identifier associated with the reported event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) * @event: Information about the communication event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) * IB_CM_REQ_RECEIVED and IB_CM_SIDR_REQ_RECEIVED communication events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) * generated as a result of listen requests result in the allocation of a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * new @cm_id. The new @cm_id is returned to the user through this callback.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) * Clients are responsible for destroying the new @cm_id. For peer-to-peer
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) * IB_CM_REQ_RECEIVED and all other events, the returned @cm_id corresponds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) * to a user's existing communication identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) * Users may not call ib_destroy_cm_id while in the context of this callback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) * however, returning a non-zero value instructs the communication manager to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) * destroy the @cm_id after the callback completes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) typedef int (*ib_cm_handler)(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) const struct ib_cm_event *event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) struct ib_cm_id {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) ib_cm_handler cm_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) void *context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) struct ib_device *device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) __be64 service_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) __be64 service_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) enum ib_cm_state state; /* internal CM/debug use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) enum ib_cm_lap_state lap_state; /* internal CM/debug use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) __be32 local_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) __be32 remote_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) u32 remote_cm_qpn; /* 1 unless redirected */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) * ib_create_cm_id - Allocate a communication identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) * @device: Device associated with the cm_id. All related communication will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) * be associated with the specified device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) * @cm_handler: Callback invoked to notify the user of CM events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) * @context: User specified context associated with the communication
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) * identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * Communication identifiers are used to track connection states, service
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) * ID resolution requests, and listen requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) struct ib_cm_id *ib_create_cm_id(struct ib_device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) ib_cm_handler cm_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) void *context);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) * ib_destroy_cm_id - Destroy a connection identifier.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) * @cm_id: Connection identifier to destroy.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) * This call blocks until the connection identifier is destroyed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) void ib_destroy_cm_id(struct ib_cm_id *cm_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) #define IB_SERVICE_ID_AGN_MASK cpu_to_be64(0xFF00000000000000ULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) #define IB_CM_ASSIGN_SERVICE_ID cpu_to_be64(0x0200000000000000ULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) #define IB_CMA_SERVICE_ID cpu_to_be64(0x0000000001000000ULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) #define IB_CMA_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFF000000ULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) #define IB_SDP_SERVICE_ID cpu_to_be64(0x0000000000010000ULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) #define IB_SDP_SERVICE_ID_MASK cpu_to_be64(0xFFFFFFFFFFFF0000ULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) * ib_cm_listen - Initiates listening on the specified service ID for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) * connection and service ID resolution requests.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) * @cm_id: Connection identifier associated with the listen request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) * @service_id: Service identifier matched against incoming connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) * and service ID resolution requests. The service ID should be specified
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * network-byte order. If set to IB_CM_ASSIGN_SERVICE_ID, the CM will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * assign a service ID to the caller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) * @service_mask: Mask applied to service ID used to listen across a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) * range of service IDs. If set to 0, the service ID is matched
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) * exactly. This parameter is ignored if %service_id is set to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) * IB_CM_ASSIGN_SERVICE_ID.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) int ib_cm_listen(struct ib_cm_id *cm_id, __be64 service_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) __be64 service_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) ib_cm_handler cm_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) __be64 service_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) struct ib_cm_req_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) struct sa_path_rec *primary_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) struct sa_path_rec *alternate_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) const struct ib_gid_attr *ppath_sgid_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) __be64 service_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) u32 qp_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) enum ib_qp_type qp_type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) u32 starting_psn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) const void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) u8 private_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) u8 responder_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) u8 initiator_depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) u8 remote_cm_response_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) u8 flow_control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) u8 local_cm_response_timeout;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) u8 retry_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) u8 rnr_retry_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) u8 max_cm_retries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) u8 srq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) struct rdma_ucm_ece ece;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) * ib_send_cm_req - Sends a connection request to the remote node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) * @cm_id: Connection identifier that will be associated with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) * connection request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) * @param: Connection request information needed to establish the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) * connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) int ib_send_cm_req(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) struct ib_cm_req_param *param);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) struct ib_cm_rep_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) u32 qp_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) u32 starting_psn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) const void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) u8 private_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) u8 responder_resources;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) u8 initiator_depth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) u8 failover_accepted;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) u8 flow_control;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) u8 rnr_retry_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) u8 srq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) struct rdma_ucm_ece ece;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) * ib_send_cm_rep - Sends a connection reply in response to a connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) * request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) * @cm_id: Connection identifier that will be associated with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) * connection request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) * @param: Connection reply information needed to establish the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) int ib_send_cm_rep(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) struct ib_cm_rep_param *param);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) * ib_send_cm_rtu - Sends a connection ready to use message in response
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) * to a connection reply message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) * @cm_id: Connection identifier associated with the connection request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) * @private_data: Optional user-defined private data sent with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) * ready to use message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) * @private_data_len: Size of the private data buffer, in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) int ib_send_cm_rtu(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) const void *private_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) u8 private_data_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) * ib_send_cm_dreq - Sends a disconnection request for an existing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) * connection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * @cm_id: Connection identifier associated with the connection being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * released.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * @private_data: Optional user-defined private data sent with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) * disconnection request message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * @private_data_len: Size of the private data buffer, in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) int ib_send_cm_dreq(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) const void *private_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) u8 private_data_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) * ib_send_cm_drep - Sends a disconnection reply to a disconnection request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) * @cm_id: Connection identifier associated with the connection being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) * released.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) * @private_data: Optional user-defined private data sent with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) * disconnection reply message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) * @private_data_len: Size of the private data buffer, in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) * If the cm_id is in the correct state, the CM will transition the connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) * to the timewait state, even if an error occurs sending the DREP message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) int ib_send_cm_drep(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) const void *private_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) u8 private_data_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) * ib_cm_notify - Notifies the CM of an event reported to the consumer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) * @cm_id: Connection identifier to transition to established.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) * @event: Type of event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) * This routine should be invoked by users to notify the CM of relevant
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) * communication events. Events that should be reported to the CM and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) * when to report them are:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) * IB_EVENT_COMM_EST - Used when a message is received on a connected
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) * QP before an RTU has been received.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) * IB_EVENT_PATH_MIG - Notifies the CM that the connection has failed over
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) * to the alternate path.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) int ib_cm_notify(struct ib_cm_id *cm_id, enum ib_event_type event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469) * ib_send_cm_rej - Sends a connection rejection message to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) * remote node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) * @cm_id: Connection identifier associated with the connection being
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) * rejected.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) * @reason: Reason for the connection request rejection.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) * @ari: Optional additional rejection information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) * @ari_length: Size of the additional rejection information, in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) * @private_data: Optional user-defined private data sent with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) * rejection message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) * @private_data_len: Size of the private data buffer, in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) int ib_send_cm_rej(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) enum ib_cm_rej_reason reason,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) void *ari,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) u8 ari_length,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) const void *private_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) u8 private_data_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) #define IB_CM_MRA_FLAG_DELAY 0x80 /* Send MRA only after a duplicate msg */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) * ib_send_cm_mra - Sends a message receipt acknowledgement to a connection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) * message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) * @cm_id: Connection identifier associated with the connection message.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) * @service_timeout: The lower 5-bits specify the maximum time required for
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494) * the sender to reply to the connection message. The upper 3-bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) * specify additional control flags.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) * @private_data: Optional user-defined private data sent with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) * message receipt acknowledgement.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) * @private_data_len: Size of the private data buffer, in bytes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) int ib_send_cm_mra(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) u8 service_timeout,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) const void *private_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) u8 private_data_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) * ib_cm_init_qp_attr - Initializes the QP attributes for use in transitioning
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507) * to a specified QP state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) * @cm_id: Communication identifier associated with the QP attributes to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) * initialize.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) * @qp_attr: On input, specifies the desired QP state. On output, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) * mandatory and desired optional attributes will be set in order to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) * modify the QP to the specified state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) * @qp_attr_mask: The QP attribute mask that may be used to transition the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514) * QP to the specified state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) * Users must set the @qp_attr->qp_state to the desired QP state. This call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517) * will set all required attributes for the given transition, along with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) * known optional attributes. Users may override the attributes returned from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) * this call before calling ib_modify_qp.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) int ib_cm_init_qp_attr(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) struct ib_qp_attr *qp_attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) int *qp_attr_mask);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525) struct ib_cm_sidr_req_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) struct sa_path_rec *path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) const struct ib_gid_attr *sgid_attr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) __be64 service_id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) unsigned long timeout_ms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) const void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) u8 private_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) u8 max_cm_retries;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) * ib_send_cm_sidr_req - Sends a service ID resolution request to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) * remote node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) * @cm_id: Communication identifier that will be associated with the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) * service ID resolution request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) * @param: Service ID resolution request information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) int ib_send_cm_sidr_req(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) struct ib_cm_sidr_req_param *param);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) struct ib_cm_sidr_rep_param {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546) u32 qp_num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) u32 qkey;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) enum ib_cm_sidr_status status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) const void *info;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) u8 info_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551) const void *private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) u8 private_data_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) struct rdma_ucm_ece ece;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557) * ib_send_cm_sidr_rep - Sends a service ID resolution reply to the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) * remote node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) * @cm_id: Communication identifier associated with the received service ID
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) * resolution request.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) * @param: Service ID resolution reply information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) int ib_send_cm_sidr_rep(struct ib_cm_id *cm_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564) struct ib_cm_sidr_rep_param *param);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) * ibcm_reject_msg - return a pointer to a reject message string.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568) * @reason: Value returned in the REJECT event status field.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) const char *__attribute_const__ ibcm_reject_msg(int reason);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572) #endif /* IB_CM_H */