|
| 1 | +/* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR Linux-OpenIB) */ |
| 2 | +/* |
| 3 | + * Copyright (c) 2024 ZTE Corporation. |
| 4 | + * |
| 5 | + * This software is available to you under a choice of one of two |
| 6 | + * licenses. You may choose to be licensed under the terms of the GNU |
| 7 | + * General Public License (GPL) Version 2, available from the file |
| 8 | + * COPYING in the main directory of this source tree, or the |
| 9 | + * OpenIB.org BSD license below: |
| 10 | + * |
| 11 | + * Redistribution and use in source and binary forms, with or |
| 12 | + * without modification, are permitted provided that the following |
| 13 | + * conditions are met: |
| 14 | + * |
| 15 | + * - Redistributions of source code must retain the above |
| 16 | + * copyright notice, this list of conditions and the following |
| 17 | + * disclaimer. |
| 18 | + * |
| 19 | + * - Redistributions in binary form must reproduce the above |
| 20 | + * copyright notice, this list of conditions and the following |
| 21 | + * disclaimer in the documentation and/or other materials |
| 22 | + * provided with the distribution. |
| 23 | + * |
| 24 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 25 | + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 26 | + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 27 | + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 28 | + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 29 | + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 30 | + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 31 | + * SOFTWARE. |
| 32 | + */ |
| 33 | + |
| 34 | +#ifndef ZXDH_ABI_H |
| 35 | +#define ZXDH_ABI_H |
| 36 | + |
| 37 | +#include <linux/types.h> |
| 38 | + |
| 39 | +/* user-space whose last ABI ver is 5 */ |
| 40 | +#define ZXDH_ABI_VER 5 |
| 41 | +#define ZXDH_CONTEXT_VER_V1 5 |
| 42 | + |
| 43 | +enum zxdh_memreg_type { |
| 44 | + ZXDH_MEMREG_TYPE_MEM = 0, |
| 45 | + ZXDH_MEMREG_TYPE_QP = 1, |
| 46 | + ZXDH_MEMREG_TYPE_CQ = 2, |
| 47 | + ZXDH_MEMREG_TYPE_SRQ = 3, |
| 48 | +}; |
| 49 | + |
| 50 | +enum zxdh_db_addr_type { |
| 51 | + ZXDH_DB_ADDR_PHY = 0, |
| 52 | + ZXDH_DB_ADDR_BAR = 1, |
| 53 | +}; |
| 54 | + |
| 55 | +struct zxdh_alloc_ucontext_req { |
| 56 | + __u32 rsvd32; |
| 57 | + __u8 userspace_ver; |
| 58 | + __u8 rsvd8[3]; |
| 59 | +}; |
| 60 | + |
| 61 | +struct zxdh_alloc_ucontext_resp { |
| 62 | + __u32 max_pds; |
| 63 | + __u32 max_qps; |
| 64 | + __u32 wq_size; /* size of the WQs (SQ+RQ) in the mmaped area */ |
| 65 | + __u8 kernel_ver; |
| 66 | + __u8 db_addr_type; |
| 67 | + __u16 rdma_tool_flags; |
| 68 | + __aligned_u64 feature_flags; |
| 69 | + __aligned_u64 sq_db_mmap_key; |
| 70 | + __aligned_u64 cq_db_mmap_key; |
| 71 | + __aligned_u64 sq_db_pa; |
| 72 | + __aligned_u64 cq_db_pa; |
| 73 | + __u32 max_hw_wq_frags; |
| 74 | + __u32 max_hw_read_sges; |
| 75 | + __u32 max_hw_inline; |
| 76 | + __u32 max_hw_rq_quanta; |
| 77 | + __u32 max_hw_srq_quanta; |
| 78 | + __u32 max_hw_wq_quanta; |
| 79 | + __u32 max_hw_srq_wr; |
| 80 | + __u32 min_hw_cq_size; |
| 81 | + __u32 max_hw_cq_size; |
| 82 | + __u16 max_hw_sq_chunk; |
| 83 | + __u8 rsvd; |
| 84 | + __u8 chip_rev; |
| 85 | +}; |
| 86 | + |
| 87 | +struct zxdh_alloc_pd_resp { |
| 88 | + __u32 pd_id; |
| 89 | + __u8 rsvd[4]; |
| 90 | +}; |
| 91 | + |
| 92 | +struct zxdh_resize_cq_req { |
| 93 | + __aligned_u64 user_cq_buffer; |
| 94 | +}; |
| 95 | + |
| 96 | +struct zxdh_create_cq_req { |
| 97 | + __aligned_u64 user_cq_buf; |
| 98 | + __aligned_u64 user_shadow_area; |
| 99 | +}; |
| 100 | + |
| 101 | +struct zxdh_create_qp_req { |
| 102 | + __aligned_u64 user_wqe_bufs; |
| 103 | + __aligned_u64 user_compl_ctx; |
| 104 | +}; |
| 105 | + |
| 106 | +struct zxdh_create_srq_req { |
| 107 | + __aligned_u64 user_wqe_bufs; |
| 108 | + __aligned_u64 user_compl_ctx; |
| 109 | + __aligned_u64 user_wqe_list; |
| 110 | + __aligned_u64 user_wqe_db; |
| 111 | +}; |
| 112 | + |
| 113 | +struct zxdh_mem_reg_req { |
| 114 | + __u32 reg_type; /* enum zxdh_memreg_type */ |
| 115 | + __u32 cq_pages; |
| 116 | + __u32 rq_pages; |
| 117 | + __u32 sq_pages; |
| 118 | + __u32 srq_pages; |
| 119 | + __u16 srq_list_pages; |
| 120 | + __u8 rsvd[2]; |
| 121 | +}; |
| 122 | + |
| 123 | +struct zxdh_reg_mr_resp { |
| 124 | + __u32 mr_pa_low; |
| 125 | + __u32 mr_pa_hig; |
| 126 | + __u16 host_page_size; |
| 127 | + __u16 leaf_pbl_size; |
| 128 | + __u8 rsvd[4]; |
| 129 | +}; |
| 130 | + |
| 131 | +struct zxdh_modify_qp_req { |
| 132 | + __u8 sq_flush; |
| 133 | + __u8 rq_flush; |
| 134 | + __u8 rsvd[6]; |
| 135 | +}; |
| 136 | + |
| 137 | +struct zxdh_create_cq_resp { |
| 138 | + __u32 cq_id; |
| 139 | + __u32 cq_size; |
| 140 | +}; |
| 141 | + |
| 142 | +struct zxdh_create_qp_resp { |
| 143 | + __u32 qp_id; |
| 144 | + __u32 actual_sq_size; |
| 145 | + __u32 actual_rq_size; |
| 146 | + __u32 zxdh_drv_opt; |
| 147 | + __u16 push_idx; |
| 148 | + __u8 lsmm; |
| 149 | + __u8 rsvd; |
| 150 | + __u32 qp_caps; |
| 151 | +}; |
| 152 | + |
| 153 | +struct zxdh_create_srq_resp { |
| 154 | + __u32 srq_id; |
| 155 | + __u32 actual_srq_size; |
| 156 | + __u32 actual_srq_list_size; |
| 157 | + __u8 rsvd[4]; |
| 158 | +}; |
| 159 | + |
| 160 | +struct zxdh_modify_qp_resp { |
| 161 | + __aligned_u64 push_wqe_mmap_key; |
| 162 | + __aligned_u64 push_db_mmap_key; |
| 163 | + __u16 push_offset; |
| 164 | + __u8 push_valid; |
| 165 | + __u8 rsvd[5]; |
| 166 | +}; |
| 167 | + |
| 168 | +struct zxdh_create_ah_resp { |
| 169 | + __u32 ah_id; |
| 170 | + __u8 rsvd[4]; |
| 171 | +}; |
| 172 | +#endif /* ZXDH_ABI_H */ |
0 commit comments