xref: /openbmc/linux/drivers/infiniband/hw/efa/efa_admin_cmds_defs.h (revision c900529f3d9161bfde5cca0754f83b4d3c3e0220)
101edac3aSGal Pressman /* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */
201edac3aSGal Pressman /*
36dddd939SYonatan Nachum  * Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All rights reserved.
401edac3aSGal Pressman  */
501edac3aSGal Pressman 
601edac3aSGal Pressman #ifndef _EFA_ADMIN_CMDS_H_
701edac3aSGal Pressman #define _EFA_ADMIN_CMDS_H_
801edac3aSGal Pressman 
901edac3aSGal Pressman #define EFA_ADMIN_API_VERSION_MAJOR          0
1001edac3aSGal Pressman #define EFA_ADMIN_API_VERSION_MINOR          1
1101edac3aSGal Pressman 
1201edac3aSGal Pressman /* EFA admin queue opcodes */
1301edac3aSGal Pressman enum efa_admin_aq_opcode {
1401edac3aSGal Pressman 	EFA_ADMIN_CREATE_QP                         = 1,
1501edac3aSGal Pressman 	EFA_ADMIN_MODIFY_QP                         = 2,
1601edac3aSGal Pressman 	EFA_ADMIN_QUERY_QP                          = 3,
1701edac3aSGal Pressman 	EFA_ADMIN_DESTROY_QP                        = 4,
1801edac3aSGal Pressman 	EFA_ADMIN_CREATE_AH                         = 5,
1901edac3aSGal Pressman 	EFA_ADMIN_DESTROY_AH                        = 6,
2001edac3aSGal Pressman 	EFA_ADMIN_REG_MR                            = 7,
2101edac3aSGal Pressman 	EFA_ADMIN_DEREG_MR                          = 8,
2201edac3aSGal Pressman 	EFA_ADMIN_CREATE_CQ                         = 9,
2301edac3aSGal Pressman 	EFA_ADMIN_DESTROY_CQ                        = 10,
2401edac3aSGal Pressman 	EFA_ADMIN_GET_FEATURE                       = 11,
2501edac3aSGal Pressman 	EFA_ADMIN_SET_FEATURE                       = 12,
2601edac3aSGal Pressman 	EFA_ADMIN_GET_STATS                         = 13,
2701edac3aSGal Pressman 	EFA_ADMIN_ALLOC_PD                          = 14,
2801edac3aSGal Pressman 	EFA_ADMIN_DEALLOC_PD                        = 15,
2901edac3aSGal Pressman 	EFA_ADMIN_ALLOC_UAR                         = 16,
3001edac3aSGal Pressman 	EFA_ADMIN_DEALLOC_UAR                       = 17,
312a152512SGal Pressman 	EFA_ADMIN_CREATE_EQ                         = 18,
322a152512SGal Pressman 	EFA_ADMIN_DESTROY_EQ                        = 19,
332a152512SGal Pressman 	EFA_ADMIN_MAX_OPCODE                        = 19,
3401edac3aSGal Pressman };
3501edac3aSGal Pressman 
3601edac3aSGal Pressman enum efa_admin_aq_feature_id {
3701edac3aSGal Pressman 	EFA_ADMIN_DEVICE_ATTR                       = 1,
3801edac3aSGal Pressman 	EFA_ADMIN_AENQ_CONFIG                       = 2,
3901edac3aSGal Pressman 	EFA_ADMIN_NETWORK_ATTR                      = 3,
4001edac3aSGal Pressman 	EFA_ADMIN_QUEUE_ATTR                        = 4,
4101edac3aSGal Pressman 	EFA_ADMIN_HW_HINTS                          = 5,
42e1ca01a9SGal Pressman 	EFA_ADMIN_HOST_INFO                         = 6,
432a152512SGal Pressman 	EFA_ADMIN_EVENT_QUEUE_ATTR                  = 7,
4401edac3aSGal Pressman };
4501edac3aSGal Pressman 
4601edac3aSGal Pressman /* QP transport type */
4701edac3aSGal Pressman enum efa_admin_qp_type {
4801edac3aSGal Pressman 	/* Unreliable Datagram */
4901edac3aSGal Pressman 	EFA_ADMIN_QP_TYPE_UD                        = 1,
5001edac3aSGal Pressman 	/* Scalable Reliable Datagram */
5101edac3aSGal Pressman 	EFA_ADMIN_QP_TYPE_SRD                       = 2,
5201edac3aSGal Pressman };
5301edac3aSGal Pressman 
5401edac3aSGal Pressman /* QP state */
5501edac3aSGal Pressman enum efa_admin_qp_state {
5601edac3aSGal Pressman 	EFA_ADMIN_QP_STATE_RESET                    = 0,
5701edac3aSGal Pressman 	EFA_ADMIN_QP_STATE_INIT                     = 1,
5801edac3aSGal Pressman 	EFA_ADMIN_QP_STATE_RTR                      = 2,
5901edac3aSGal Pressman 	EFA_ADMIN_QP_STATE_RTS                      = 3,
6001edac3aSGal Pressman 	EFA_ADMIN_QP_STATE_SQD                      = 4,
6101edac3aSGal Pressman 	EFA_ADMIN_QP_STATE_SQE                      = 5,
6201edac3aSGal Pressman 	EFA_ADMIN_QP_STATE_ERR                      = 6,
6301edac3aSGal Pressman };
6401edac3aSGal Pressman 
6501edac3aSGal Pressman enum efa_admin_get_stats_type {
6601edac3aSGal Pressman 	EFA_ADMIN_GET_STATS_TYPE_BASIC              = 0,
67b0cff387SDaniel Kranzdorf 	EFA_ADMIN_GET_STATS_TYPE_MESSAGES           = 1,
68b0cff387SDaniel Kranzdorf 	EFA_ADMIN_GET_STATS_TYPE_RDMA_READ          = 2,
69*113383efSMichael Margolin 	EFA_ADMIN_GET_STATS_TYPE_RDMA_WRITE         = 3,
7001edac3aSGal Pressman };
7101edac3aSGal Pressman 
7201edac3aSGal Pressman enum efa_admin_get_stats_scope {
7301edac3aSGal Pressman 	EFA_ADMIN_GET_STATS_SCOPE_ALL               = 0,
7401edac3aSGal Pressman 	EFA_ADMIN_GET_STATS_SCOPE_QUEUE             = 1,
7501edac3aSGal Pressman };
7601edac3aSGal Pressman 
7701edac3aSGal Pressman /*
7801edac3aSGal Pressman  * QP allocation sizes, converted by fabric QueuePair (QP) create command
7901edac3aSGal Pressman  * from QP capabilities.
8001edac3aSGal Pressman  */
8101edac3aSGal Pressman struct efa_admin_qp_alloc_size {
8201edac3aSGal Pressman 	/* Send descriptor ring size in bytes */
8301edac3aSGal Pressman 	u32 send_queue_ring_size;
8401edac3aSGal Pressman 
8501edac3aSGal Pressman 	/* Max number of WQEs that can be outstanding on send queue. */
8601edac3aSGal Pressman 	u32 send_queue_depth;
8701edac3aSGal Pressman 
8801edac3aSGal Pressman 	/*
8901edac3aSGal Pressman 	 * Recv descriptor ring size in bytes, sufficient for user-provided
9001edac3aSGal Pressman 	 * number of WQEs
9101edac3aSGal Pressman 	 */
9201edac3aSGal Pressman 	u32 recv_queue_ring_size;
9301edac3aSGal Pressman 
9401edac3aSGal Pressman 	/* Max number of WQEs that can be outstanding on recv queue */
9501edac3aSGal Pressman 	u32 recv_queue_depth;
9601edac3aSGal Pressman };
9701edac3aSGal Pressman 
9801edac3aSGal Pressman struct efa_admin_create_qp_cmd {
9901edac3aSGal Pressman 	/* Common Admin Queue descriptor */
10001edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
10101edac3aSGal Pressman 
10201edac3aSGal Pressman 	/* Protection Domain associated with this QP */
10301edac3aSGal Pressman 	u16 pd;
10401edac3aSGal Pressman 
10501edac3aSGal Pressman 	/* QP type */
10601edac3aSGal Pressman 	u8 qp_type;
10701edac3aSGal Pressman 
10801edac3aSGal Pressman 	/*
10901edac3aSGal Pressman 	 * 0 : sq_virt - If set, SQ ring base address is
11001edac3aSGal Pressman 	 *    virtual (IOVA returned by MR registration)
11101edac3aSGal Pressman 	 * 1 : rq_virt - If set, RQ ring base address is
11201edac3aSGal Pressman 	 *    virtual (IOVA returned by MR registration)
11301edac3aSGal Pressman 	 * 7:2 : reserved - MBZ
11401edac3aSGal Pressman 	 */
11501edac3aSGal Pressman 	u8 flags;
11601edac3aSGal Pressman 
11701edac3aSGal Pressman 	/*
11801edac3aSGal Pressman 	 * Send queue (SQ) ring base physical address. This field is not
11901edac3aSGal Pressman 	 * used if this is a Low Latency Queue(LLQ).
12001edac3aSGal Pressman 	 */
12101edac3aSGal Pressman 	u64 sq_base_addr;
12201edac3aSGal Pressman 
12301edac3aSGal Pressman 	/* Receive queue (RQ) ring base address. */
12401edac3aSGal Pressman 	u64 rq_base_addr;
12501edac3aSGal Pressman 
12601edac3aSGal Pressman 	/* Index of CQ to be associated with Send Queue completions */
12701edac3aSGal Pressman 	u32 send_cq_idx;
12801edac3aSGal Pressman 
12901edac3aSGal Pressman 	/* Index of CQ to be associated with Recv Queue completions */
13001edac3aSGal Pressman 	u32 recv_cq_idx;
13101edac3aSGal Pressman 
13201edac3aSGal Pressman 	/*
13301edac3aSGal Pressman 	 * Memory registration key for the SQ ring, used only when not in
13401edac3aSGal Pressman 	 * LLQ mode and base address is virtual
13501edac3aSGal Pressman 	 */
13601edac3aSGal Pressman 	u32 sq_l_key;
13701edac3aSGal Pressman 
13801edac3aSGal Pressman 	/*
13901edac3aSGal Pressman 	 * Memory registration key for the RQ ring, used only when base
14001edac3aSGal Pressman 	 * address is virtual
14101edac3aSGal Pressman 	 */
14201edac3aSGal Pressman 	u32 rq_l_key;
14301edac3aSGal Pressman 
14401edac3aSGal Pressman 	/* Requested QP allocation sizes */
14501edac3aSGal Pressman 	struct efa_admin_qp_alloc_size qp_alloc_size;
14601edac3aSGal Pressman 
14701edac3aSGal Pressman 	/* UAR number */
14801edac3aSGal Pressman 	u16 uar;
14901edac3aSGal Pressman 
15001edac3aSGal Pressman 	/* MBZ */
15101edac3aSGal Pressman 	u16 reserved;
15201edac3aSGal Pressman 
15301edac3aSGal Pressman 	/* MBZ */
15401edac3aSGal Pressman 	u32 reserved2;
15501edac3aSGal Pressman };
15601edac3aSGal Pressman 
15701edac3aSGal Pressman struct efa_admin_create_qp_resp {
15801edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
15901edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
16001edac3aSGal Pressman 
16157f63f37SGal Pressman 	/*
16257f63f37SGal Pressman 	 * Opaque handle to be used for consequent admin operations on the
16357f63f37SGal Pressman 	 * QP
16457f63f37SGal Pressman 	 */
16501edac3aSGal Pressman 	u32 qp_handle;
16601edac3aSGal Pressman 
16757f63f37SGal Pressman 	/*
168631b6189SGal Pressman 	 * QP number in the given EFA virtual device. Least-significant bits (as
169631b6189SGal Pressman 	 * needed according to max_qp) carry unique QP ID
17057f63f37SGal Pressman 	 */
17101edac3aSGal Pressman 	u16 qp_num;
17201edac3aSGal Pressman 
17301edac3aSGal Pressman 	/* MBZ */
17401edac3aSGal Pressman 	u16 reserved;
17501edac3aSGal Pressman 
17601edac3aSGal Pressman 	/* Index of sub-CQ for Send Queue completions */
17701edac3aSGal Pressman 	u16 send_sub_cq_idx;
17801edac3aSGal Pressman 
17901edac3aSGal Pressman 	/* Index of sub-CQ for Receive Queue completions */
18001edac3aSGal Pressman 	u16 recv_sub_cq_idx;
18101edac3aSGal Pressman 
18201edac3aSGal Pressman 	/* SQ doorbell address, as offset to PCIe DB BAR */
18301edac3aSGal Pressman 	u32 sq_db_offset;
18401edac3aSGal Pressman 
18501edac3aSGal Pressman 	/* RQ doorbell address, as offset to PCIe DB BAR */
18601edac3aSGal Pressman 	u32 rq_db_offset;
18701edac3aSGal Pressman 
18801edac3aSGal Pressman 	/*
18901edac3aSGal Pressman 	 * low latency send queue ring base address as an offset to PCIe
19001edac3aSGal Pressman 	 * MMIO LLQ_MEM BAR
19101edac3aSGal Pressman 	 */
19201edac3aSGal Pressman 	u32 llq_descriptors_offset;
19301edac3aSGal Pressman };
19401edac3aSGal Pressman 
19501edac3aSGal Pressman struct efa_admin_modify_qp_cmd {
19601edac3aSGal Pressman 	/* Common Admin Queue descriptor */
19701edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
19801edac3aSGal Pressman 
19901edac3aSGal Pressman 	/*
200ab67baddSGal Pressman 	 * Mask indicating which fields should be updated
201ab67baddSGal Pressman 	 * 0 : qp_state
202ab67baddSGal Pressman 	 * 1 : cur_qp_state
203ab67baddSGal Pressman 	 * 2 : qkey
204ab67baddSGal Pressman 	 * 3 : sq_psn
205ab67baddSGal Pressman 	 * 4 : sq_drained_async_notify
206a4e6a1ddSGal Pressman 	 * 5 : rnr_retry
207a4e6a1ddSGal Pressman 	 * 31:6 : reserved
20801edac3aSGal Pressman 	 */
20901edac3aSGal Pressman 	u32 modify_mask;
21001edac3aSGal Pressman 
21101edac3aSGal Pressman 	/* QP handle returned by create_qp command */
21201edac3aSGal Pressman 	u32 qp_handle;
21301edac3aSGal Pressman 
21401edac3aSGal Pressman 	/* QP state */
21501edac3aSGal Pressman 	u32 qp_state;
21601edac3aSGal Pressman 
21701edac3aSGal Pressman 	/* Override current QP state (before applying the transition) */
21801edac3aSGal Pressman 	u32 cur_qp_state;
21901edac3aSGal Pressman 
22001edac3aSGal Pressman 	/* QKey */
22101edac3aSGal Pressman 	u32 qkey;
22201edac3aSGal Pressman 
22301edac3aSGal Pressman 	/* SQ PSN */
22401edac3aSGal Pressman 	u32 sq_psn;
22501edac3aSGal Pressman 
22601edac3aSGal Pressman 	/* Enable async notification when SQ is drained */
22701edac3aSGal Pressman 	u8 sq_drained_async_notify;
22801edac3aSGal Pressman 
229a4e6a1ddSGal Pressman 	/* Number of RNR retries (valid only for SRD QPs) */
230a4e6a1ddSGal Pressman 	u8 rnr_retry;
23101edac3aSGal Pressman 
23201edac3aSGal Pressman 	/* MBZ */
23301edac3aSGal Pressman 	u16 reserved2;
23401edac3aSGal Pressman };
23501edac3aSGal Pressman 
23601edac3aSGal Pressman struct efa_admin_modify_qp_resp {
23701edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
23801edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
23901edac3aSGal Pressman };
24001edac3aSGal Pressman 
24101edac3aSGal Pressman struct efa_admin_query_qp_cmd {
24201edac3aSGal Pressman 	/* Common Admin Queue descriptor */
24301edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
24401edac3aSGal Pressman 
24501edac3aSGal Pressman 	/* QP handle returned by create_qp command */
24601edac3aSGal Pressman 	u32 qp_handle;
24701edac3aSGal Pressman };
24801edac3aSGal Pressman 
24901edac3aSGal Pressman struct efa_admin_query_qp_resp {
25001edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
25101edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
25201edac3aSGal Pressman 
25301edac3aSGal Pressman 	/* QP state */
25401edac3aSGal Pressman 	u32 qp_state;
25501edac3aSGal Pressman 
25601edac3aSGal Pressman 	/* QKey */
25701edac3aSGal Pressman 	u32 qkey;
25801edac3aSGal Pressman 
25901edac3aSGal Pressman 	/* SQ PSN */
26001edac3aSGal Pressman 	u32 sq_psn;
26101edac3aSGal Pressman 
26201edac3aSGal Pressman 	/* Indicates that draining is in progress */
26301edac3aSGal Pressman 	u8 sq_draining;
26401edac3aSGal Pressman 
265a4e6a1ddSGal Pressman 	/* Number of RNR retries (valid only for SRD QPs) */
266a4e6a1ddSGal Pressman 	u8 rnr_retry;
26701edac3aSGal Pressman 
26801edac3aSGal Pressman 	/* MBZ */
26901edac3aSGal Pressman 	u16 reserved2;
27001edac3aSGal Pressman };
27101edac3aSGal Pressman 
27201edac3aSGal Pressman struct efa_admin_destroy_qp_cmd {
27301edac3aSGal Pressman 	/* Common Admin Queue descriptor */
27401edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
27501edac3aSGal Pressman 
27601edac3aSGal Pressman 	/* QP handle returned by create_qp command */
27701edac3aSGal Pressman 	u32 qp_handle;
27801edac3aSGal Pressman };
27901edac3aSGal Pressman 
28001edac3aSGal Pressman struct efa_admin_destroy_qp_resp {
28101edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
28201edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
28301edac3aSGal Pressman };
28401edac3aSGal Pressman 
28501edac3aSGal Pressman /*
28601edac3aSGal Pressman  * Create Address Handle command parameters. Must not be called more than
28701edac3aSGal Pressman  * once for the same destination
28801edac3aSGal Pressman  */
28901edac3aSGal Pressman struct efa_admin_create_ah_cmd {
29001edac3aSGal Pressman 	/* Common Admin Queue descriptor */
29101edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
29201edac3aSGal Pressman 
29301edac3aSGal Pressman 	/* Destination address in network byte order */
29401edac3aSGal Pressman 	u8 dest_addr[16];
29501edac3aSGal Pressman 
29601edac3aSGal Pressman 	/* PD number */
29701edac3aSGal Pressman 	u16 pd;
29801edac3aSGal Pressman 
29957f63f37SGal Pressman 	/* MBZ */
30001edac3aSGal Pressman 	u16 reserved;
30101edac3aSGal Pressman };
30201edac3aSGal Pressman 
30301edac3aSGal Pressman struct efa_admin_create_ah_resp {
30401edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
30501edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
30601edac3aSGal Pressman 
30701edac3aSGal Pressman 	/* Target interface address handle (opaque) */
30801edac3aSGal Pressman 	u16 ah;
30901edac3aSGal Pressman 
31057f63f37SGal Pressman 	/* MBZ */
31101edac3aSGal Pressman 	u16 reserved;
31201edac3aSGal Pressman };
31301edac3aSGal Pressman 
31401edac3aSGal Pressman struct efa_admin_destroy_ah_cmd {
31501edac3aSGal Pressman 	/* Common Admin Queue descriptor */
31601edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
31701edac3aSGal Pressman 
31801edac3aSGal Pressman 	/* Target interface address handle (opaque) */
31901edac3aSGal Pressman 	u16 ah;
32001edac3aSGal Pressman 
32101edac3aSGal Pressman 	/* PD number */
32201edac3aSGal Pressman 	u16 pd;
32301edac3aSGal Pressman };
32401edac3aSGal Pressman 
32501edac3aSGal Pressman struct efa_admin_destroy_ah_resp {
32601edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
32701edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
32801edac3aSGal Pressman };
32901edac3aSGal Pressman 
33001edac3aSGal Pressman /*
33101edac3aSGal Pressman  * Registration of MemoryRegion, required for QP working with Virtual
33201edac3aSGal Pressman  * Addresses. In standard verbs semantics, region length is limited to 2GB
33301edac3aSGal Pressman  * space, but EFA offers larger MR support for large memory space, to ease
33401edac3aSGal Pressman  * on users working with very large datasets (i.e. full GPU memory mapping).
33501edac3aSGal Pressman  */
33601edac3aSGal Pressman struct efa_admin_reg_mr_cmd {
33701edac3aSGal Pressman 	/* Common Admin Queue descriptor */
33801edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
33901edac3aSGal Pressman 
34001edac3aSGal Pressman 	/* Protection Domain */
34101edac3aSGal Pressman 	u16 pd;
34201edac3aSGal Pressman 
34301edac3aSGal Pressman 	/* MBZ */
34401edac3aSGal Pressman 	u16 reserved16_w1;
34501edac3aSGal Pressman 
34601edac3aSGal Pressman 	/* Physical Buffer List, each element is page-aligned. */
34701edac3aSGal Pressman 	union {
34801edac3aSGal Pressman 		/*
34901edac3aSGal Pressman 		 * Inline array of guest-physical page addresses of user
35001edac3aSGal Pressman 		 * memory pages (optimization for short region
35101edac3aSGal Pressman 		 * registrations)
35201edac3aSGal Pressman 		 */
35301edac3aSGal Pressman 		u64 inline_pbl_array[4];
35401edac3aSGal Pressman 
35501edac3aSGal Pressman 		/* points to PBL (direct or indirect, chained if needed) */
35601edac3aSGal Pressman 		struct efa_admin_ctrl_buff_info pbl;
35701edac3aSGal Pressman 	} pbl;
35801edac3aSGal Pressman 
35901edac3aSGal Pressman 	/* Memory region length, in bytes. */
36001edac3aSGal Pressman 	u64 mr_length;
36101edac3aSGal Pressman 
36201edac3aSGal Pressman 	/*
36301edac3aSGal Pressman 	 * flags and page size
36401edac3aSGal Pressman 	 * 4:0 : phys_page_size_shift - page size is (1 <<
36501edac3aSGal Pressman 	 *    phys_page_size_shift). Page size is used for
36601edac3aSGal Pressman 	 *    building the Virtual to Physical address mapping
36701edac3aSGal Pressman 	 * 6:5 : reserved - MBZ
36801edac3aSGal Pressman 	 * 7 : mem_addr_phy_mode_en - Enable bit for physical
36901edac3aSGal Pressman 	 *    memory registration (no translation), can be used
37001edac3aSGal Pressman 	 *    only by privileged clients. If set, PBL must
37101edac3aSGal Pressman 	 *    contain a single entry.
37201edac3aSGal Pressman 	 */
37301edac3aSGal Pressman 	u8 flags;
37401edac3aSGal Pressman 
37501edac3aSGal Pressman 	/*
37601edac3aSGal Pressman 	 * permissions
377e6c4f3ffSDaniel Kranzdorf 	 * 0 : local_write_enable - Local write permissions:
378e6c4f3ffSDaniel Kranzdorf 	 *    must be set for RQ buffers and buffers posted for
379e6c4f3ffSDaniel Kranzdorf 	 *    RDMA Read requests
380531094dcSYonatan Nachum 	 * 1 : remote_write_enable - Remote write
381531094dcSYonatan Nachum 	 *    permissions: must be set to enable RDMA write to
382531094dcSYonatan Nachum 	 *    the region
383e6c4f3ffSDaniel Kranzdorf 	 * 2 : remote_read_enable - Remote read permissions:
384e6c4f3ffSDaniel Kranzdorf 	 *    must be set to enable RDMA read from the region
385e6c4f3ffSDaniel Kranzdorf 	 * 7:3 : reserved2 - MBZ
38601edac3aSGal Pressman 	 */
38701edac3aSGal Pressman 	u8 permissions;
38801edac3aSGal Pressman 
38957f63f37SGal Pressman 	/* MBZ */
39001edac3aSGal Pressman 	u16 reserved16_w5;
39101edac3aSGal Pressman 
39201edac3aSGal Pressman 	/* number of pages in PBL (redundant, could be calculated) */
39301edac3aSGal Pressman 	u32 page_num;
39401edac3aSGal Pressman 
39501edac3aSGal Pressman 	/*
39601edac3aSGal Pressman 	 * IO Virtual Address associated with this MR. If
39701edac3aSGal Pressman 	 * mem_addr_phy_mode_en is set, contains the physical address of
39801edac3aSGal Pressman 	 * the region.
39901edac3aSGal Pressman 	 */
40001edac3aSGal Pressman 	u64 iova;
40101edac3aSGal Pressman };
40201edac3aSGal Pressman 
40301edac3aSGal Pressman struct efa_admin_reg_mr_resp {
40401edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
40501edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
40601edac3aSGal Pressman 
40701edac3aSGal Pressman 	/*
40801edac3aSGal Pressman 	 * L_Key, to be used in conjunction with local buffer references in
40901edac3aSGal Pressman 	 * SQ and RQ WQE, or with virtual RQ/CQ rings
41001edac3aSGal Pressman 	 */
41101edac3aSGal Pressman 	u32 l_key;
41201edac3aSGal Pressman 
41301edac3aSGal Pressman 	/*
41401edac3aSGal Pressman 	 * R_Key, to be used in RDMA messages to refer to remotely accessed
41501edac3aSGal Pressman 	 * memory region
41601edac3aSGal Pressman 	 */
41701edac3aSGal Pressman 	u32 r_key;
41801edac3aSGal Pressman };
41901edac3aSGal Pressman 
42001edac3aSGal Pressman struct efa_admin_dereg_mr_cmd {
42101edac3aSGal Pressman 	/* Common Admin Queue descriptor */
42201edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
42301edac3aSGal Pressman 
42401edac3aSGal Pressman 	/* L_Key, memory region's l_key */
42501edac3aSGal Pressman 	u32 l_key;
42601edac3aSGal Pressman };
42701edac3aSGal Pressman 
42801edac3aSGal Pressman struct efa_admin_dereg_mr_resp {
42901edac3aSGal Pressman 	/* Common Admin Queue completion descriptor */
43001edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
43101edac3aSGal Pressman };
43201edac3aSGal Pressman 
43301edac3aSGal Pressman struct efa_admin_create_cq_cmd {
43401edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
43501edac3aSGal Pressman 
43601edac3aSGal Pressman 	/*
43757f63f37SGal Pressman 	 * 4:0 : reserved5 - MBZ
43801edac3aSGal Pressman 	 * 5 : interrupt_mode_enabled - if set, cq operates
4392a152512SGal Pressman 	 *    in interrupt mode (i.e. CQ events and EQ elements
4402a152512SGal Pressman 	 *    are generated), otherwise - polling
44101edac3aSGal Pressman 	 * 6 : virt - If set, ring base address is virtual
44201edac3aSGal Pressman 	 *    (IOVA returned by MR registration)
44357f63f37SGal Pressman 	 * 7 : reserved6 - MBZ
44401edac3aSGal Pressman 	 */
44501edac3aSGal Pressman 	u8 cq_caps_1;
44601edac3aSGal Pressman 
44701edac3aSGal Pressman 	/*
44801edac3aSGal Pressman 	 * 4:0 : cq_entry_size_words - size of CQ entry in
44901edac3aSGal Pressman 	 *    32-bit words, valid values: 4, 8.
450dc13fbf7SMichael Margolin 	 * 5 : set_src_addr - If set, source address will be
451dc13fbf7SMichael Margolin 	 *    filled on RX completions from unknown senders.
452dc13fbf7SMichael Margolin 	 *    Requires 8 words CQ entry size.
453dc13fbf7SMichael Margolin 	 * 7:6 : reserved7 - MBZ
45401edac3aSGal Pressman 	 */
45501edac3aSGal Pressman 	u8 cq_caps_2;
45601edac3aSGal Pressman 
45701edac3aSGal Pressman 	/* completion queue depth in # of entries. must be power of 2 */
45801edac3aSGal Pressman 	u16 cq_depth;
45901edac3aSGal Pressman 
4602a152512SGal Pressman 	/* EQ number assigned to this cq */
4612a152512SGal Pressman 	u16 eqn;
4622a152512SGal Pressman 
4632a152512SGal Pressman 	/* MBZ */
4642a152512SGal Pressman 	u16 reserved;
46501edac3aSGal Pressman 
46601edac3aSGal Pressman 	/*
46701edac3aSGal Pressman 	 * CQ ring base address, virtual or physical depending on 'virt'
46801edac3aSGal Pressman 	 * flag
46901edac3aSGal Pressman 	 */
47001edac3aSGal Pressman 	struct efa_common_mem_addr cq_ba;
47101edac3aSGal Pressman 
47201edac3aSGal Pressman 	/*
47301edac3aSGal Pressman 	 * Memory registration key for the ring, used only when base
47401edac3aSGal Pressman 	 * address is virtual
47501edac3aSGal Pressman 	 */
47601edac3aSGal Pressman 	u32 l_key;
47701edac3aSGal Pressman 
47801edac3aSGal Pressman 	/*
47901edac3aSGal Pressman 	 * number of sub cqs - must be equal to sub_cqs_per_cq of queue
48001edac3aSGal Pressman 	 * attributes.
48101edac3aSGal Pressman 	 */
48201edac3aSGal Pressman 	u16 num_sub_cqs;
48301edac3aSGal Pressman 
48401edac3aSGal Pressman 	/* UAR number */
48501edac3aSGal Pressman 	u16 uar;
48601edac3aSGal Pressman };
48701edac3aSGal Pressman 
48801edac3aSGal Pressman struct efa_admin_create_cq_resp {
48901edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
49001edac3aSGal Pressman 
49101edac3aSGal Pressman 	u16 cq_idx;
49201edac3aSGal Pressman 
49301edac3aSGal Pressman 	/* actual cq depth in number of entries */
49401edac3aSGal Pressman 	u16 cq_actual_depth;
4952a152512SGal Pressman 
4962a152512SGal Pressman 	/* CQ doorbell address, as offset to PCIe DB BAR */
4972a152512SGal Pressman 	u32 db_offset;
4982a152512SGal Pressman 
4992a152512SGal Pressman 	/*
5002a152512SGal Pressman 	 * 0 : db_valid - If set, doorbell offset is valid.
5012a152512SGal Pressman 	 *    Always set when interrupts are requested.
5022a152512SGal Pressman 	 */
5032a152512SGal Pressman 	u32 flags;
50401edac3aSGal Pressman };
50501edac3aSGal Pressman 
50601edac3aSGal Pressman struct efa_admin_destroy_cq_cmd {
50701edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_desc;
50801edac3aSGal Pressman 
50901edac3aSGal Pressman 	u16 cq_idx;
51001edac3aSGal Pressman 
51157f63f37SGal Pressman 	/* MBZ */
51201edac3aSGal Pressman 	u16 reserved1;
51301edac3aSGal Pressman };
51401edac3aSGal Pressman 
51501edac3aSGal Pressman struct efa_admin_destroy_cq_resp {
51601edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
51701edac3aSGal Pressman };
51801edac3aSGal Pressman 
51901edac3aSGal Pressman /*
52001edac3aSGal Pressman  * EFA AQ Get Statistics command. Extended statistics are placed in control
52101edac3aSGal Pressman  * buffer pointed by AQ entry
52201edac3aSGal Pressman  */
52301edac3aSGal Pressman struct efa_admin_aq_get_stats_cmd {
52401edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
52501edac3aSGal Pressman 
52601edac3aSGal Pressman 	union {
52701edac3aSGal Pressman 		/* command specific inline data */
52801edac3aSGal Pressman 		u32 inline_data_w1[3];
52901edac3aSGal Pressman 
53001edac3aSGal Pressman 		struct efa_admin_ctrl_buff_info control_buffer;
53101edac3aSGal Pressman 	} u;
53201edac3aSGal Pressman 
53301edac3aSGal Pressman 	/* stats type as defined in enum efa_admin_get_stats_type */
53401edac3aSGal Pressman 	u8 type;
53501edac3aSGal Pressman 
53601edac3aSGal Pressman 	/* stats scope defined in enum efa_admin_get_stats_scope */
53701edac3aSGal Pressman 	u8 scope;
53801edac3aSGal Pressman 
53901edac3aSGal Pressman 	u16 scope_modifier;
54001edac3aSGal Pressman };
54101edac3aSGal Pressman 
54201edac3aSGal Pressman struct efa_admin_basic_stats {
54301edac3aSGal Pressman 	u64 tx_bytes;
54401edac3aSGal Pressman 
54501edac3aSGal Pressman 	u64 tx_pkts;
54601edac3aSGal Pressman 
54701edac3aSGal Pressman 	u64 rx_bytes;
54801edac3aSGal Pressman 
54901edac3aSGal Pressman 	u64 rx_pkts;
55001edac3aSGal Pressman 
55101edac3aSGal Pressman 	u64 rx_drops;
55201edac3aSGal Pressman };
55301edac3aSGal Pressman 
554b0cff387SDaniel Kranzdorf struct efa_admin_messages_stats {
555b0cff387SDaniel Kranzdorf 	u64 send_bytes;
556b0cff387SDaniel Kranzdorf 
557b0cff387SDaniel Kranzdorf 	u64 send_wrs;
558b0cff387SDaniel Kranzdorf 
559b0cff387SDaniel Kranzdorf 	u64 recv_bytes;
560b0cff387SDaniel Kranzdorf 
561b0cff387SDaniel Kranzdorf 	u64 recv_wrs;
562b0cff387SDaniel Kranzdorf };
563b0cff387SDaniel Kranzdorf 
564b0cff387SDaniel Kranzdorf struct efa_admin_rdma_read_stats {
565b0cff387SDaniel Kranzdorf 	u64 read_wrs;
566b0cff387SDaniel Kranzdorf 
567b0cff387SDaniel Kranzdorf 	u64 read_bytes;
568b0cff387SDaniel Kranzdorf 
569b0cff387SDaniel Kranzdorf 	u64 read_wr_err;
570b0cff387SDaniel Kranzdorf 
571b0cff387SDaniel Kranzdorf 	u64 read_resp_bytes;
572b0cff387SDaniel Kranzdorf };
573b0cff387SDaniel Kranzdorf 
574*113383efSMichael Margolin struct efa_admin_rdma_write_stats {
575*113383efSMichael Margolin 	u64 write_wrs;
576*113383efSMichael Margolin 
577*113383efSMichael Margolin 	u64 write_bytes;
578*113383efSMichael Margolin 
579*113383efSMichael Margolin 	u64 write_wr_err;
580*113383efSMichael Margolin 
581*113383efSMichael Margolin 	u64 write_recv_bytes;
582*113383efSMichael Margolin };
583*113383efSMichael Margolin 
58401edac3aSGal Pressman struct efa_admin_acq_get_stats_resp {
58501edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
58601edac3aSGal Pressman 
587b0cff387SDaniel Kranzdorf 	union {
58801edac3aSGal Pressman 		struct efa_admin_basic_stats basic_stats;
589b0cff387SDaniel Kranzdorf 
590b0cff387SDaniel Kranzdorf 		struct efa_admin_messages_stats messages_stats;
591b0cff387SDaniel Kranzdorf 
592b0cff387SDaniel Kranzdorf 		struct efa_admin_rdma_read_stats rdma_read_stats;
593*113383efSMichael Margolin 
594*113383efSMichael Margolin 		struct efa_admin_rdma_write_stats rdma_write_stats;
595b0cff387SDaniel Kranzdorf 	} u;
59601edac3aSGal Pressman };
59701edac3aSGal Pressman 
59801edac3aSGal Pressman struct efa_admin_get_set_feature_common_desc {
5999bf61b8cSGal Pressman 	/* MBZ */
6009bf61b8cSGal Pressman 	u8 reserved0;
60101edac3aSGal Pressman 
60201edac3aSGal Pressman 	/* as appears in efa_admin_aq_feature_id */
60301edac3aSGal Pressman 	u8 feature_id;
60401edac3aSGal Pressman 
60501edac3aSGal Pressman 	/* MBZ */
60601edac3aSGal Pressman 	u16 reserved16;
60701edac3aSGal Pressman };
60801edac3aSGal Pressman 
60901edac3aSGal Pressman struct efa_admin_feature_device_attr_desc {
61001edac3aSGal Pressman 	/* Bitmap of efa_admin_aq_feature_id */
61101edac3aSGal Pressman 	u64 supported_features;
61201edac3aSGal Pressman 
61301edac3aSGal Pressman 	/* Bitmap of supported page sizes in MR registrations */
61401edac3aSGal Pressman 	u64 page_size_cap;
61501edac3aSGal Pressman 
61601edac3aSGal Pressman 	u32 fw_version;
61701edac3aSGal Pressman 
61801edac3aSGal Pressman 	u32 admin_api_version;
61901edac3aSGal Pressman 
62001edac3aSGal Pressman 	u32 device_version;
62101edac3aSGal Pressman 
62201edac3aSGal Pressman 	/* Bar used for SQ and RQ doorbells */
62301edac3aSGal Pressman 	u16 db_bar;
62401edac3aSGal Pressman 
62557f63f37SGal Pressman 	/* Indicates how many bits are used on physical address access */
62601edac3aSGal Pressman 	u8 phys_addr_width;
62701edac3aSGal Pressman 
62857f63f37SGal Pressman 	/* Indicates how many bits are used on virtual address access */
62901edac3aSGal Pressman 	u8 virt_addr_width;
630666e8ff5SDaniel Kranzdorf 
631666e8ff5SDaniel Kranzdorf 	/*
632666e8ff5SDaniel Kranzdorf 	 * 0 : rdma_read - If set, RDMA Read is supported on
633666e8ff5SDaniel Kranzdorf 	 *    TX queues
634a4e6a1ddSGal Pressman 	 * 1 : rnr_retry - If set, RNR retry is supported on
635a4e6a1ddSGal Pressman 	 *    modify QP command
6366dddd939SYonatan Nachum 	 * 2 : data_polling_128 - If set, 128 bytes data
6376dddd939SYonatan Nachum 	 *    polling is supported
638531094dcSYonatan Nachum 	 * 3 : rdma_write - If set, RDMA Write is supported
639531094dcSYonatan Nachum 	 *    on TX queues
640531094dcSYonatan Nachum 	 * 31:4 : reserved - MBZ
641666e8ff5SDaniel Kranzdorf 	 */
642666e8ff5SDaniel Kranzdorf 	u32 device_caps;
643666e8ff5SDaniel Kranzdorf 
644666e8ff5SDaniel Kranzdorf 	/* Max RDMA transfer size in bytes */
645666e8ff5SDaniel Kranzdorf 	u32 max_rdma_size;
64601edac3aSGal Pressman };
64701edac3aSGal Pressman 
64801edac3aSGal Pressman struct efa_admin_feature_queue_attr_desc {
64901edac3aSGal Pressman 	/* The maximum number of queue pairs supported */
65001edac3aSGal Pressman 	u32 max_qp;
65101edac3aSGal Pressman 
65257f63f37SGal Pressman 	/* Maximum number of WQEs per Send Queue */
65301edac3aSGal Pressman 	u32 max_sq_depth;
65401edac3aSGal Pressman 
65557f63f37SGal Pressman 	/* Maximum size of data that can be sent inline in a Send WQE */
65601edac3aSGal Pressman 	u32 inline_buf_size;
65701edac3aSGal Pressman 
65857f63f37SGal Pressman 	/* Maximum number of buffer descriptors per Recv Queue */
65901edac3aSGal Pressman 	u32 max_rq_depth;
66001edac3aSGal Pressman 
66101edac3aSGal Pressman 	/* The maximum number of completion queues supported per VF */
66201edac3aSGal Pressman 	u32 max_cq;
66301edac3aSGal Pressman 
66457f63f37SGal Pressman 	/* Maximum number of CQEs per Completion Queue */
66501edac3aSGal Pressman 	u32 max_cq_depth;
66601edac3aSGal Pressman 
66701edac3aSGal Pressman 	/* Number of sub-CQs to be created for each CQ */
66801edac3aSGal Pressman 	u16 sub_cqs_per_cq;
66901edac3aSGal Pressman 
670da2924bdSGal Pressman 	/* Minimum number of WQEs per SQ */
671da2924bdSGal Pressman 	u16 min_sq_depth;
67201edac3aSGal Pressman 
67357f63f37SGal Pressman 	/* Maximum number of SGEs (buffers) allowed for a single send WQE */
67401edac3aSGal Pressman 	u16 max_wr_send_sges;
67501edac3aSGal Pressman 
67601edac3aSGal Pressman 	/* Maximum number of SGEs allowed for a single recv WQE */
67701edac3aSGal Pressman 	u16 max_wr_recv_sges;
67801edac3aSGal Pressman 
67901edac3aSGal Pressman 	/* The maximum number of memory regions supported */
68001edac3aSGal Pressman 	u32 max_mr;
68101edac3aSGal Pressman 
68201edac3aSGal Pressman 	/* The maximum number of pages can be registered */
68301edac3aSGal Pressman 	u32 max_mr_pages;
68401edac3aSGal Pressman 
68501edac3aSGal Pressman 	/* The maximum number of protection domains supported */
68601edac3aSGal Pressman 	u32 max_pd;
68701edac3aSGal Pressman 
68801edac3aSGal Pressman 	/* The maximum number of address handles supported */
68901edac3aSGal Pressman 	u32 max_ah;
69001edac3aSGal Pressman 
69101edac3aSGal Pressman 	/* The maximum size of LLQ in bytes */
69201edac3aSGal Pressman 	u32 max_llq_size;
693666e8ff5SDaniel Kranzdorf 
694531094dcSYonatan Nachum 	/* Maximum number of SGEs for a single RDMA read/write WQE */
695666e8ff5SDaniel Kranzdorf 	u16 max_wr_rdma_sges;
696556c811fSGal Pressman 
697556c811fSGal Pressman 	/*
698556c811fSGal Pressman 	 * Maximum number of bytes that can be written to SQ between two
699556c811fSGal Pressman 	 * consecutive doorbells (in units of 64B). Driver must ensure that only
700556c811fSGal Pressman 	 * complete WQEs are written to queue before issuing a doorbell.
701556c811fSGal Pressman 	 * Examples: max_tx_batch=16 and WQE size = 64B, means up to 16 WQEs can
702556c811fSGal Pressman 	 * be written to SQ between two consecutive doorbells. max_tx_batch=11
703556c811fSGal Pressman 	 * and WQE size = 128B, means up to 5 WQEs can be written to SQ between
704556c811fSGal Pressman 	 * two consecutive doorbells. Zero means unlimited.
705556c811fSGal Pressman 	 */
706556c811fSGal Pressman 	u16 max_tx_batch;
70701edac3aSGal Pressman };
70801edac3aSGal Pressman 
7092a152512SGal Pressman struct efa_admin_event_queue_attr_desc {
7102a152512SGal Pressman 	/* The maximum number of event queues supported */
7112a152512SGal Pressman 	u32 max_eq;
7122a152512SGal Pressman 
7132a152512SGal Pressman 	/* Maximum number of EQEs per Event Queue */
7142a152512SGal Pressman 	u32 max_eq_depth;
7152a152512SGal Pressman 
7162a152512SGal Pressman 	/* Supported events bitmask */
7172a152512SGal Pressman 	u32 event_bitmask;
7182a152512SGal Pressman };
7192a152512SGal Pressman 
72001edac3aSGal Pressman struct efa_admin_feature_aenq_desc {
72101edac3aSGal Pressman 	/* bitmask for AENQ groups the device can report */
72201edac3aSGal Pressman 	u32 supported_groups;
72301edac3aSGal Pressman 
72401edac3aSGal Pressman 	/* bitmask for AENQ groups to report */
72501edac3aSGal Pressman 	u32 enabled_groups;
72601edac3aSGal Pressman };
72701edac3aSGal Pressman 
72801edac3aSGal Pressman struct efa_admin_feature_network_attr_desc {
72901edac3aSGal Pressman 	/* Raw address data in network byte order */
73001edac3aSGal Pressman 	u8 addr[16];
73101edac3aSGal Pressman 
732666e8ff5SDaniel Kranzdorf 	/* max packet payload size in bytes */
73301edac3aSGal Pressman 	u32 mtu;
73401edac3aSGal Pressman };
73501edac3aSGal Pressman 
73601edac3aSGal Pressman /*
73701edac3aSGal Pressman  * When hint value is 0, hints capabilities are not supported or driver
73801edac3aSGal Pressman  * should use its own predefined value
73901edac3aSGal Pressman  */
74001edac3aSGal Pressman struct efa_admin_hw_hints {
74101edac3aSGal Pressman 	/* value in ms */
74201edac3aSGal Pressman 	u16 mmio_read_timeout;
74301edac3aSGal Pressman 
74401edac3aSGal Pressman 	/* value in ms */
74501edac3aSGal Pressman 	u16 driver_watchdog_timeout;
74601edac3aSGal Pressman 
74701edac3aSGal Pressman 	/* value in ms */
74801edac3aSGal Pressman 	u16 admin_completion_timeout;
74901edac3aSGal Pressman 
75001edac3aSGal Pressman 	/* poll interval in ms */
75101edac3aSGal Pressman 	u16 poll_interval;
75201edac3aSGal Pressman };
75301edac3aSGal Pressman 
75401edac3aSGal Pressman struct efa_admin_get_feature_cmd {
75501edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
75601edac3aSGal Pressman 
75701edac3aSGal Pressman 	struct efa_admin_ctrl_buff_info control_buffer;
75801edac3aSGal Pressman 
75901edac3aSGal Pressman 	struct efa_admin_get_set_feature_common_desc feature_common;
76001edac3aSGal Pressman 
76101edac3aSGal Pressman 	u32 raw[11];
76201edac3aSGal Pressman };
76301edac3aSGal Pressman 
76401edac3aSGal Pressman struct efa_admin_get_feature_resp {
76501edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
76601edac3aSGal Pressman 
76701edac3aSGal Pressman 	union {
76801edac3aSGal Pressman 		u32 raw[14];
76901edac3aSGal Pressman 
77001edac3aSGal Pressman 		struct efa_admin_feature_device_attr_desc device_attr;
77101edac3aSGal Pressman 
77201edac3aSGal Pressman 		struct efa_admin_feature_aenq_desc aenq;
77301edac3aSGal Pressman 
77401edac3aSGal Pressman 		struct efa_admin_feature_network_attr_desc network_attr;
77501edac3aSGal Pressman 
77601edac3aSGal Pressman 		struct efa_admin_feature_queue_attr_desc queue_attr;
77701edac3aSGal Pressman 
7782a152512SGal Pressman 		struct efa_admin_event_queue_attr_desc event_queue_attr;
7792a152512SGal Pressman 
78001edac3aSGal Pressman 		struct efa_admin_hw_hints hw_hints;
78101edac3aSGal Pressman 	} u;
78201edac3aSGal Pressman };
78301edac3aSGal Pressman 
78401edac3aSGal Pressman struct efa_admin_set_feature_cmd {
78501edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
78601edac3aSGal Pressman 
78701edac3aSGal Pressman 	struct efa_admin_ctrl_buff_info control_buffer;
78801edac3aSGal Pressman 
78901edac3aSGal Pressman 	struct efa_admin_get_set_feature_common_desc feature_common;
79001edac3aSGal Pressman 
79101edac3aSGal Pressman 	union {
79201edac3aSGal Pressman 		u32 raw[11];
79301edac3aSGal Pressman 
79401edac3aSGal Pressman 		/* AENQ configuration */
79501edac3aSGal Pressman 		struct efa_admin_feature_aenq_desc aenq;
79601edac3aSGal Pressman 	} u;
79701edac3aSGal Pressman };
79801edac3aSGal Pressman 
79901edac3aSGal Pressman struct efa_admin_set_feature_resp {
80001edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
80101edac3aSGal Pressman 
80201edac3aSGal Pressman 	union {
80301edac3aSGal Pressman 		u32 raw[14];
80401edac3aSGal Pressman 	} u;
80501edac3aSGal Pressman };
80601edac3aSGal Pressman 
80701edac3aSGal Pressman struct efa_admin_alloc_pd_cmd {
80801edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
80901edac3aSGal Pressman };
81001edac3aSGal Pressman 
81101edac3aSGal Pressman struct efa_admin_alloc_pd_resp {
81201edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
81301edac3aSGal Pressman 
81401edac3aSGal Pressman 	/* PD number */
81501edac3aSGal Pressman 	u16 pd;
81601edac3aSGal Pressman 
81701edac3aSGal Pressman 	/* MBZ */
81801edac3aSGal Pressman 	u16 reserved;
81901edac3aSGal Pressman };
82001edac3aSGal Pressman 
82101edac3aSGal Pressman struct efa_admin_dealloc_pd_cmd {
82201edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
82301edac3aSGal Pressman 
82401edac3aSGal Pressman 	/* PD number */
82501edac3aSGal Pressman 	u16 pd;
82601edac3aSGal Pressman 
82701edac3aSGal Pressman 	/* MBZ */
82801edac3aSGal Pressman 	u16 reserved;
82901edac3aSGal Pressman };
83001edac3aSGal Pressman 
83101edac3aSGal Pressman struct efa_admin_dealloc_pd_resp {
83201edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
83301edac3aSGal Pressman };
83401edac3aSGal Pressman 
83501edac3aSGal Pressman struct efa_admin_alloc_uar_cmd {
83601edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
83701edac3aSGal Pressman };
83801edac3aSGal Pressman 
83901edac3aSGal Pressman struct efa_admin_alloc_uar_resp {
84001edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
84101edac3aSGal Pressman 
84201edac3aSGal Pressman 	/* UAR number */
84301edac3aSGal Pressman 	u16 uar;
84401edac3aSGal Pressman 
84501edac3aSGal Pressman 	/* MBZ */
84601edac3aSGal Pressman 	u16 reserved;
84701edac3aSGal Pressman };
84801edac3aSGal Pressman 
84901edac3aSGal Pressman struct efa_admin_dealloc_uar_cmd {
85001edac3aSGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
85101edac3aSGal Pressman 
85201edac3aSGal Pressman 	/* UAR number */
85301edac3aSGal Pressman 	u16 uar;
85401edac3aSGal Pressman 
85501edac3aSGal Pressman 	/* MBZ */
85601edac3aSGal Pressman 	u16 reserved;
85701edac3aSGal Pressman };
85801edac3aSGal Pressman 
85901edac3aSGal Pressman struct efa_admin_dealloc_uar_resp {
86001edac3aSGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
86101edac3aSGal Pressman };
86201edac3aSGal Pressman 
8632a152512SGal Pressman struct efa_admin_create_eq_cmd {
8642a152512SGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
8652a152512SGal Pressman 
8662a152512SGal Pressman 	/* Size of the EQ in entries, must be power of 2 */
8672a152512SGal Pressman 	u16 depth;
8682a152512SGal Pressman 
8692a152512SGal Pressman 	/* MSI-X table entry index */
8702a152512SGal Pressman 	u8 msix_vec;
8712a152512SGal Pressman 
8722a152512SGal Pressman 	/*
8732a152512SGal Pressman 	 * 4:0 : entry_size_words - size of EQ entry in
8742a152512SGal Pressman 	 *    32-bit words
8752a152512SGal Pressman 	 * 7:5 : reserved - MBZ
8762a152512SGal Pressman 	 */
8772a152512SGal Pressman 	u8 caps;
8782a152512SGal Pressman 
8792a152512SGal Pressman 	/* EQ ring base address */
8802a152512SGal Pressman 	struct efa_common_mem_addr ba;
8812a152512SGal Pressman 
8822a152512SGal Pressman 	/*
8832a152512SGal Pressman 	 * Enabled events on this EQ
8842a152512SGal Pressman 	 * 0 : completion_events - Enable completion events
8852a152512SGal Pressman 	 * 31:1 : reserved - MBZ
8862a152512SGal Pressman 	 */
8872a152512SGal Pressman 	u32 event_bitmask;
8882a152512SGal Pressman 
8892a152512SGal Pressman 	/* MBZ */
8902a152512SGal Pressman 	u32 reserved;
8912a152512SGal Pressman };
8922a152512SGal Pressman 
8932a152512SGal Pressman struct efa_admin_create_eq_resp {
8942a152512SGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
8952a152512SGal Pressman 
8962a152512SGal Pressman 	/* EQ number */
8972a152512SGal Pressman 	u16 eqn;
8982a152512SGal Pressman 
8992a152512SGal Pressman 	/* MBZ */
9002a152512SGal Pressman 	u16 reserved;
9012a152512SGal Pressman };
9022a152512SGal Pressman 
9032a152512SGal Pressman struct efa_admin_destroy_eq_cmd {
9042a152512SGal Pressman 	struct efa_admin_aq_common_desc aq_common_descriptor;
9052a152512SGal Pressman 
9062a152512SGal Pressman 	/* EQ number */
9072a152512SGal Pressman 	u16 eqn;
9082a152512SGal Pressman 
9092a152512SGal Pressman 	/* MBZ */
9102a152512SGal Pressman 	u16 reserved;
9112a152512SGal Pressman };
9122a152512SGal Pressman 
9132a152512SGal Pressman struct efa_admin_destroy_eq_resp {
9142a152512SGal Pressman 	struct efa_admin_acq_common_desc acq_common_desc;
9152a152512SGal Pressman };
9162a152512SGal Pressman 
91701edac3aSGal Pressman /* asynchronous event notification groups */
91801edac3aSGal Pressman enum efa_admin_aenq_group {
91901edac3aSGal Pressman 	EFA_ADMIN_FATAL_ERROR                       = 1,
92001edac3aSGal Pressman 	EFA_ADMIN_WARNING                           = 2,
92101edac3aSGal Pressman 	EFA_ADMIN_NOTIFICATION                      = 3,
92201edac3aSGal Pressman 	EFA_ADMIN_KEEP_ALIVE                        = 4,
92301edac3aSGal Pressman 	EFA_ADMIN_AENQ_GROUPS_NUM                   = 5,
92401edac3aSGal Pressman };
92501edac3aSGal Pressman 
92601edac3aSGal Pressman struct efa_admin_mmio_req_read_less_resp {
92701edac3aSGal Pressman 	u16 req_id;
92801edac3aSGal Pressman 
92901edac3aSGal Pressman 	u16 reg_off;
93001edac3aSGal Pressman 
93101edac3aSGal Pressman 	/* value is valid when poll is cleared */
93201edac3aSGal Pressman 	u32 reg_val;
93301edac3aSGal Pressman };
93401edac3aSGal Pressman 
935e1ca01a9SGal Pressman enum efa_admin_os_type {
936e1ca01a9SGal Pressman 	EFA_ADMIN_OS_LINUX                          = 0,
937e1ca01a9SGal Pressman };
938e1ca01a9SGal Pressman 
939e1ca01a9SGal Pressman struct efa_admin_host_info {
940e1ca01a9SGal Pressman 	/* OS distribution string format */
941e1ca01a9SGal Pressman 	u8 os_dist_str[128];
942e1ca01a9SGal Pressman 
943e1ca01a9SGal Pressman 	/* Defined in enum efa_admin_os_type */
944e1ca01a9SGal Pressman 	u32 os_type;
945e1ca01a9SGal Pressman 
946e1ca01a9SGal Pressman 	/* Kernel version string format */
947e1ca01a9SGal Pressman 	u8 kernel_ver_str[32];
948e1ca01a9SGal Pressman 
949e1ca01a9SGal Pressman 	/* Kernel version numeric format */
950e1ca01a9SGal Pressman 	u32 kernel_ver;
951e1ca01a9SGal Pressman 
952e1ca01a9SGal Pressman 	/*
953e1ca01a9SGal Pressman 	 * 7:0 : driver_module_type
954e1ca01a9SGal Pressman 	 * 15:8 : driver_sub_minor
955e1ca01a9SGal Pressman 	 * 23:16 : driver_minor
956e1ca01a9SGal Pressman 	 * 31:24 : driver_major
957e1ca01a9SGal Pressman 	 */
958e1ca01a9SGal Pressman 	u32 driver_ver;
959e1ca01a9SGal Pressman 
960e1ca01a9SGal Pressman 	/*
961e1ca01a9SGal Pressman 	 * Device's Bus, Device and Function
962e1ca01a9SGal Pressman 	 * 2:0 : function
963e1ca01a9SGal Pressman 	 * 7:3 : device
964e1ca01a9SGal Pressman 	 * 15:8 : bus
965e1ca01a9SGal Pressman 	 */
966e1ca01a9SGal Pressman 	u16 bdf;
967e1ca01a9SGal Pressman 
968e1ca01a9SGal Pressman 	/*
969e1ca01a9SGal Pressman 	 * Spec version
970e1ca01a9SGal Pressman 	 * 7:0 : spec_minor
971e1ca01a9SGal Pressman 	 * 15:8 : spec_major
972e1ca01a9SGal Pressman 	 */
973e1ca01a9SGal Pressman 	u16 spec_ver;
974e1ca01a9SGal Pressman 
975e1ca01a9SGal Pressman 	/*
976e1ca01a9SGal Pressman 	 * 0 : intree - Intree driver
977e1ca01a9SGal Pressman 	 * 1 : gdr - GPUDirect RDMA supported
978e1ca01a9SGal Pressman 	 * 31:2 : reserved2
979e1ca01a9SGal Pressman 	 */
980e1ca01a9SGal Pressman 	u32 flags;
981e1ca01a9SGal Pressman };
982e1ca01a9SGal Pressman 
98301edac3aSGal Pressman /* create_qp_cmd */
98401edac3aSGal Pressman #define EFA_ADMIN_CREATE_QP_CMD_SQ_VIRT_MASK                BIT(0)
98501edac3aSGal Pressman #define EFA_ADMIN_CREATE_QP_CMD_RQ_VIRT_MASK                BIT(1)
98601edac3aSGal Pressman 
987ab67baddSGal Pressman /* modify_qp_cmd */
988ab67baddSGal Pressman #define EFA_ADMIN_MODIFY_QP_CMD_QP_STATE_MASK               BIT(0)
989ab67baddSGal Pressman #define EFA_ADMIN_MODIFY_QP_CMD_CUR_QP_STATE_MASK           BIT(1)
990ab67baddSGal Pressman #define EFA_ADMIN_MODIFY_QP_CMD_QKEY_MASK                   BIT(2)
991ab67baddSGal Pressman #define EFA_ADMIN_MODIFY_QP_CMD_SQ_PSN_MASK                 BIT(3)
992ab67baddSGal Pressman #define EFA_ADMIN_MODIFY_QP_CMD_SQ_DRAINED_ASYNC_NOTIFY_MASK BIT(4)
993a4e6a1ddSGal Pressman #define EFA_ADMIN_MODIFY_QP_CMD_RNR_RETRY_MASK              BIT(5)
994ab67baddSGal Pressman 
99501edac3aSGal Pressman /* reg_mr_cmd */
99601edac3aSGal Pressman #define EFA_ADMIN_REG_MR_CMD_PHYS_PAGE_SIZE_SHIFT_MASK      GENMASK(4, 0)
99701edac3aSGal Pressman #define EFA_ADMIN_REG_MR_CMD_MEM_ADDR_PHY_MODE_EN_MASK      BIT(7)
99801edac3aSGal Pressman #define EFA_ADMIN_REG_MR_CMD_LOCAL_WRITE_ENABLE_MASK        BIT(0)
999531094dcSYonatan Nachum #define EFA_ADMIN_REG_MR_CMD_REMOTE_WRITE_ENABLE_MASK       BIT(1)
1000e6c4f3ffSDaniel Kranzdorf #define EFA_ADMIN_REG_MR_CMD_REMOTE_READ_ENABLE_MASK        BIT(2)
100101edac3aSGal Pressman 
100201edac3aSGal Pressman /* create_cq_cmd */
100301edac3aSGal Pressman #define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
100401edac3aSGal Pressman #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
100501edac3aSGal Pressman #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
1006dc13fbf7SMichael Margolin #define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK           BIT(5)
100701edac3aSGal Pressman 
10082a152512SGal Pressman /* create_cq_resp */
10092a152512SGal Pressman #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK              BIT(0)
10102a152512SGal Pressman 
1011666e8ff5SDaniel Kranzdorf /* feature_device_attr_desc */
1012666e8ff5SDaniel Kranzdorf #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_READ_MASK   BIT(0)
1013a4e6a1ddSGal Pressman #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RNR_RETRY_MASK   BIT(1)
10146dddd939SYonatan Nachum #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_DATA_POLLING_128_MASK BIT(2)
1015531094dcSYonatan Nachum #define EFA_ADMIN_FEATURE_DEVICE_ATTR_DESC_RDMA_WRITE_MASK  BIT(3)
1016666e8ff5SDaniel Kranzdorf 
10172a152512SGal Pressman /* create_eq_cmd */
10182a152512SGal Pressman #define EFA_ADMIN_CREATE_EQ_CMD_ENTRY_SIZE_WORDS_MASK       GENMASK(4, 0)
10192a152512SGal Pressman #define EFA_ADMIN_CREATE_EQ_CMD_VIRT_MASK                   BIT(6)
10202a152512SGal Pressman #define EFA_ADMIN_CREATE_EQ_CMD_COMPLETION_EVENTS_MASK      BIT(0)
10212a152512SGal Pressman 
1022e1ca01a9SGal Pressman /* host_info */
1023e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_DRIVER_MODULE_TYPE_MASK         GENMASK(7, 0)
1024e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_DRIVER_SUB_MINOR_MASK           GENMASK(15, 8)
1025e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_DRIVER_MINOR_MASK               GENMASK(23, 16)
1026e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_DRIVER_MAJOR_MASK               GENMASK(31, 24)
1027e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_FUNCTION_MASK                   GENMASK(2, 0)
1028e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_DEVICE_MASK                     GENMASK(7, 3)
1029e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_BUS_MASK                        GENMASK(15, 8)
1030e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_SPEC_MINOR_MASK                 GENMASK(7, 0)
1031e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_SPEC_MAJOR_MASK                 GENMASK(15, 8)
1032e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_INTREE_MASK                     BIT(0)
1033e1ca01a9SGal Pressman #define EFA_ADMIN_HOST_INFO_GDR_MASK                        BIT(1)
1034e1ca01a9SGal Pressman 
103501edac3aSGal Pressman #endif /* _EFA_ADMIN_CMDS_H_ */
1036