1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
3 * Copyright 2018-2024 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
;
31 u8 unsolicited_write_recv
: 1;
34 struct efa_com_create_qp_result
{
39 u32 llq_descriptors_offset
;
44 struct efa_com_modify_qp_params
{
51 u8 sq_drained_async_notify
;
55 struct efa_com_query_qp_params
{
59 struct efa_com_query_qp_result
{
67 struct efa_com_destroy_qp_params
{
71 struct efa_com_create_cq_params
{
72 /* cq physical base address in OS memory */
74 /* completion queue depth in # of entries */
79 u8 entry_size_in_bytes
;
80 u8 interrupt_mode_enabled
: 1;
84 struct efa_com_create_cq_result
{
87 /* actual cq depth in # of entries */
93 struct efa_com_destroy_cq_params
{
97 struct efa_com_create_ah_params
{
99 /* Destination address in network byte order */
100 u8 dest_addr
[EFA_GID_SIZE
];
103 struct efa_com_create_ah_result
{
107 struct efa_com_destroy_ah_params
{
112 struct efa_com_get_device_attr_result
{
113 u8 addr
[EFA_GID_SIZE
];
119 u32 admin_api_version
;
121 u32 supported_features
;
125 u32 max_sq_depth
; /* wqes */
126 u32 max_rq_depth
; /* wqes */
128 u32 max_cq_depth
; /* cqes */
138 u32 event_bitmask
; /* EQ events bitmask */
145 u16 max_link_speed_gbps
;
149 struct efa_com_get_hw_hints_result
{
150 u16 mmio_read_timeout
;
151 u16 driver_watchdog_timeout
;
152 u16 admin_completion_timeout
;
157 struct efa_com_mem_addr
{
162 /* Used at indirect mode page list chunks for chaining */
163 struct efa_com_ctrl_buff_info
{
164 /* indicates length of the buffer pointed by control_buffer_address. */
166 /* points to control buffer (direct or indirect) */
167 struct efa_com_mem_addr address
;
170 struct efa_com_reg_mr_params
{
171 /* Memory region length, in bytes. */
172 u64 mr_length_in_bytes
;
173 /* IO Virtual Address associated with this MR. */
175 /* words 8:15: Physical Buffer List, each element is page-aligned. */
178 * Inline array of physical addresses of app pages
179 * (optimization for short region reservations)
181 u64 inline_pbl_array
[4];
183 * Describes the next physically contiguous chunk of indirect
184 * page list. A page list contains physical addresses of command
185 * data pages. Data pages are 4KB; page list chunks are
188 struct efa_com_ctrl_buff_info pbl
;
190 /* number of pages in PBL (redundant, could be calculated) */
192 /* Protection Domain */
195 * phys_page_size_shift - page size is (1 << phys_page_size_shift)
196 * Page size is used for building the Virtual to Physical
200 /* see permissions field of struct efa_admin_reg_mr_cmd */
206 struct efa_com_mr_interconnect_info
{
210 u8 recv_ic_id_valid
: 1;
211 u8 rdma_read_ic_id_valid
: 1;
212 u8 rdma_recv_ic_id_valid
: 1;
215 struct efa_com_reg_mr_result
{
217 * To be used in conjunction with local buffers references in SQ and
222 * To be used in incoming RDMA semantics messages to refer to remotely
223 * accessed memory region
226 struct efa_com_mr_interconnect_info ic_info
;
229 struct efa_com_dereg_mr_params
{
233 struct efa_com_alloc_pd_result
{
237 struct efa_com_dealloc_pd_params
{
241 struct efa_com_alloc_uar_result
{
245 struct efa_com_dealloc_uar_params
{
249 struct efa_com_get_stats_params
{
250 /* see enum efa_admin_get_stats_type */
252 /* see enum efa_admin_get_stats_scope */
257 struct efa_com_basic_stats
{
265 struct efa_com_messages_stats
{
272 struct efa_com_rdma_read_stats
{
279 struct efa_com_rdma_write_stats
{
283 u64 write_recv_bytes
;
286 union efa_com_get_stats_result
{
287 struct efa_com_basic_stats basic_stats
;
288 struct efa_com_messages_stats messages_stats
;
289 struct efa_com_rdma_read_stats rdma_read_stats
;
290 struct efa_com_rdma_write_stats rdma_write_stats
;
293 int efa_com_create_qp(struct efa_com_dev
*edev
,
294 struct efa_com_create_qp_params
*params
,
295 struct efa_com_create_qp_result
*res
);
296 int efa_com_modify_qp(struct efa_com_dev
*edev
,
297 struct efa_com_modify_qp_params
*params
);
298 int efa_com_query_qp(struct efa_com_dev
*edev
,
299 struct efa_com_query_qp_params
*params
,
300 struct efa_com_query_qp_result
*result
);
301 int efa_com_destroy_qp(struct efa_com_dev
*edev
,
302 struct efa_com_destroy_qp_params
*params
);
303 int efa_com_create_cq(struct efa_com_dev
*edev
,
304 struct efa_com_create_cq_params
*params
,
305 struct efa_com_create_cq_result
*result
);
306 int efa_com_destroy_cq(struct efa_com_dev
*edev
,
307 struct efa_com_destroy_cq_params
*params
);
308 int efa_com_register_mr(struct efa_com_dev
*edev
,
309 struct efa_com_reg_mr_params
*params
,
310 struct efa_com_reg_mr_result
*result
);
311 int efa_com_dereg_mr(struct efa_com_dev
*edev
,
312 struct efa_com_dereg_mr_params
*params
);
313 int efa_com_create_ah(struct efa_com_dev
*edev
,
314 struct efa_com_create_ah_params
*params
,
315 struct efa_com_create_ah_result
*result
);
316 int efa_com_destroy_ah(struct efa_com_dev
*edev
,
317 struct efa_com_destroy_ah_params
*params
);
318 int efa_com_get_device_attr(struct efa_com_dev
*edev
,
319 struct efa_com_get_device_attr_result
*result
);
320 int efa_com_get_hw_hints(struct efa_com_dev
*edev
,
321 struct efa_com_get_hw_hints_result
*result
);
323 efa_com_check_supported_feature_id(struct efa_com_dev
*edev
,
324 enum efa_admin_aq_feature_id feature_id
);
325 int efa_com_set_feature_ex(struct efa_com_dev
*edev
,
326 struct efa_admin_set_feature_resp
*set_resp
,
327 struct efa_admin_set_feature_cmd
*set_cmd
,
328 enum efa_admin_aq_feature_id feature_id
,
329 dma_addr_t control_buf_dma_addr
,
330 u32 control_buff_size
);
331 int efa_com_set_aenq_config(struct efa_com_dev
*edev
, u32 groups
);
332 int efa_com_alloc_pd(struct efa_com_dev
*edev
,
333 struct efa_com_alloc_pd_result
*result
);
334 int efa_com_dealloc_pd(struct efa_com_dev
*edev
,
335 struct efa_com_dealloc_pd_params
*params
);
336 int efa_com_alloc_uar(struct efa_com_dev
*edev
,
337 struct efa_com_alloc_uar_result
*result
);
338 int efa_com_dealloc_uar(struct efa_com_dev
*edev
,
339 struct efa_com_dealloc_uar_params
*params
);
340 int efa_com_get_stats(struct efa_com_dev
*edev
,
341 struct efa_com_get_stats_params
*params
,
342 union efa_com_get_stats_result
*result
);
344 #endif /* _EFA_COM_CMD_H_ */