1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
3 * Copyright 2018-2020 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;
53 struct efa_com_query_qp_params {
57 struct efa_com_query_qp_result {
65 struct efa_com_destroy_qp_params {
69 struct efa_com_create_cq_params {
70 /* cq physical base address in OS memory */
72 /* completion queue depth in # of entries */
76 u8 entry_size_in_bytes;
79 struct efa_com_create_cq_result {
82 /* actual cq depth in # of entries */
86 struct efa_com_destroy_cq_params {
90 struct efa_com_create_ah_params {
92 /* Destination address in network byte order */
93 u8 dest_addr[EFA_GID_SIZE];
96 struct efa_com_create_ah_result {
100 struct efa_com_destroy_ah_params {
105 struct efa_com_get_device_attr_result {
106 u8 addr[EFA_GID_SIZE];
111 u32 admin_api_version;
113 u32 supported_features;
117 u32 max_sq_depth; /* wqes */
118 u32 max_rq_depth; /* wqes */
120 u32 max_cq_depth; /* cqes */
137 struct efa_com_get_hw_hints_result {
138 u16 mmio_read_timeout;
139 u16 driver_watchdog_timeout;
140 u16 admin_completion_timeout;
145 struct efa_com_mem_addr {
150 /* Used at indirect mode page list chunks for chaining */
151 struct efa_com_ctrl_buff_info {
152 /* indicates length of the buffer pointed by control_buffer_address. */
154 /* points to control buffer (direct or indirect) */
155 struct efa_com_mem_addr address;
158 struct efa_com_reg_mr_params {
159 /* Memory region length, in bytes. */
160 u64 mr_length_in_bytes;
161 /* IO Virtual Address associated with this MR. */
163 /* words 8:15: Physical Buffer List, each element is page-aligned. */
166 * Inline array of physical addresses of app pages
167 * (optimization for short region reservations)
169 u64 inline_pbl_array[4];
171 * Describes the next physically contiguous chunk of indirect
172 * page list. A page list contains physical addresses of command
173 * data pages. Data pages are 4KB; page list chunks are
176 struct efa_com_ctrl_buff_info pbl;
178 /* number of pages in PBL (redundant, could be calculated) */
180 /* Protection Domain */
183 * phys_page_size_shift - page size is (1 << phys_page_size_shift)
184 * Page size is used for building the Virtual to Physical
188 /* see permissions field of struct efa_admin_reg_mr_cmd */
194 struct efa_com_reg_mr_result {
196 * To be used in conjunction with local buffers references in SQ and
201 * To be used in incoming RDMA semantics messages to refer to remotely
202 * accessed memory region
207 struct efa_com_dereg_mr_params {
211 struct efa_com_alloc_pd_result {
215 struct efa_com_dealloc_pd_params {
219 struct efa_com_alloc_uar_result {
223 struct efa_com_dealloc_uar_params {
227 struct efa_com_get_stats_params {
228 /* see enum efa_admin_get_stats_type */
230 /* see enum efa_admin_get_stats_scope */
235 struct efa_com_basic_stats {
243 struct efa_com_messages_stats {
250 struct efa_com_rdma_read_stats {
257 union efa_com_get_stats_result {
258 struct efa_com_basic_stats basic_stats;
259 struct efa_com_messages_stats messages_stats;
260 struct efa_com_rdma_read_stats rdma_read_stats;
263 void efa_com_set_dma_addr(dma_addr_t addr, u32 *addr_high, u32 *addr_low);
264 int efa_com_create_qp(struct efa_com_dev *edev,
265 struct efa_com_create_qp_params *params,
266 struct efa_com_create_qp_result *res);
267 int efa_com_modify_qp(struct efa_com_dev *edev,
268 struct efa_com_modify_qp_params *params);
269 int efa_com_query_qp(struct efa_com_dev *edev,
270 struct efa_com_query_qp_params *params,
271 struct efa_com_query_qp_result *result);
272 int efa_com_destroy_qp(struct efa_com_dev *edev,
273 struct efa_com_destroy_qp_params *params);
274 int efa_com_create_cq(struct efa_com_dev *edev,
275 struct efa_com_create_cq_params *params,
276 struct efa_com_create_cq_result *result);
277 int efa_com_destroy_cq(struct efa_com_dev *edev,
278 struct efa_com_destroy_cq_params *params);
279 int efa_com_register_mr(struct efa_com_dev *edev,
280 struct efa_com_reg_mr_params *params,
281 struct efa_com_reg_mr_result *result);
282 int efa_com_dereg_mr(struct efa_com_dev *edev,
283 struct efa_com_dereg_mr_params *params);
284 int efa_com_create_ah(struct efa_com_dev *edev,
285 struct efa_com_create_ah_params *params,
286 struct efa_com_create_ah_result *result);
287 int efa_com_destroy_ah(struct efa_com_dev *edev,
288 struct efa_com_destroy_ah_params *params);
289 int efa_com_get_device_attr(struct efa_com_dev *edev,
290 struct efa_com_get_device_attr_result *result);
291 int efa_com_get_hw_hints(struct efa_com_dev *edev,
292 struct efa_com_get_hw_hints_result *result);
294 efa_com_check_supported_feature_id(struct efa_com_dev *edev,
295 enum efa_admin_aq_feature_id feature_id);
296 int efa_com_set_feature_ex(struct efa_com_dev *edev,
297 struct efa_admin_set_feature_resp *set_resp,
298 struct efa_admin_set_feature_cmd *set_cmd,
299 enum efa_admin_aq_feature_id feature_id,
300 dma_addr_t control_buf_dma_addr,
301 u32 control_buff_size);
302 int efa_com_set_aenq_config(struct efa_com_dev *edev, u32 groups);
303 int efa_com_alloc_pd(struct efa_com_dev *edev,
304 struct efa_com_alloc_pd_result *result);
305 int efa_com_dealloc_pd(struct efa_com_dev *edev,
306 struct efa_com_dealloc_pd_params *params);
307 int efa_com_alloc_uar(struct efa_com_dev *edev,
308 struct efa_com_alloc_uar_result *result);
309 int efa_com_dealloc_uar(struct efa_com_dev *edev,
310 struct efa_com_dealloc_uar_params *params);
311 int efa_com_get_stats(struct efa_com_dev *edev,
312 struct efa_com_get_stats_params *params,
313 union efa_com_get_stats_result *result);
315 #endif /* _EFA_COM_CMD_H_ */