162306a36Sopenharmony_ci/* QLogic qedr NIC Driver
262306a36Sopenharmony_ci * Copyright (c) 2015-2016  QLogic Corporation
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * This software is available to you under a choice of one of two
562306a36Sopenharmony_ci * licenses.  You may choose to be licensed under the terms of the GNU
662306a36Sopenharmony_ci * General Public License (GPL) Version 2, available from the file
762306a36Sopenharmony_ci * COPYING in the main directory of this source tree, or the
862306a36Sopenharmony_ci * OpenIB.org BSD license below:
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci *     Redistribution and use in source and binary forms, with or
1162306a36Sopenharmony_ci *     without modification, are permitted provided that the following
1262306a36Sopenharmony_ci *     conditions are met:
1362306a36Sopenharmony_ci *
1462306a36Sopenharmony_ci *      - Redistributions of source code must retain the above
1562306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
1662306a36Sopenharmony_ci *        disclaimer.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci *      - Redistributions in binary form must reproduce the above
1962306a36Sopenharmony_ci *        copyright notice, this list of conditions and the following
2062306a36Sopenharmony_ci *        disclaimer in the documentation and /or other materials
2162306a36Sopenharmony_ci *        provided with the distribution.
2262306a36Sopenharmony_ci *
2362306a36Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2462306a36Sopenharmony_ci * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2562306a36Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
2662306a36Sopenharmony_ci * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
2762306a36Sopenharmony_ci * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
2862306a36Sopenharmony_ci * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
2962306a36Sopenharmony_ci * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3062306a36Sopenharmony_ci * SOFTWARE.
3162306a36Sopenharmony_ci */
3262306a36Sopenharmony_ci#ifndef __QED_HSI_RDMA__
3362306a36Sopenharmony_ci#define __QED_HSI_RDMA__
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#include <linux/qed/rdma_common.h>
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* rdma completion notification queue element */
3862306a36Sopenharmony_cistruct rdma_cnqe {
3962306a36Sopenharmony_ci	struct regpair	cq_handle;
4062306a36Sopenharmony_ci};
4162306a36Sopenharmony_ci
4262306a36Sopenharmony_cistruct rdma_cqe_responder {
4362306a36Sopenharmony_ci	struct regpair srq_wr_id;
4462306a36Sopenharmony_ci	struct regpair qp_handle;
4562306a36Sopenharmony_ci	__le32 imm_data_or_inv_r_Key;
4662306a36Sopenharmony_ci	__le32 length;
4762306a36Sopenharmony_ci	__le32 imm_data_hi;
4862306a36Sopenharmony_ci	__le16 rq_cons_or_srq_id;
4962306a36Sopenharmony_ci	u8 flags;
5062306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_TOGGLE_BIT_MASK  0x1
5162306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_TOGGLE_BIT_SHIFT 0
5262306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_TYPE_MASK        0x3
5362306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_TYPE_SHIFT       1
5462306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_INV_FLG_MASK     0x1
5562306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_INV_FLG_SHIFT    3
5662306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_IMM_FLG_MASK     0x1
5762306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_IMM_FLG_SHIFT    4
5862306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_RDMA_FLG_MASK    0x1
5962306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_RDMA_FLG_SHIFT   5
6062306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_RESERVED2_MASK   0x3
6162306a36Sopenharmony_ci#define RDMA_CQE_RESPONDER_RESERVED2_SHIFT  6
6262306a36Sopenharmony_ci	u8 status;
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_cistruct rdma_cqe_requester {
6662306a36Sopenharmony_ci	__le16 sq_cons;
6762306a36Sopenharmony_ci	__le16 reserved0;
6862306a36Sopenharmony_ci	__le32 reserved1;
6962306a36Sopenharmony_ci	struct regpair qp_handle;
7062306a36Sopenharmony_ci	struct regpair reserved2;
7162306a36Sopenharmony_ci	__le32 reserved3;
7262306a36Sopenharmony_ci	__le16 reserved4;
7362306a36Sopenharmony_ci	u8 flags;
7462306a36Sopenharmony_ci#define RDMA_CQE_REQUESTER_TOGGLE_BIT_MASK  0x1
7562306a36Sopenharmony_ci#define RDMA_CQE_REQUESTER_TOGGLE_BIT_SHIFT 0
7662306a36Sopenharmony_ci#define RDMA_CQE_REQUESTER_TYPE_MASK        0x3
7762306a36Sopenharmony_ci#define RDMA_CQE_REQUESTER_TYPE_SHIFT       1
7862306a36Sopenharmony_ci#define RDMA_CQE_REQUESTER_RESERVED5_MASK   0x1F
7962306a36Sopenharmony_ci#define RDMA_CQE_REQUESTER_RESERVED5_SHIFT  3
8062306a36Sopenharmony_ci	u8 status;
8162306a36Sopenharmony_ci};
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_cistruct rdma_cqe_common {
8462306a36Sopenharmony_ci	struct regpair reserved0;
8562306a36Sopenharmony_ci	struct regpair qp_handle;
8662306a36Sopenharmony_ci	__le16 reserved1[7];
8762306a36Sopenharmony_ci	u8 flags;
8862306a36Sopenharmony_ci#define RDMA_CQE_COMMON_TOGGLE_BIT_MASK  0x1
8962306a36Sopenharmony_ci#define RDMA_CQE_COMMON_TOGGLE_BIT_SHIFT 0
9062306a36Sopenharmony_ci#define RDMA_CQE_COMMON_TYPE_MASK        0x3
9162306a36Sopenharmony_ci#define RDMA_CQE_COMMON_TYPE_SHIFT       1
9262306a36Sopenharmony_ci#define RDMA_CQE_COMMON_RESERVED2_MASK   0x1F
9362306a36Sopenharmony_ci#define RDMA_CQE_COMMON_RESERVED2_SHIFT  3
9462306a36Sopenharmony_ci	u8 status;
9562306a36Sopenharmony_ci};
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci/* rdma completion queue element */
9862306a36Sopenharmony_ciunion rdma_cqe {
9962306a36Sopenharmony_ci	struct rdma_cqe_responder resp;
10062306a36Sopenharmony_ci	struct rdma_cqe_requester req;
10162306a36Sopenharmony_ci	struct rdma_cqe_common cmn;
10262306a36Sopenharmony_ci};
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/* * CQE requester status enumeration */
10562306a36Sopenharmony_cienum rdma_cqe_requester_status_enum {
10662306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_OK,
10762306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_BAD_RESPONSE_ERR,
10862306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_LOCAL_LENGTH_ERR,
10962306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_LOCAL_QP_OPERATION_ERR,
11062306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_LOCAL_PROTECTION_ERR,
11162306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_MEMORY_MGT_OPERATION_ERR,
11262306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_REMOTE_INVALID_REQUEST_ERR,
11362306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_REMOTE_ACCESS_ERR,
11462306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_REMOTE_OPERATION_ERR,
11562306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_RNR_NAK_RETRY_CNT_ERR,
11662306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_TRANSPORT_RETRY_CNT_ERR,
11762306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_WORK_REQUEST_FLUSHED_ERR,
11862306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_XRC_VOILATION_ERR,
11962306a36Sopenharmony_ci	RDMA_CQE_REQ_STS_SIG_ERR,
12062306a36Sopenharmony_ci	MAX_RDMA_CQE_REQUESTER_STATUS_ENUM
12162306a36Sopenharmony_ci};
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ci/* CQE responder status enumeration */
12462306a36Sopenharmony_cienum rdma_cqe_responder_status_enum {
12562306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_OK,
12662306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_LOCAL_ACCESS_ERR,
12762306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_LOCAL_LENGTH_ERR,
12862306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_LOCAL_QP_OPERATION_ERR,
12962306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_LOCAL_PROTECTION_ERR,
13062306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_MEMORY_MGT_OPERATION_ERR,
13162306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_REMOTE_INVALID_REQUEST_ERR,
13262306a36Sopenharmony_ci	RDMA_CQE_RESP_STS_WORK_REQUEST_FLUSHED_ERR,
13362306a36Sopenharmony_ci	MAX_RDMA_CQE_RESPONDER_STATUS_ENUM
13462306a36Sopenharmony_ci};
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* CQE type enumeration */
13762306a36Sopenharmony_cienum rdma_cqe_type {
13862306a36Sopenharmony_ci	RDMA_CQE_TYPE_REQUESTER,
13962306a36Sopenharmony_ci	RDMA_CQE_TYPE_RESPONDER_RQ,
14062306a36Sopenharmony_ci	RDMA_CQE_TYPE_RESPONDER_SRQ,
14162306a36Sopenharmony_ci	RDMA_CQE_TYPE_RESPONDER_XRC_SRQ,
14262306a36Sopenharmony_ci	RDMA_CQE_TYPE_INVALID,
14362306a36Sopenharmony_ci	MAX_RDMA_CQE_TYPE
14462306a36Sopenharmony_ci};
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_cistruct rdma_sq_sge {
14762306a36Sopenharmony_ci	__le32 length;
14862306a36Sopenharmony_ci	struct regpair	addr;
14962306a36Sopenharmony_ci	__le32 l_key;
15062306a36Sopenharmony_ci};
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_cistruct rdma_rq_sge {
15362306a36Sopenharmony_ci	struct regpair addr;
15462306a36Sopenharmony_ci	__le32 length;
15562306a36Sopenharmony_ci	__le32 flags;
15662306a36Sopenharmony_ci#define RDMA_RQ_SGE_L_KEY_LO_MASK   0x3FFFFFF
15762306a36Sopenharmony_ci#define RDMA_RQ_SGE_L_KEY_LO_SHIFT  0
15862306a36Sopenharmony_ci#define RDMA_RQ_SGE_NUM_SGES_MASK   0x7
15962306a36Sopenharmony_ci#define RDMA_RQ_SGE_NUM_SGES_SHIFT  26
16062306a36Sopenharmony_ci#define RDMA_RQ_SGE_L_KEY_HI_MASK   0x7
16162306a36Sopenharmony_ci#define RDMA_RQ_SGE_L_KEY_HI_SHIFT  29
16262306a36Sopenharmony_ci};
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_cistruct rdma_srq_wqe_header {
16562306a36Sopenharmony_ci	struct regpair wr_id;
16662306a36Sopenharmony_ci	u8 num_sges /* number of SGEs in WQE */;
16762306a36Sopenharmony_ci	u8 reserved2[7];
16862306a36Sopenharmony_ci};
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_cistruct rdma_srq_sge {
17162306a36Sopenharmony_ci	struct regpair addr;
17262306a36Sopenharmony_ci	__le32 length;
17362306a36Sopenharmony_ci	__le32 l_key;
17462306a36Sopenharmony_ci};
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_ciunion rdma_srq_elm {
17762306a36Sopenharmony_ci	struct rdma_srq_wqe_header header;
17862306a36Sopenharmony_ci	struct rdma_srq_sge sge;
17962306a36Sopenharmony_ci};
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci/* Rdma doorbell data for flags update */
18262306a36Sopenharmony_cistruct rdma_pwm_flags_data {
18362306a36Sopenharmony_ci	__le16 icid; /* internal CID */
18462306a36Sopenharmony_ci	u8 agg_flags; /* aggregative flags */
18562306a36Sopenharmony_ci	u8 reserved;
18662306a36Sopenharmony_ci};
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci/* Rdma doorbell data for SQ and RQ */
18962306a36Sopenharmony_cistruct rdma_pwm_val16_data {
19062306a36Sopenharmony_ci	__le16 icid;
19162306a36Sopenharmony_ci	__le16 value;
19262306a36Sopenharmony_ci};
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ciunion rdma_pwm_val16_data_union {
19562306a36Sopenharmony_ci	struct rdma_pwm_val16_data as_struct;
19662306a36Sopenharmony_ci	__le32 as_dword;
19762306a36Sopenharmony_ci};
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci/* Rdma doorbell data for CQ */
20062306a36Sopenharmony_cistruct rdma_pwm_val32_data {
20162306a36Sopenharmony_ci	__le16 icid;
20262306a36Sopenharmony_ci	u8 agg_flags;
20362306a36Sopenharmony_ci	u8 params;
20462306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_AGG_CMD_MASK		0x3
20562306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_AGG_CMD_SHIFT		0
20662306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_BYPASS_EN_MASK		0x1
20762306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_BYPASS_EN_SHIFT		2
20862306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_CONN_TYPE_IS_IWARP_MASK	0x1
20962306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_CONN_TYPE_IS_IWARP_SHIFT	3
21062306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_SET_16B_VAL_MASK		0x1
21162306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_SET_16B_VAL_SHIFT		4
21262306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_RESERVED_MASK		0x7
21362306a36Sopenharmony_ci#define RDMA_PWM_VAL32_DATA_RESERVED_SHIFT		5
21462306a36Sopenharmony_ci	__le32 value;
21562306a36Sopenharmony_ci};
21662306a36Sopenharmony_ci
21762306a36Sopenharmony_ci/* DIF Block size options */
21862306a36Sopenharmony_cienum rdma_dif_block_size {
21962306a36Sopenharmony_ci	RDMA_DIF_BLOCK_512 = 0,
22062306a36Sopenharmony_ci	RDMA_DIF_BLOCK_4096 = 1,
22162306a36Sopenharmony_ci	MAX_RDMA_DIF_BLOCK_SIZE
22262306a36Sopenharmony_ci};
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_ci/* DIF CRC initial value */
22562306a36Sopenharmony_cienum rdma_dif_crc_seed {
22662306a36Sopenharmony_ci	RDMA_DIF_CRC_SEED_0000 = 0,
22762306a36Sopenharmony_ci	RDMA_DIF_CRC_SEED_FFFF = 1,
22862306a36Sopenharmony_ci	MAX_RDMA_DIF_CRC_SEED
22962306a36Sopenharmony_ci};
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci/* RDMA DIF Error Result Structure */
23262306a36Sopenharmony_cistruct rdma_dif_error_result {
23362306a36Sopenharmony_ci	__le32 error_intervals;
23462306a36Sopenharmony_ci	__le32 dif_error_1st_interval;
23562306a36Sopenharmony_ci	u8 flags;
23662306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_CRC_MASK      0x1
23762306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_CRC_SHIFT     0
23862306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_APP_TAG_MASK  0x1
23962306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_APP_TAG_SHIFT 1
24062306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_REF_TAG_MASK  0x1
24162306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_REF_TAG_SHIFT 2
24262306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_RESERVED0_MASK               0xF
24362306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_RESERVED0_SHIFT              3
24462306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_TOGGLE_BIT_MASK              0x1
24562306a36Sopenharmony_ci#define RDMA_DIF_ERROR_RESULT_TOGGLE_BIT_SHIFT             7
24662306a36Sopenharmony_ci	u8 reserved1[55];
24762306a36Sopenharmony_ci};
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci/* DIF IO direction */
25062306a36Sopenharmony_cienum rdma_dif_io_direction_flg {
25162306a36Sopenharmony_ci	RDMA_DIF_DIR_RX = 0,
25262306a36Sopenharmony_ci	RDMA_DIF_DIR_TX = 1,
25362306a36Sopenharmony_ci	MAX_RDMA_DIF_IO_DIRECTION_FLG
25462306a36Sopenharmony_ci};
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_cistruct rdma_dif_params {
25762306a36Sopenharmony_ci	__le32 base_ref_tag;
25862306a36Sopenharmony_ci	__le16 app_tag;
25962306a36Sopenharmony_ci	__le16 app_tag_mask;
26062306a36Sopenharmony_ci	__le16 runt_crc_value;
26162306a36Sopenharmony_ci	__le16 flags;
26262306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_IO_DIRECTION_FLG_MASK    0x1
26362306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_IO_DIRECTION_FLG_SHIFT   0
26462306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_BLOCK_SIZE_MASK          0x1
26562306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_BLOCK_SIZE_SHIFT         1
26662306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_RUNT_VALID_FLG_MASK      0x1
26762306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_RUNT_VALID_FLG_SHIFT     2
26862306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_VALIDATE_CRC_GUARD_MASK  0x1
26962306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_VALIDATE_CRC_GUARD_SHIFT 3
27062306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_VALIDATE_REF_TAG_MASK    0x1
27162306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_VALIDATE_REF_TAG_SHIFT   4
27262306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_VALIDATE_APP_TAG_MASK    0x1
27362306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_VALIDATE_APP_TAG_SHIFT   5
27462306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_CRC_SEED_MASK            0x1
27562306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_CRC_SEED_SHIFT           6
27662306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_RX_REF_TAG_CONST_MASK    0x1
27762306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_RX_REF_TAG_CONST_SHIFT   7
27862306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_BLOCK_GUARD_TYPE_MASK    0x1
27962306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_BLOCK_GUARD_TYPE_SHIFT   8
28062306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_APP_ESCAPE_MASK          0x1
28162306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_APP_ESCAPE_SHIFT         9
28262306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_REF_ESCAPE_MASK          0x1
28362306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_REF_ESCAPE_SHIFT         10
28462306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_RESERVED4_MASK           0x1F
28562306a36Sopenharmony_ci#define RDMA_DIF_PARAMS_RESERVED4_SHIFT          11
28662306a36Sopenharmony_ci	__le32 reserved5;
28762306a36Sopenharmony_ci};
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_cistruct rdma_sq_atomic_wqe {
29162306a36Sopenharmony_ci	__le32 reserved1;
29262306a36Sopenharmony_ci	__le32 length;
29362306a36Sopenharmony_ci	__le32 xrc_srq;
29462306a36Sopenharmony_ci	u8 req_type;
29562306a36Sopenharmony_ci	u8 flags;
29662306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_COMP_FLG_MASK         0x1
29762306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_COMP_FLG_SHIFT        0
29862306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_RD_FENCE_FLG_MASK     0x1
29962306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_RD_FENCE_FLG_SHIFT    1
30062306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_INV_FENCE_FLG_MASK    0x1
30162306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_INV_FENCE_FLG_SHIFT   2
30262306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_SE_FLG_MASK           0x1
30362306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_SE_FLG_SHIFT          3
30462306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_INLINE_FLG_MASK       0x1
30562306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_INLINE_FLG_SHIFT      4
30662306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_DIF_ON_HOST_FLG_MASK  0x1
30762306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_DIF_ON_HOST_FLG_SHIFT 5
30862306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_RESERVED0_MASK        0x3
30962306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_RESERVED0_SHIFT       6
31062306a36Sopenharmony_ci	u8 wqe_size;
31162306a36Sopenharmony_ci	u8 prev_wqe_size;
31262306a36Sopenharmony_ci	struct regpair remote_va;
31362306a36Sopenharmony_ci	__le32 r_key;
31462306a36Sopenharmony_ci	__le32 reserved2;
31562306a36Sopenharmony_ci	struct regpair cmp_data;
31662306a36Sopenharmony_ci	struct regpair swap_data;
31762306a36Sopenharmony_ci};
31862306a36Sopenharmony_ci
31962306a36Sopenharmony_ci/* First element (16 bytes) of atomic wqe */
32062306a36Sopenharmony_cistruct rdma_sq_atomic_wqe_1st {
32162306a36Sopenharmony_ci	__le32 reserved1;
32262306a36Sopenharmony_ci	__le32 length;
32362306a36Sopenharmony_ci	__le32 xrc_srq;
32462306a36Sopenharmony_ci	u8 req_type;
32562306a36Sopenharmony_ci	u8 flags;
32662306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_COMP_FLG_MASK       0x1
32762306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_COMP_FLG_SHIFT      0
32862306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_RD_FENCE_FLG_MASK   0x1
32962306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_RD_FENCE_FLG_SHIFT  1
33062306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_INV_FENCE_FLG_MASK  0x1
33162306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_INV_FENCE_FLG_SHIFT 2
33262306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_SE_FLG_MASK         0x1
33362306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_SE_FLG_SHIFT        3
33462306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_INLINE_FLG_MASK     0x1
33562306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_INLINE_FLG_SHIFT    4
33662306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_RESERVED0_MASK      0x7
33762306a36Sopenharmony_ci#define RDMA_SQ_ATOMIC_WQE_1ST_RESERVED0_SHIFT     5
33862306a36Sopenharmony_ci	u8 wqe_size;
33962306a36Sopenharmony_ci	u8 prev_wqe_size;
34062306a36Sopenharmony_ci};
34162306a36Sopenharmony_ci
34262306a36Sopenharmony_ci/* Second element (16 bytes) of atomic wqe */
34362306a36Sopenharmony_cistruct rdma_sq_atomic_wqe_2nd {
34462306a36Sopenharmony_ci	struct regpair remote_va;
34562306a36Sopenharmony_ci	__le32 r_key;
34662306a36Sopenharmony_ci	__le32 reserved2;
34762306a36Sopenharmony_ci};
34862306a36Sopenharmony_ci
34962306a36Sopenharmony_ci/* Third element (16 bytes) of atomic wqe */
35062306a36Sopenharmony_cistruct rdma_sq_atomic_wqe_3rd {
35162306a36Sopenharmony_ci	struct regpair cmp_data;
35262306a36Sopenharmony_ci	struct regpair swap_data;
35362306a36Sopenharmony_ci};
35462306a36Sopenharmony_ci
35562306a36Sopenharmony_cistruct rdma_sq_bind_wqe {
35662306a36Sopenharmony_ci	struct regpair addr;
35762306a36Sopenharmony_ci	__le32 l_key;
35862306a36Sopenharmony_ci	u8 req_type;
35962306a36Sopenharmony_ci	u8 flags;
36062306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_COMP_FLG_MASK       0x1
36162306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_COMP_FLG_SHIFT      0
36262306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RD_FENCE_FLG_MASK   0x1
36362306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RD_FENCE_FLG_SHIFT  1
36462306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_INV_FENCE_FLG_MASK  0x1
36562306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_INV_FENCE_FLG_SHIFT 2
36662306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_SE_FLG_MASK         0x1
36762306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_SE_FLG_SHIFT        3
36862306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_INLINE_FLG_MASK     0x1
36962306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_INLINE_FLG_SHIFT    4
37062306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_DIF_ON_HOST_FLG_MASK  0x1
37162306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_DIF_ON_HOST_FLG_SHIFT 5
37262306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RESERVED0_MASK      0x3
37362306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RESERVED0_SHIFT     6
37462306a36Sopenharmony_ci	u8 wqe_size;
37562306a36Sopenharmony_ci	u8 prev_wqe_size;
37662306a36Sopenharmony_ci	u8 bind_ctrl;
37762306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_ZERO_BASED_MASK     0x1
37862306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_ZERO_BASED_SHIFT    0
37962306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RESERVED1_MASK        0x7F
38062306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RESERVED1_SHIFT       1
38162306a36Sopenharmony_ci	u8 access_ctrl;
38262306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_REMOTE_READ_MASK    0x1
38362306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_REMOTE_READ_SHIFT   0
38462306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_REMOTE_WRITE_MASK   0x1
38562306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_REMOTE_WRITE_SHIFT  1
38662306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_ENABLE_ATOMIC_MASK  0x1
38762306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_ENABLE_ATOMIC_SHIFT 2
38862306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_LOCAL_READ_MASK     0x1
38962306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_LOCAL_READ_SHIFT    3
39062306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_LOCAL_WRITE_MASK    0x1
39162306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_LOCAL_WRITE_SHIFT   4
39262306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RESERVED2_MASK      0x7
39362306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_RESERVED2_SHIFT     5
39462306a36Sopenharmony_ci	u8 reserved3;
39562306a36Sopenharmony_ci	u8 length_hi;
39662306a36Sopenharmony_ci	__le32 length_lo;
39762306a36Sopenharmony_ci	__le32 parent_l_key;
39862306a36Sopenharmony_ci	__le32 reserved4;
39962306a36Sopenharmony_ci	struct rdma_dif_params dif_params;
40062306a36Sopenharmony_ci};
40162306a36Sopenharmony_ci
40262306a36Sopenharmony_ci/* First element (16 bytes) of bind wqe */
40362306a36Sopenharmony_cistruct rdma_sq_bind_wqe_1st {
40462306a36Sopenharmony_ci	struct regpair addr;
40562306a36Sopenharmony_ci	__le32 l_key;
40662306a36Sopenharmony_ci	u8 req_type;
40762306a36Sopenharmony_ci	u8 flags;
40862306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_COMP_FLG_MASK       0x1
40962306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_COMP_FLG_SHIFT      0
41062306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_RD_FENCE_FLG_MASK   0x1
41162306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_RD_FENCE_FLG_SHIFT  1
41262306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_INV_FENCE_FLG_MASK  0x1
41362306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_INV_FENCE_FLG_SHIFT 2
41462306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_SE_FLG_MASK         0x1
41562306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_SE_FLG_SHIFT        3
41662306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_INLINE_FLG_MASK     0x1
41762306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_INLINE_FLG_SHIFT    4
41862306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_RESERVED0_MASK      0x7
41962306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_1ST_RESERVED0_SHIFT     5
42062306a36Sopenharmony_ci	u8 wqe_size;
42162306a36Sopenharmony_ci	u8 prev_wqe_size;
42262306a36Sopenharmony_ci};
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/* Second element (16 bytes) of bind wqe */
42562306a36Sopenharmony_cistruct rdma_sq_bind_wqe_2nd {
42662306a36Sopenharmony_ci	u8 bind_ctrl;
42762306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_ZERO_BASED_MASK     0x1
42862306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_ZERO_BASED_SHIFT    0
42962306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_RESERVED1_MASK      0x7F
43062306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_RESERVED1_SHIFT     1
43162306a36Sopenharmony_ci	u8 access_ctrl;
43262306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_REMOTE_READ_MASK    0x1
43362306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_REMOTE_READ_SHIFT   0
43462306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_REMOTE_WRITE_MASK   0x1
43562306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_REMOTE_WRITE_SHIFT  1
43662306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_ENABLE_ATOMIC_MASK  0x1
43762306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_ENABLE_ATOMIC_SHIFT 2
43862306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_LOCAL_READ_MASK     0x1
43962306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_LOCAL_READ_SHIFT    3
44062306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_LOCAL_WRITE_MASK    0x1
44162306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_LOCAL_WRITE_SHIFT   4
44262306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_RESERVED2_MASK      0x7
44362306a36Sopenharmony_ci#define RDMA_SQ_BIND_WQE_2ND_RESERVED2_SHIFT     5
44462306a36Sopenharmony_ci	u8 reserved3;
44562306a36Sopenharmony_ci	u8 length_hi;
44662306a36Sopenharmony_ci	__le32 length_lo;
44762306a36Sopenharmony_ci	__le32 parent_l_key;
44862306a36Sopenharmony_ci	__le32 reserved4;
44962306a36Sopenharmony_ci};
45062306a36Sopenharmony_ci
45162306a36Sopenharmony_ci/* Third element (16 bytes) of bind wqe */
45262306a36Sopenharmony_cistruct rdma_sq_bind_wqe_3rd {
45362306a36Sopenharmony_ci	struct rdma_dif_params dif_params;
45462306a36Sopenharmony_ci};
45562306a36Sopenharmony_ci
45662306a36Sopenharmony_ci/* Structure with only the SQ WQE common
45762306a36Sopenharmony_ci * fields. Size is of one SQ element (16B)
45862306a36Sopenharmony_ci */
45962306a36Sopenharmony_cistruct rdma_sq_common_wqe {
46062306a36Sopenharmony_ci	__le32 reserved1[3];
46162306a36Sopenharmony_ci	u8 req_type;
46262306a36Sopenharmony_ci	u8 flags;
46362306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_COMP_FLG_MASK       0x1
46462306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_COMP_FLG_SHIFT      0
46562306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_RD_FENCE_FLG_MASK   0x1
46662306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_RD_FENCE_FLG_SHIFT  1
46762306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_INV_FENCE_FLG_MASK  0x1
46862306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_INV_FENCE_FLG_SHIFT 2
46962306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_SE_FLG_MASK         0x1
47062306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_SE_FLG_SHIFT        3
47162306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_INLINE_FLG_MASK     0x1
47262306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_INLINE_FLG_SHIFT    4
47362306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_RESERVED0_MASK      0x7
47462306a36Sopenharmony_ci#define RDMA_SQ_COMMON_WQE_RESERVED0_SHIFT     5
47562306a36Sopenharmony_ci	u8 wqe_size;
47662306a36Sopenharmony_ci	u8 prev_wqe_size;
47762306a36Sopenharmony_ci};
47862306a36Sopenharmony_ci
47962306a36Sopenharmony_cistruct rdma_sq_fmr_wqe {
48062306a36Sopenharmony_ci	struct regpair addr;
48162306a36Sopenharmony_ci	__le32 l_key;
48262306a36Sopenharmony_ci	u8 req_type;
48362306a36Sopenharmony_ci	u8 flags;
48462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_COMP_FLG_MASK                0x1
48562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_COMP_FLG_SHIFT               0
48662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RD_FENCE_FLG_MASK            0x1
48762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RD_FENCE_FLG_SHIFT           1
48862306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_INV_FENCE_FLG_MASK           0x1
48962306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_INV_FENCE_FLG_SHIFT          2
49062306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_SE_FLG_MASK                  0x1
49162306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_SE_FLG_SHIFT                 3
49262306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_INLINE_FLG_MASK              0x1
49362306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_INLINE_FLG_SHIFT             4
49462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_DIF_ON_HOST_FLG_MASK         0x1
49562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_DIF_ON_HOST_FLG_SHIFT        5
49662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RESERVED0_MASK               0x3
49762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RESERVED0_SHIFT              6
49862306a36Sopenharmony_ci	u8 wqe_size;
49962306a36Sopenharmony_ci	u8 prev_wqe_size;
50062306a36Sopenharmony_ci	u8 fmr_ctrl;
50162306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_PAGE_SIZE_LOG_MASK           0x1F
50262306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_PAGE_SIZE_LOG_SHIFT          0
50362306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_ZERO_BASED_MASK              0x1
50462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_ZERO_BASED_SHIFT             5
50562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_BIND_EN_MASK                 0x1
50662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_BIND_EN_SHIFT                6
50762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RESERVED1_MASK               0x1
50862306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RESERVED1_SHIFT              7
50962306a36Sopenharmony_ci	u8 access_ctrl;
51062306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_REMOTE_READ_MASK             0x1
51162306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_REMOTE_READ_SHIFT            0
51262306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_REMOTE_WRITE_MASK            0x1
51362306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_REMOTE_WRITE_SHIFT           1
51462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_ENABLE_ATOMIC_MASK           0x1
51562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_ENABLE_ATOMIC_SHIFT          2
51662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_LOCAL_READ_MASK              0x1
51762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_LOCAL_READ_SHIFT             3
51862306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_LOCAL_WRITE_MASK             0x1
51962306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_LOCAL_WRITE_SHIFT            4
52062306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RESERVED2_MASK               0x7
52162306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_RESERVED2_SHIFT              5
52262306a36Sopenharmony_ci	u8 reserved3;
52362306a36Sopenharmony_ci	u8 length_hi;
52462306a36Sopenharmony_ci	__le32 length_lo;
52562306a36Sopenharmony_ci	struct regpair pbl_addr;
52662306a36Sopenharmony_ci};
52762306a36Sopenharmony_ci
52862306a36Sopenharmony_ci/* First element (16 bytes) of fmr wqe */
52962306a36Sopenharmony_cistruct rdma_sq_fmr_wqe_1st {
53062306a36Sopenharmony_ci	struct regpair addr;
53162306a36Sopenharmony_ci	__le32 l_key;
53262306a36Sopenharmony_ci	u8 req_type;
53362306a36Sopenharmony_ci	u8 flags;
53462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_COMP_FLG_MASK         0x1
53562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_COMP_FLG_SHIFT        0
53662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_RD_FENCE_FLG_MASK     0x1
53762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_RD_FENCE_FLG_SHIFT    1
53862306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_INV_FENCE_FLG_MASK    0x1
53962306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_INV_FENCE_FLG_SHIFT   2
54062306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_SE_FLG_MASK           0x1
54162306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_SE_FLG_SHIFT          3
54262306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_INLINE_FLG_MASK       0x1
54362306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_INLINE_FLG_SHIFT      4
54462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_DIF_ON_HOST_FLG_MASK  0x1
54562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_DIF_ON_HOST_FLG_SHIFT 5
54662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_RESERVED0_MASK        0x3
54762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_1ST_RESERVED0_SHIFT       6
54862306a36Sopenharmony_ci	u8 wqe_size;
54962306a36Sopenharmony_ci	u8 prev_wqe_size;
55062306a36Sopenharmony_ci};
55162306a36Sopenharmony_ci
55262306a36Sopenharmony_ci/* Second element (16 bytes) of fmr wqe */
55362306a36Sopenharmony_cistruct rdma_sq_fmr_wqe_2nd {
55462306a36Sopenharmony_ci	u8 fmr_ctrl;
55562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_PAGE_SIZE_LOG_MASK  0x1F
55662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_PAGE_SIZE_LOG_SHIFT 0
55762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_ZERO_BASED_MASK     0x1
55862306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_ZERO_BASED_SHIFT    5
55962306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_BIND_EN_MASK        0x1
56062306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_BIND_EN_SHIFT       6
56162306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_RESERVED1_MASK      0x1
56262306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_RESERVED1_SHIFT     7
56362306a36Sopenharmony_ci	u8 access_ctrl;
56462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_REMOTE_READ_MASK    0x1
56562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_REMOTE_READ_SHIFT   0
56662306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_REMOTE_WRITE_MASK   0x1
56762306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_REMOTE_WRITE_SHIFT  1
56862306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_ENABLE_ATOMIC_MASK  0x1
56962306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_ENABLE_ATOMIC_SHIFT 2
57062306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_LOCAL_READ_MASK     0x1
57162306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_LOCAL_READ_SHIFT    3
57262306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_LOCAL_WRITE_MASK    0x1
57362306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_LOCAL_WRITE_SHIFT   4
57462306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_RESERVED2_MASK      0x7
57562306a36Sopenharmony_ci#define RDMA_SQ_FMR_WQE_2ND_RESERVED2_SHIFT     5
57662306a36Sopenharmony_ci	u8 reserved3;
57762306a36Sopenharmony_ci	u8 length_hi;
57862306a36Sopenharmony_ci	__le32 length_lo;
57962306a36Sopenharmony_ci	struct regpair pbl_addr;
58062306a36Sopenharmony_ci};
58162306a36Sopenharmony_ci
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_cistruct rdma_sq_local_inv_wqe {
58462306a36Sopenharmony_ci	struct regpair reserved;
58562306a36Sopenharmony_ci	__le32 inv_l_key;
58662306a36Sopenharmony_ci	u8 req_type;
58762306a36Sopenharmony_ci	u8 flags;
58862306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_COMP_FLG_MASK         0x1
58962306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_COMP_FLG_SHIFT        0
59062306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_RD_FENCE_FLG_MASK     0x1
59162306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_RD_FENCE_FLG_SHIFT    1
59262306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_INV_FENCE_FLG_MASK    0x1
59362306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_INV_FENCE_FLG_SHIFT   2
59462306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_SE_FLG_MASK           0x1
59562306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_SE_FLG_SHIFT          3
59662306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_INLINE_FLG_MASK       0x1
59762306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_INLINE_FLG_SHIFT      4
59862306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_DIF_ON_HOST_FLG_MASK  0x1
59962306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_DIF_ON_HOST_FLG_SHIFT 5
60062306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_RESERVED0_MASK        0x3
60162306a36Sopenharmony_ci#define RDMA_SQ_LOCAL_INV_WQE_RESERVED0_SHIFT       6
60262306a36Sopenharmony_ci	u8 wqe_size;
60362306a36Sopenharmony_ci	u8 prev_wqe_size;
60462306a36Sopenharmony_ci};
60562306a36Sopenharmony_ci
60662306a36Sopenharmony_cistruct rdma_sq_rdma_wqe {
60762306a36Sopenharmony_ci	__le32 imm_data;
60862306a36Sopenharmony_ci	__le32 length;
60962306a36Sopenharmony_ci	__le32 xrc_srq;
61062306a36Sopenharmony_ci	u8 req_type;
61162306a36Sopenharmony_ci	u8 flags;
61262306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_COMP_FLG_MASK		0x1
61362306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_COMP_FLG_SHIFT		0
61462306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_RD_FENCE_FLG_MASK	0x1
61562306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_RD_FENCE_FLG_SHIFT	1
61662306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_INV_FENCE_FLG_MASK	0x1
61762306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_INV_FENCE_FLG_SHIFT	2
61862306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_SE_FLG_MASK		0x1
61962306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_SE_FLG_SHIFT		3
62062306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_INLINE_FLG_MASK	0x1
62162306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_INLINE_FLG_SHIFT	4
62262306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_DIF_ON_HOST_FLG_MASK	0x1
62362306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_DIF_ON_HOST_FLG_SHIFT	5
62462306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_READ_INV_FLG_MASK	0x1
62562306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_READ_INV_FLG_SHIFT	6
62662306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_RESERVED1_MASK        0x1
62762306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_RESERVED1_SHIFT       7
62862306a36Sopenharmony_ci	u8 wqe_size;
62962306a36Sopenharmony_ci	u8 prev_wqe_size;
63062306a36Sopenharmony_ci	struct regpair remote_va;
63162306a36Sopenharmony_ci	__le32 r_key;
63262306a36Sopenharmony_ci	u8 dif_flags;
63362306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_DIF_BLOCK_SIZE_MASK            0x1
63462306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_DIF_BLOCK_SIZE_SHIFT           0
63562306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_RESERVED2_MASK        0x7F
63662306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_RESERVED2_SHIFT       1
63762306a36Sopenharmony_ci	u8 reserved3[3];
63862306a36Sopenharmony_ci};
63962306a36Sopenharmony_ci
64062306a36Sopenharmony_ci/* First element (16 bytes) of rdma wqe */
64162306a36Sopenharmony_cistruct rdma_sq_rdma_wqe_1st {
64262306a36Sopenharmony_ci	__le32 imm_data;
64362306a36Sopenharmony_ci	__le32 length;
64462306a36Sopenharmony_ci	__le32 xrc_srq;
64562306a36Sopenharmony_ci	u8 req_type;
64662306a36Sopenharmony_ci	u8 flags;
64762306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_COMP_FLG_MASK         0x1
64862306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_COMP_FLG_SHIFT        0
64962306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_RD_FENCE_FLG_MASK     0x1
65062306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_RD_FENCE_FLG_SHIFT    1
65162306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_INV_FENCE_FLG_MASK    0x1
65262306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_INV_FENCE_FLG_SHIFT   2
65362306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_SE_FLG_MASK           0x1
65462306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_SE_FLG_SHIFT          3
65562306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG_MASK       0x1
65662306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG_SHIFT      4
65762306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_MASK  0x1
65862306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_SHIFT 5
65962306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG_MASK     0x1
66062306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG_SHIFT    6
66162306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_MASK        0x1
66262306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_SHIFT       7
66362306a36Sopenharmony_ci	u8 wqe_size;
66462306a36Sopenharmony_ci	u8 prev_wqe_size;
66562306a36Sopenharmony_ci};
66662306a36Sopenharmony_ci
66762306a36Sopenharmony_ci/* Second element (16 bytes) of rdma wqe */
66862306a36Sopenharmony_cistruct rdma_sq_rdma_wqe_2nd {
66962306a36Sopenharmony_ci	struct regpair remote_va;
67062306a36Sopenharmony_ci	__le32 r_key;
67162306a36Sopenharmony_ci	u8 dif_flags;
67262306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_DIF_BLOCK_SIZE_MASK         0x1
67362306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_DIF_BLOCK_SIZE_SHIFT        0
67462306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_DIF_FIRST_SEGMENT_FLG_MASK  0x1
67562306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_DIF_FIRST_SEGMENT_FLG_SHIFT 1
67662306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_DIF_LAST_SEGMENT_FLG_MASK   0x1
67762306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_DIF_LAST_SEGMENT_FLG_SHIFT  2
67862306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_RESERVED1_MASK              0x1F
67962306a36Sopenharmony_ci#define RDMA_SQ_RDMA_WQE_2ND_RESERVED1_SHIFT             3
68062306a36Sopenharmony_ci	u8 reserved2[3];
68162306a36Sopenharmony_ci};
68262306a36Sopenharmony_ci
68362306a36Sopenharmony_ci/* SQ WQE req type enumeration */
68462306a36Sopenharmony_cienum rdma_sq_req_type {
68562306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_SEND,
68662306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_SEND_WITH_IMM,
68762306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_SEND_WITH_INVALIDATE,
68862306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_RDMA_WR,
68962306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_RDMA_WR_WITH_IMM,
69062306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_RDMA_RD,
69162306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_ATOMIC_CMP_AND_SWAP,
69262306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_ATOMIC_ADD,
69362306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_LOCAL_INVALIDATE,
69462306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_FAST_MR,
69562306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_BIND,
69662306a36Sopenharmony_ci	RDMA_SQ_REQ_TYPE_INVALID,
69762306a36Sopenharmony_ci	MAX_RDMA_SQ_REQ_TYPE
69862306a36Sopenharmony_ci};
69962306a36Sopenharmony_ci
70062306a36Sopenharmony_cistruct rdma_sq_send_wqe {
70162306a36Sopenharmony_ci	__le32 inv_key_or_imm_data;
70262306a36Sopenharmony_ci	__le32 length;
70362306a36Sopenharmony_ci	__le32 xrc_srq;
70462306a36Sopenharmony_ci	u8 req_type;
70562306a36Sopenharmony_ci	u8 flags;
70662306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_COMP_FLG_MASK         0x1
70762306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_COMP_FLG_SHIFT        0
70862306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_RD_FENCE_FLG_MASK     0x1
70962306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_RD_FENCE_FLG_SHIFT    1
71062306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_INV_FENCE_FLG_MASK    0x1
71162306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_INV_FENCE_FLG_SHIFT   2
71262306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_SE_FLG_MASK           0x1
71362306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_SE_FLG_SHIFT          3
71462306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_INLINE_FLG_MASK       0x1
71562306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_INLINE_FLG_SHIFT      4
71662306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_DIF_ON_HOST_FLG_MASK  0x1
71762306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_DIF_ON_HOST_FLG_SHIFT 5
71862306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_RESERVED0_MASK        0x3
71962306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_RESERVED0_SHIFT       6
72062306a36Sopenharmony_ci	u8 wqe_size;
72162306a36Sopenharmony_ci	u8 prev_wqe_size;
72262306a36Sopenharmony_ci	__le32 reserved1[4];
72362306a36Sopenharmony_ci};
72462306a36Sopenharmony_ci
72562306a36Sopenharmony_cistruct rdma_sq_send_wqe_1st {
72662306a36Sopenharmony_ci	__le32 inv_key_or_imm_data;
72762306a36Sopenharmony_ci	__le32 length;
72862306a36Sopenharmony_ci	__le32 xrc_srq;
72962306a36Sopenharmony_ci	u8 req_type;
73062306a36Sopenharmony_ci	u8 flags;
73162306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_COMP_FLG_MASK       0x1
73262306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_COMP_FLG_SHIFT      0
73362306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_RD_FENCE_FLG_MASK   0x1
73462306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_RD_FENCE_FLG_SHIFT  1
73562306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_INV_FENCE_FLG_MASK  0x1
73662306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_INV_FENCE_FLG_SHIFT 2
73762306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_SE_FLG_MASK         0x1
73862306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_SE_FLG_SHIFT        3
73962306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_INLINE_FLG_MASK     0x1
74062306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_INLINE_FLG_SHIFT    4
74162306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_RESERVED0_MASK      0x7
74262306a36Sopenharmony_ci#define RDMA_SQ_SEND_WQE_1ST_RESERVED0_SHIFT     5
74362306a36Sopenharmony_ci	u8 wqe_size;
74462306a36Sopenharmony_ci	u8 prev_wqe_size;
74562306a36Sopenharmony_ci};
74662306a36Sopenharmony_ci
74762306a36Sopenharmony_cistruct rdma_sq_send_wqe_2st {
74862306a36Sopenharmony_ci	__le32 reserved1[4];
74962306a36Sopenharmony_ci};
75062306a36Sopenharmony_ci
75162306a36Sopenharmony_ci#endif /* __QED_HSI_RDMA__ */
752