0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #ifndef __PVRDMA_VERBS_H__
0047 #define __PVRDMA_VERBS_H__
0048
0049 #include <linux/types.h>
0050
0051 union pvrdma_gid {
0052 u8 raw[16];
0053 struct {
0054 __be64 subnet_prefix;
0055 __be64 interface_id;
0056 } global;
0057 };
0058
0059 enum pvrdma_link_layer {
0060 PVRDMA_LINK_LAYER_UNSPECIFIED,
0061 PVRDMA_LINK_LAYER_INFINIBAND,
0062 PVRDMA_LINK_LAYER_ETHERNET,
0063 };
0064
0065 enum pvrdma_mtu {
0066 PVRDMA_MTU_256 = 1,
0067 PVRDMA_MTU_512 = 2,
0068 PVRDMA_MTU_1024 = 3,
0069 PVRDMA_MTU_2048 = 4,
0070 PVRDMA_MTU_4096 = 5,
0071 };
0072
0073 enum pvrdma_port_state {
0074 PVRDMA_PORT_NOP = 0,
0075 PVRDMA_PORT_DOWN = 1,
0076 PVRDMA_PORT_INIT = 2,
0077 PVRDMA_PORT_ARMED = 3,
0078 PVRDMA_PORT_ACTIVE = 4,
0079 PVRDMA_PORT_ACTIVE_DEFER = 5,
0080 };
0081
0082 enum pvrdma_port_cap_flags {
0083 PVRDMA_PORT_SM = 1 << 1,
0084 PVRDMA_PORT_NOTICE_SUP = 1 << 2,
0085 PVRDMA_PORT_TRAP_SUP = 1 << 3,
0086 PVRDMA_PORT_OPT_IPD_SUP = 1 << 4,
0087 PVRDMA_PORT_AUTO_MIGR_SUP = 1 << 5,
0088 PVRDMA_PORT_SL_MAP_SUP = 1 << 6,
0089 PVRDMA_PORT_MKEY_NVRAM = 1 << 7,
0090 PVRDMA_PORT_PKEY_NVRAM = 1 << 8,
0091 PVRDMA_PORT_LED_INFO_SUP = 1 << 9,
0092 PVRDMA_PORT_SM_DISABLED = 1 << 10,
0093 PVRDMA_PORT_SYS_IMAGE_GUID_SUP = 1 << 11,
0094 PVRDMA_PORT_PKEY_SW_EXT_PORT_TRAP_SUP = 1 << 12,
0095 PVRDMA_PORT_EXTENDED_SPEEDS_SUP = 1 << 14,
0096 PVRDMA_PORT_CM_SUP = 1 << 16,
0097 PVRDMA_PORT_SNMP_TUNNEL_SUP = 1 << 17,
0098 PVRDMA_PORT_REINIT_SUP = 1 << 18,
0099 PVRDMA_PORT_DEVICE_MGMT_SUP = 1 << 19,
0100 PVRDMA_PORT_VENDOR_CLASS_SUP = 1 << 20,
0101 PVRDMA_PORT_DR_NOTICE_SUP = 1 << 21,
0102 PVRDMA_PORT_CAP_MASK_NOTICE_SUP = 1 << 22,
0103 PVRDMA_PORT_BOOT_MGMT_SUP = 1 << 23,
0104 PVRDMA_PORT_LINK_LATENCY_SUP = 1 << 24,
0105 PVRDMA_PORT_CLIENT_REG_SUP = 1 << 25,
0106 PVRDMA_PORT_IP_BASED_GIDS = 1 << 26,
0107 PVRDMA_PORT_CAP_FLAGS_MAX = PVRDMA_PORT_IP_BASED_GIDS,
0108 };
0109
0110 enum pvrdma_port_width {
0111 PVRDMA_WIDTH_1X = 1,
0112 PVRDMA_WIDTH_4X = 2,
0113 PVRDMA_WIDTH_8X = 4,
0114 PVRDMA_WIDTH_12X = 8,
0115 };
0116
0117 enum pvrdma_port_speed {
0118 PVRDMA_SPEED_SDR = 1,
0119 PVRDMA_SPEED_DDR = 2,
0120 PVRDMA_SPEED_QDR = 4,
0121 PVRDMA_SPEED_FDR10 = 8,
0122 PVRDMA_SPEED_FDR = 16,
0123 PVRDMA_SPEED_EDR = 32,
0124 };
0125
0126 struct pvrdma_port_attr {
0127 enum pvrdma_port_state state;
0128 enum pvrdma_mtu max_mtu;
0129 enum pvrdma_mtu active_mtu;
0130 u32 gid_tbl_len;
0131 u32 port_cap_flags;
0132 u32 max_msg_sz;
0133 u32 bad_pkey_cntr;
0134 u32 qkey_viol_cntr;
0135 u16 pkey_tbl_len;
0136 u16 lid;
0137 u16 sm_lid;
0138 u8 lmc;
0139 u8 max_vl_num;
0140 u8 sm_sl;
0141 u8 subnet_timeout;
0142 u8 init_type_reply;
0143 u8 active_width;
0144 u8 active_speed;
0145 u8 phys_state;
0146 u8 reserved[2];
0147 };
0148
0149 struct pvrdma_global_route {
0150 union pvrdma_gid dgid;
0151 u32 flow_label;
0152 u8 sgid_index;
0153 u8 hop_limit;
0154 u8 traffic_class;
0155 u8 reserved;
0156 };
0157
0158 struct pvrdma_grh {
0159 __be32 version_tclass_flow;
0160 __be16 paylen;
0161 u8 next_hdr;
0162 u8 hop_limit;
0163 union pvrdma_gid sgid;
0164 union pvrdma_gid dgid;
0165 };
0166
0167 enum pvrdma_ah_flags {
0168 PVRDMA_AH_GRH = 1,
0169 };
0170
0171 enum pvrdma_rate {
0172 PVRDMA_RATE_PORT_CURRENT = 0,
0173 PVRDMA_RATE_2_5_GBPS = 2,
0174 PVRDMA_RATE_5_GBPS = 5,
0175 PVRDMA_RATE_10_GBPS = 3,
0176 PVRDMA_RATE_20_GBPS = 6,
0177 PVRDMA_RATE_30_GBPS = 4,
0178 PVRDMA_RATE_40_GBPS = 7,
0179 PVRDMA_RATE_60_GBPS = 8,
0180 PVRDMA_RATE_80_GBPS = 9,
0181 PVRDMA_RATE_120_GBPS = 10,
0182 PVRDMA_RATE_14_GBPS = 11,
0183 PVRDMA_RATE_56_GBPS = 12,
0184 PVRDMA_RATE_112_GBPS = 13,
0185 PVRDMA_RATE_168_GBPS = 14,
0186 PVRDMA_RATE_25_GBPS = 15,
0187 PVRDMA_RATE_100_GBPS = 16,
0188 PVRDMA_RATE_200_GBPS = 17,
0189 PVRDMA_RATE_300_GBPS = 18,
0190 };
0191
0192 struct pvrdma_ah_attr {
0193 struct pvrdma_global_route grh;
0194 u16 dlid;
0195 u16 vlan_id;
0196 u8 sl;
0197 u8 src_path_bits;
0198 u8 static_rate;
0199 u8 ah_flags;
0200 u8 port_num;
0201 u8 dmac[6];
0202 u8 reserved;
0203 };
0204
0205 enum pvrdma_cq_notify_flags {
0206 PVRDMA_CQ_SOLICITED = 1 << 0,
0207 PVRDMA_CQ_NEXT_COMP = 1 << 1,
0208 PVRDMA_CQ_SOLICITED_MASK = PVRDMA_CQ_SOLICITED |
0209 PVRDMA_CQ_NEXT_COMP,
0210 PVRDMA_CQ_REPORT_MISSED_EVENTS = 1 << 2,
0211 };
0212
0213 struct pvrdma_qp_cap {
0214 u32 max_send_wr;
0215 u32 max_recv_wr;
0216 u32 max_send_sge;
0217 u32 max_recv_sge;
0218 u32 max_inline_data;
0219 u32 reserved;
0220 };
0221
0222 enum pvrdma_sig_type {
0223 PVRDMA_SIGNAL_ALL_WR,
0224 PVRDMA_SIGNAL_REQ_WR,
0225 };
0226
0227 enum pvrdma_qp_type {
0228 PVRDMA_QPT_SMI,
0229 PVRDMA_QPT_GSI,
0230 PVRDMA_QPT_RC,
0231 PVRDMA_QPT_UC,
0232 PVRDMA_QPT_UD,
0233 PVRDMA_QPT_RAW_IPV6,
0234 PVRDMA_QPT_RAW_ETHERTYPE,
0235 PVRDMA_QPT_RAW_PACKET = 8,
0236 PVRDMA_QPT_XRC_INI = 9,
0237 PVRDMA_QPT_XRC_TGT,
0238 PVRDMA_QPT_MAX,
0239 };
0240
0241 enum pvrdma_qp_create_flags {
0242 PVRDMA_QP_CREATE_IPOPVRDMA_UD_LSO = 1 << 0,
0243 PVRDMA_QP_CREATE_BLOCK_MULTICAST_LOOPBACK = 1 << 1,
0244 };
0245
0246 enum pvrdma_qp_attr_mask {
0247 PVRDMA_QP_STATE = 1 << 0,
0248 PVRDMA_QP_CUR_STATE = 1 << 1,
0249 PVRDMA_QP_EN_SQD_ASYNC_NOTIFY = 1 << 2,
0250 PVRDMA_QP_ACCESS_FLAGS = 1 << 3,
0251 PVRDMA_QP_PKEY_INDEX = 1 << 4,
0252 PVRDMA_QP_PORT = 1 << 5,
0253 PVRDMA_QP_QKEY = 1 << 6,
0254 PVRDMA_QP_AV = 1 << 7,
0255 PVRDMA_QP_PATH_MTU = 1 << 8,
0256 PVRDMA_QP_TIMEOUT = 1 << 9,
0257 PVRDMA_QP_RETRY_CNT = 1 << 10,
0258 PVRDMA_QP_RNR_RETRY = 1 << 11,
0259 PVRDMA_QP_RQ_PSN = 1 << 12,
0260 PVRDMA_QP_MAX_QP_RD_ATOMIC = 1 << 13,
0261 PVRDMA_QP_ALT_PATH = 1 << 14,
0262 PVRDMA_QP_MIN_RNR_TIMER = 1 << 15,
0263 PVRDMA_QP_SQ_PSN = 1 << 16,
0264 PVRDMA_QP_MAX_DEST_RD_ATOMIC = 1 << 17,
0265 PVRDMA_QP_PATH_MIG_STATE = 1 << 18,
0266 PVRDMA_QP_CAP = 1 << 19,
0267 PVRDMA_QP_DEST_QPN = 1 << 20,
0268 PVRDMA_QP_ATTR_MASK_MAX = PVRDMA_QP_DEST_QPN,
0269 };
0270
0271 enum pvrdma_qp_state {
0272 PVRDMA_QPS_RESET,
0273 PVRDMA_QPS_INIT,
0274 PVRDMA_QPS_RTR,
0275 PVRDMA_QPS_RTS,
0276 PVRDMA_QPS_SQD,
0277 PVRDMA_QPS_SQE,
0278 PVRDMA_QPS_ERR,
0279 };
0280
0281 enum pvrdma_mig_state {
0282 PVRDMA_MIG_MIGRATED,
0283 PVRDMA_MIG_REARM,
0284 PVRDMA_MIG_ARMED,
0285 };
0286
0287 enum pvrdma_mw_type {
0288 PVRDMA_MW_TYPE_1 = 1,
0289 PVRDMA_MW_TYPE_2 = 2,
0290 };
0291
0292 struct pvrdma_srq_attr {
0293 u32 max_wr;
0294 u32 max_sge;
0295 u32 srq_limit;
0296 u32 reserved;
0297 };
0298
0299 struct pvrdma_qp_attr {
0300 enum pvrdma_qp_state qp_state;
0301 enum pvrdma_qp_state cur_qp_state;
0302 enum pvrdma_mtu path_mtu;
0303 enum pvrdma_mig_state path_mig_state;
0304 u32 qkey;
0305 u32 rq_psn;
0306 u32 sq_psn;
0307 u32 dest_qp_num;
0308 u32 qp_access_flags;
0309 u16 pkey_index;
0310 u16 alt_pkey_index;
0311 u8 en_sqd_async_notify;
0312 u8 sq_draining;
0313 u8 max_rd_atomic;
0314 u8 max_dest_rd_atomic;
0315 u8 min_rnr_timer;
0316 u8 port_num;
0317 u8 timeout;
0318 u8 retry_cnt;
0319 u8 rnr_retry;
0320 u8 alt_port_num;
0321 u8 alt_timeout;
0322 u8 reserved[5];
0323 struct pvrdma_qp_cap cap;
0324 struct pvrdma_ah_attr ah_attr;
0325 struct pvrdma_ah_attr alt_ah_attr;
0326 };
0327
0328 enum pvrdma_send_flags {
0329 PVRDMA_SEND_FENCE = 1 << 0,
0330 PVRDMA_SEND_SIGNALED = 1 << 1,
0331 PVRDMA_SEND_SOLICITED = 1 << 2,
0332 PVRDMA_SEND_INLINE = 1 << 3,
0333 PVRDMA_SEND_IP_CSUM = 1 << 4,
0334 PVRDMA_SEND_FLAGS_MAX = PVRDMA_SEND_IP_CSUM,
0335 };
0336
0337 enum pvrdma_access_flags {
0338 PVRDMA_ACCESS_LOCAL_WRITE = 1 << 0,
0339 PVRDMA_ACCESS_REMOTE_WRITE = 1 << 1,
0340 PVRDMA_ACCESS_REMOTE_READ = 1 << 2,
0341 PVRDMA_ACCESS_REMOTE_ATOMIC = 1 << 3,
0342 PVRDMA_ACCESS_MW_BIND = 1 << 4,
0343 PVRDMA_ZERO_BASED = 1 << 5,
0344 PVRDMA_ACCESS_ON_DEMAND = 1 << 6,
0345 PVRDMA_ACCESS_FLAGS_MAX = PVRDMA_ACCESS_ON_DEMAND,
0346 };
0347
0348 int pvrdma_query_device(struct ib_device *ibdev,
0349 struct ib_device_attr *props,
0350 struct ib_udata *udata);
0351 int pvrdma_query_port(struct ib_device *ibdev, u32 port,
0352 struct ib_port_attr *props);
0353 int pvrdma_query_gid(struct ib_device *ibdev, u32 port,
0354 int index, union ib_gid *gid);
0355 int pvrdma_query_pkey(struct ib_device *ibdev, u32 port,
0356 u16 index, u16 *pkey);
0357 enum rdma_link_layer pvrdma_port_link_layer(struct ib_device *ibdev,
0358 u32 port);
0359 int pvrdma_modify_device(struct ib_device *ibdev, int mask,
0360 struct ib_device_modify *props);
0361 int pvrdma_modify_port(struct ib_device *ibdev, u32 port,
0362 int mask, struct ib_port_modify *props);
0363 int pvrdma_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
0364 int pvrdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata);
0365 void pvrdma_dealloc_ucontext(struct ib_ucontext *context);
0366 int pvrdma_alloc_pd(struct ib_pd *pd, struct ib_udata *udata);
0367 int pvrdma_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata);
0368 struct ib_mr *pvrdma_get_dma_mr(struct ib_pd *pd, int acc);
0369 struct ib_mr *pvrdma_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
0370 u64 virt_addr, int access_flags,
0371 struct ib_udata *udata);
0372 int pvrdma_dereg_mr(struct ib_mr *mr, struct ib_udata *udata);
0373 struct ib_mr *pvrdma_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type,
0374 u32 max_num_sg);
0375 int pvrdma_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg,
0376 int sg_nents, unsigned int *sg_offset);
0377 int pvrdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
0378 struct ib_udata *udata);
0379 int pvrdma_destroy_cq(struct ib_cq *cq, struct ib_udata *udata);
0380 int pvrdma_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
0381 int pvrdma_req_notify_cq(struct ib_cq *cq, enum ib_cq_notify_flags flags);
0382 int pvrdma_create_ah(struct ib_ah *ah, struct rdma_ah_init_attr *init_attr,
0383 struct ib_udata *udata);
0384 int pvrdma_destroy_ah(struct ib_ah *ah, u32 flags);
0385
0386 int pvrdma_create_srq(struct ib_srq *srq, struct ib_srq_init_attr *init_attr,
0387 struct ib_udata *udata);
0388 int pvrdma_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
0389 enum ib_srq_attr_mask attr_mask, struct ib_udata *udata);
0390 int pvrdma_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
0391 int pvrdma_destroy_srq(struct ib_srq *srq, struct ib_udata *udata);
0392
0393 int pvrdma_create_qp(struct ib_qp *qp, struct ib_qp_init_attr *init_attr,
0394 struct ib_udata *udata);
0395 int pvrdma_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
0396 int attr_mask, struct ib_udata *udata);
0397 int pvrdma_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr,
0398 int qp_attr_mask, struct ib_qp_init_attr *qp_init_attr);
0399 int pvrdma_destroy_qp(struct ib_qp *qp, struct ib_udata *udata);
0400 int pvrdma_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
0401 const struct ib_send_wr **bad_wr);
0402 int pvrdma_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
0403 const struct ib_recv_wr **bad_wr);
0404
0405 #endif