1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
3 * Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All rights reserved.
6 #ifndef _EFA_COM_CMD_H_
7 #define _EFA_COM_CMD_H_
11 #define EFA_GID_SIZE 16
13 struct efa_com_create_qp_params {
18 * Send descriptor ring size in bytes,
19 * sufficient for user-provided number of WQEs and SGL size
21 u32 sq_ring_size_in_bytes;
22 /* Max number of WQEs that will be posted on send queue */
24 /* Recv descriptor ring size in bytes */
25 u32 rq_ring_size_in_bytes;
32 struct efa_com_create_qp_result {
37 u32 llq_descriptors_offset;
42 struct efa_com_modify_qp_params {
49 u8 sq_drained_async_notify;
52 struct efa_com_query_qp_params {
56 struct efa_com_query_qp_result {
63 struct efa_com_destroy_qp_params {
67 struct efa_com_create_cq_params {
68 /* cq physical base address in OS memory */
70 /* completion queue depth in # of entries */
74 u8 entry_size_in_bytes;
77 struct efa_com_create_cq_result {
80 /* actual cq depth in # of entries */
84 struct efa_com_destroy_cq_params {
88 struct efa_com_create_ah_params {
90 /* Destination address in network byte order */
91 u8 dest_addr[EFA_GID_SIZE];
94 struct efa_com_create_ah_result {
98 struct efa_com_destroy_ah_params {
103 struct efa_com_get_network_attr_result {
104 u8 addr[EFA_GID_SIZE];
108 struct efa_com_get_device_attr_result {
112 u32 admin_api_version;
114 u32 supported_features;
118 u32 max_sq_depth; /* wqes */
119 u32 max_rq_depth; /* wqes */
121 u32 max_cq_depth; /* cqes */
133 struct efa_com_get_hw_hints_result {
134 u16 mmio_read_timeout;
135 u16 driver_watchdog_timeout;
136 u16 admin_completion_timeout;
141 struct efa_com_mem_addr {
146 /* Used at indirect mode page list chunks for chaining */
147 struct efa_com_ctrl_buff_info {
148 /* indicates length of the buffer pointed by control_buffer_address. */
150 /* points to control buffer (direct or indirect) */
151 struct efa_com_mem_addr address;
154 struct efa_com_reg_mr_params {
155 /* Memory region length, in bytes. */
156 u64 mr_length_in_bytes;
157 /* IO Virtual Address associated with this MR. */
159 /* words 8:15: Physical Buffer List, each element is page-aligned. */
162 * Inline array of physical addresses of app pages
163 * (optimization for short region reservations)
165 u64 inline_pbl_array[4];
167 * Describes the next physically contiguous chunk of indirect
168 * page list. A page list contains physical addresses of command
169 * data pages. Data pages are 4KB; page list chunks are
172 struct efa_com_ctrl_buff_info pbl;
174 /* number of pages in PBL (redundant, could be calculated) */
176 /* Protection Domain */
179 * phys_page_size_shift - page size is (1 << phys_page_size_shift)
180 * Page size is used for building the Virtual to Physical
186 * 0: local_write_enable - Write permissions: value of 1 needed
187 * for RQ buffers and for RDMA write:1: reserved1 - remote
195 struct efa_com_reg_mr_result {
197 * To be used in conjunction with local buffers references in SQ and
202 * To be used in incoming RDMA semantics messages to refer to remotely
203 * accessed memory region
208 struct efa_com_dereg_mr_params {
212 struct efa_com_alloc_pd_result {
216 struct efa_com_dealloc_pd_params {
220 struct efa_com_alloc_uar_result {
224 struct efa_com_dealloc_uar_params {
228 void efa_com_set_dma_addr(dma_addr_t addr, u32 *addr_high, u32 *addr_low);
229 int efa_com_create_qp(struct efa_com_dev *edev,
230 struct efa_com_create_qp_params *params,
231 struct efa_com_create_qp_result *res);
232 int efa_com_modify_qp(struct efa_com_dev *edev,
233 struct efa_com_modify_qp_params *params);
234 int efa_com_query_qp(struct efa_com_dev *edev,
235 struct efa_com_query_qp_params *params,
236 struct efa_com_query_qp_result *result);
237 int efa_com_destroy_qp(struct efa_com_dev *edev,
238 struct efa_com_destroy_qp_params *params);
239 int efa_com_create_cq(struct efa_com_dev *edev,
240 struct efa_com_create_cq_params *params,
241 struct efa_com_create_cq_result *result);
242 int efa_com_destroy_cq(struct efa_com_dev *edev,
243 struct efa_com_destroy_cq_params *params);
244 int efa_com_register_mr(struct efa_com_dev *edev,
245 struct efa_com_reg_mr_params *params,
246 struct efa_com_reg_mr_result *result);
247 int efa_com_dereg_mr(struct efa_com_dev *edev,
248 struct efa_com_dereg_mr_params *params);
249 int efa_com_create_ah(struct efa_com_dev *edev,
250 struct efa_com_create_ah_params *params,
251 struct efa_com_create_ah_result *result);
252 int efa_com_destroy_ah(struct efa_com_dev *edev,
253 struct efa_com_destroy_ah_params *params);
254 int efa_com_get_network_attr(struct efa_com_dev *edev,
255 struct efa_com_get_network_attr_result *result);
256 int efa_com_get_device_attr(struct efa_com_dev *edev,
257 struct efa_com_get_device_attr_result *result);
258 int efa_com_get_hw_hints(struct efa_com_dev *edev,
259 struct efa_com_get_hw_hints_result *result);
260 int efa_com_set_aenq_config(struct efa_com_dev *edev, u32 groups);
261 int efa_com_alloc_pd(struct efa_com_dev *edev,
262 struct efa_com_alloc_pd_result *result);
263 int efa_com_dealloc_pd(struct efa_com_dev *edev,
264 struct efa_com_dealloc_pd_params *params);
265 int efa_com_alloc_uar(struct efa_com_dev *edev,
266 struct efa_com_alloc_uar_result *result);
267 int efa_com_dealloc_uar(struct efa_com_dev *edev,
268 struct efa_com_dealloc_uar_params *params);
270 #endif /* _EFA_COM_CMD_H_ */