xref: /linux/include/uapi/rdma/efa-abi.h (revision 556c811f24b30cc883733a2eaf9e939817589231)
12ce62149SGal Pressman /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
22ce62149SGal Pressman /*
3*556c811fSGal Pressman  * Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All rights reserved.
42ce62149SGal Pressman  */
52ce62149SGal Pressman 
62ce62149SGal Pressman #ifndef EFA_ABI_USER_H
72ce62149SGal Pressman #define EFA_ABI_USER_H
82ce62149SGal Pressman 
92ce62149SGal Pressman #include <linux/types.h>
102ce62149SGal Pressman 
112ce62149SGal Pressman /*
122ce62149SGal Pressman  * Increment this value if any changes that break userspace ABI
132ce62149SGal Pressman  * compatibility are made.
142ce62149SGal Pressman  */
152ce62149SGal Pressman #define EFA_UVERBS_ABI_VERSION 1
162ce62149SGal Pressman 
172ce62149SGal Pressman /*
182ce62149SGal Pressman  * Keep structs aligned to 8 bytes.
192ce62149SGal Pressman  * Keep reserved fields as arrays of __u8 named reserved_XXX where XXX is the
202ce62149SGal Pressman  * hex bit offset of the field.
212ce62149SGal Pressman  */
222ce62149SGal Pressman 
232ce62149SGal Pressman enum efa_ibv_user_cmds_supp_udata {
242ce62149SGal Pressman 	EFA_USER_CMDS_SUPP_UDATA_QUERY_DEVICE = 1 << 0,
252ce62149SGal Pressman 	EFA_USER_CMDS_SUPP_UDATA_CREATE_AH    = 1 << 1,
262ce62149SGal Pressman };
272ce62149SGal Pressman 
282ce62149SGal Pressman struct efa_ibv_alloc_ucontext_resp {
292ce62149SGal Pressman 	__u32 comp_mask;
302ce62149SGal Pressman 	__u32 cmds_supp_udata_mask;
312ce62149SGal Pressman 	__u16 sub_cqs_per_cq;
322ce62149SGal Pressman 	__u16 inline_buf_size;
332ce62149SGal Pressman 	__u32 max_llq_size; /* bytes */
34*556c811fSGal Pressman 	__u16 max_tx_batch; /* units of 64 bytes */
35*556c811fSGal Pressman 	__u8 reserved_90[6];
362ce62149SGal Pressman };
372ce62149SGal Pressman 
382ce62149SGal Pressman struct efa_ibv_alloc_pd_resp {
392ce62149SGal Pressman 	__u32 comp_mask;
402ce62149SGal Pressman 	__u16 pdn;
412ce62149SGal Pressman 	__u8 reserved_30[2];
422ce62149SGal Pressman };
432ce62149SGal Pressman 
442ce62149SGal Pressman struct efa_ibv_create_cq {
452ce62149SGal Pressman 	__u32 comp_mask;
462ce62149SGal Pressman 	__u32 cq_entry_size;
472ce62149SGal Pressman 	__u16 num_sub_cqs;
482ce62149SGal Pressman 	__u8 reserved_50[6];
492ce62149SGal Pressman };
502ce62149SGal Pressman 
512ce62149SGal Pressman struct efa_ibv_create_cq_resp {
522ce62149SGal Pressman 	__u32 comp_mask;
532ce62149SGal Pressman 	__u8 reserved_20[4];
542ce62149SGal Pressman 	__aligned_u64 q_mmap_key;
552ce62149SGal Pressman 	__aligned_u64 q_mmap_size;
562ce62149SGal Pressman 	__u16 cq_idx;
572ce62149SGal Pressman 	__u8 reserved_d0[6];
582ce62149SGal Pressman };
592ce62149SGal Pressman 
602ce62149SGal Pressman enum {
612ce62149SGal Pressman 	EFA_QP_DRIVER_TYPE_SRD = 0,
622ce62149SGal Pressman };
632ce62149SGal Pressman 
642ce62149SGal Pressman struct efa_ibv_create_qp {
652ce62149SGal Pressman 	__u32 comp_mask;
662ce62149SGal Pressman 	__u32 rq_ring_size; /* bytes */
672ce62149SGal Pressman 	__u32 sq_ring_size; /* bytes */
682ce62149SGal Pressman 	__u32 driver_qp_type;
692ce62149SGal Pressman };
702ce62149SGal Pressman 
712ce62149SGal Pressman struct efa_ibv_create_qp_resp {
722ce62149SGal Pressman 	__u32 comp_mask;
732ce62149SGal Pressman 	/* the offset inside the page of the rq db */
742ce62149SGal Pressman 	__u32 rq_db_offset;
752ce62149SGal Pressman 	/* the offset inside the page of the sq db */
762ce62149SGal Pressman 	__u32 sq_db_offset;
772ce62149SGal Pressman 	/* the offset inside the page of descriptors buffer */
782ce62149SGal Pressman 	__u32 llq_desc_offset;
792ce62149SGal Pressman 	__aligned_u64 rq_mmap_key;
802ce62149SGal Pressman 	__aligned_u64 rq_mmap_size;
812ce62149SGal Pressman 	__aligned_u64 rq_db_mmap_key;
822ce62149SGal Pressman 	__aligned_u64 sq_db_mmap_key;
832ce62149SGal Pressman 	__aligned_u64 llq_desc_mmap_key;
842ce62149SGal Pressman 	__u16 send_sub_cq_idx;
852ce62149SGal Pressman 	__u16 recv_sub_cq_idx;
862ce62149SGal Pressman 	__u8 reserved_1e0[4];
872ce62149SGal Pressman };
882ce62149SGal Pressman 
892ce62149SGal Pressman struct efa_ibv_create_ah_resp {
902ce62149SGal Pressman 	__u32 comp_mask;
912ce62149SGal Pressman 	__u16 efa_address_handle;
922ce62149SGal Pressman 	__u8 reserved_30[2];
932ce62149SGal Pressman };
942ce62149SGal Pressman 
95666e8ff5SDaniel Kranzdorf enum {
96666e8ff5SDaniel Kranzdorf 	EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
97666e8ff5SDaniel Kranzdorf };
98666e8ff5SDaniel Kranzdorf 
992ce62149SGal Pressman struct efa_ibv_ex_query_device_resp {
1002ce62149SGal Pressman 	__u32 comp_mask;
1012ce62149SGal Pressman 	__u32 max_sq_wr;
1022ce62149SGal Pressman 	__u32 max_rq_wr;
1032ce62149SGal Pressman 	__u16 max_sq_sge;
1042ce62149SGal Pressman 	__u16 max_rq_sge;
105666e8ff5SDaniel Kranzdorf 	__u32 max_rdma_size;
106666e8ff5SDaniel Kranzdorf 	__u32 device_caps;
1072ce62149SGal Pressman };
1082ce62149SGal Pressman 
1092ce62149SGal Pressman #endif /* EFA_ABI_USER_H */
110