xref: /openbmc/linux/drivers/infiniband/hw/qedr/qedr_hsi_rdma.h (revision 3eb66e91a25497065c5322b1268cbc3953642227)
1ec72fce4SRam Amrani /* QLogic qedr NIC Driver
2ec72fce4SRam Amrani  * Copyright (c) 2015-2016  QLogic Corporation
3ec72fce4SRam Amrani  *
4ec72fce4SRam Amrani  * This software is available to you under a choice of one of two
5ec72fce4SRam Amrani  * licenses.  You may choose to be licensed under the terms of the GNU
6ec72fce4SRam Amrani  * General Public License (GPL) Version 2, available from the file
7ec72fce4SRam Amrani  * COPYING in the main directory of this source tree, or the
8ec72fce4SRam Amrani  * OpenIB.org BSD license below:
9ec72fce4SRam Amrani  *
10ec72fce4SRam Amrani  *     Redistribution and use in source and binary forms, with or
11ec72fce4SRam Amrani  *     without modification, are permitted provided that the following
12ec72fce4SRam Amrani  *     conditions are met:
13ec72fce4SRam Amrani  *
14ec72fce4SRam Amrani  *      - Redistributions of source code must retain the above
15ec72fce4SRam Amrani  *        copyright notice, this list of conditions and the following
16ec72fce4SRam Amrani  *        disclaimer.
17ec72fce4SRam Amrani  *
18ec72fce4SRam Amrani  *      - Redistributions in binary form must reproduce the above
19ec72fce4SRam Amrani  *        copyright notice, this list of conditions and the following
20ec72fce4SRam Amrani  *        disclaimer in the documentation and /or other materials
21ec72fce4SRam Amrani  *        provided with the distribution.
22ec72fce4SRam Amrani  *
23ec72fce4SRam Amrani  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24ec72fce4SRam Amrani  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25ec72fce4SRam Amrani  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26ec72fce4SRam Amrani  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27ec72fce4SRam Amrani  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28ec72fce4SRam Amrani  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29ec72fce4SRam Amrani  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30ec72fce4SRam Amrani  * SOFTWARE.
31ec72fce4SRam Amrani  */
32ec72fce4SRam Amrani #ifndef __QED_HSI_RDMA__
33ec72fce4SRam Amrani #define __QED_HSI_RDMA__
34ec72fce4SRam Amrani 
35ec72fce4SRam Amrani #include <linux/qed/rdma_common.h>
36ec72fce4SRam Amrani 
37ec72fce4SRam Amrani /* rdma completion notification queue element */
38ec72fce4SRam Amrani struct rdma_cnqe {
39ec72fce4SRam Amrani 	struct regpair	cq_handle;
40ec72fce4SRam Amrani };
41ec72fce4SRam Amrani 
42ec72fce4SRam Amrani struct rdma_cqe_responder {
43ec72fce4SRam Amrani 	struct regpair srq_wr_id;
44ec72fce4SRam Amrani 	struct regpair qp_handle;
45ec72fce4SRam Amrani 	__le32 imm_data_or_inv_r_Key;
46ec72fce4SRam Amrani 	__le32 length;
47ec72fce4SRam Amrani 	__le32 imm_data_hi;
4850bc60cbSMichal Kalderon 	__le16 rq_cons_or_srq_id;
49ec72fce4SRam Amrani 	u8 flags;
50a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_TOGGLE_BIT_MASK  0x1
51a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_TOGGLE_BIT_SHIFT 0
52a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_TYPE_MASK        0x3
53a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_TYPE_SHIFT       1
54a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_INV_FLG_MASK     0x1
55a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_INV_FLG_SHIFT    3
56a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_IMM_FLG_MASK     0x1
57a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_IMM_FLG_SHIFT    4
58a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_RDMA_FLG_MASK    0x1
59a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_RDMA_FLG_SHIFT   5
60a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_RESERVED2_MASK   0x3
61a7efd777SRam Amrani #define RDMA_CQE_RESPONDER_RESERVED2_SHIFT  6
62a7efd777SRam Amrani 	u8 status;
63ec72fce4SRam Amrani };
64ec72fce4SRam Amrani 
65ec72fce4SRam Amrani struct rdma_cqe_requester {
66ec72fce4SRam Amrani 	__le16 sq_cons;
67ec72fce4SRam Amrani 	__le16 reserved0;
68ec72fce4SRam Amrani 	__le32 reserved1;
69ec72fce4SRam Amrani 	struct regpair qp_handle;
70ec72fce4SRam Amrani 	struct regpair reserved2;
71ec72fce4SRam Amrani 	__le32 reserved3;
72ec72fce4SRam Amrani 	__le16 reserved4;
73ec72fce4SRam Amrani 	u8 flags;
74a7efd777SRam Amrani #define RDMA_CQE_REQUESTER_TOGGLE_BIT_MASK  0x1
75a7efd777SRam Amrani #define RDMA_CQE_REQUESTER_TOGGLE_BIT_SHIFT 0
76a7efd777SRam Amrani #define RDMA_CQE_REQUESTER_TYPE_MASK        0x3
77a7efd777SRam Amrani #define RDMA_CQE_REQUESTER_TYPE_SHIFT       1
78a7efd777SRam Amrani #define RDMA_CQE_REQUESTER_RESERVED5_MASK   0x1F
79a7efd777SRam Amrani #define RDMA_CQE_REQUESTER_RESERVED5_SHIFT  3
80ec72fce4SRam Amrani 	u8 status;
81ec72fce4SRam Amrani };
82ec72fce4SRam Amrani 
83ec72fce4SRam Amrani struct rdma_cqe_common {
84ec72fce4SRam Amrani 	struct regpair reserved0;
85ec72fce4SRam Amrani 	struct regpair qp_handle;
86ec72fce4SRam Amrani 	__le16 reserved1[7];
87ec72fce4SRam Amrani 	u8 flags;
88a7efd777SRam Amrani #define RDMA_CQE_COMMON_TOGGLE_BIT_MASK  0x1
89a7efd777SRam Amrani #define RDMA_CQE_COMMON_TOGGLE_BIT_SHIFT 0
90a7efd777SRam Amrani #define RDMA_CQE_COMMON_TYPE_MASK        0x3
91a7efd777SRam Amrani #define RDMA_CQE_COMMON_TYPE_SHIFT       1
92a7efd777SRam Amrani #define RDMA_CQE_COMMON_RESERVED2_MASK   0x1F
93a7efd777SRam Amrani #define RDMA_CQE_COMMON_RESERVED2_SHIFT  3
94ec72fce4SRam Amrani 	u8 status;
95ec72fce4SRam Amrani };
96ec72fce4SRam Amrani 
97ec72fce4SRam Amrani /* rdma completion queue element */
98ec72fce4SRam Amrani union rdma_cqe {
99ec72fce4SRam Amrani 	struct rdma_cqe_responder resp;
100ec72fce4SRam Amrani 	struct rdma_cqe_requester req;
101ec72fce4SRam Amrani 	struct rdma_cqe_common cmn;
102ec72fce4SRam Amrani };
103ec72fce4SRam Amrani 
104a7efd777SRam Amrani /* * CQE requester status enumeration */
105a7efd777SRam Amrani enum rdma_cqe_requester_status_enum {
106a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_OK,
107a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_BAD_RESPONSE_ERR,
108a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_LOCAL_LENGTH_ERR,
109a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_LOCAL_QP_OPERATION_ERR,
110a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_LOCAL_PROTECTION_ERR,
111a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_MEMORY_MGT_OPERATION_ERR,
112a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_REMOTE_INVALID_REQUEST_ERR,
113a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_REMOTE_ACCESS_ERR,
114a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_REMOTE_OPERATION_ERR,
115a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_RNR_NAK_RETRY_CNT_ERR,
116a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_TRANSPORT_RETRY_CNT_ERR,
117a7efd777SRam Amrani 	RDMA_CQE_REQ_STS_WORK_REQUEST_FLUSHED_ERR,
11850bc60cbSMichal Kalderon 	RDMA_CQE_REQ_STS_XRC_VOILATION_ERR,
119d52c89f1SMichal Kalderon 	RDMA_CQE_REQ_STS_SIG_ERR,
120a7efd777SRam Amrani 	MAX_RDMA_CQE_REQUESTER_STATUS_ENUM
121a7efd777SRam Amrani };
122a7efd777SRam Amrani 
123a7efd777SRam Amrani /* CQE responder status enumeration */
124a7efd777SRam Amrani enum rdma_cqe_responder_status_enum {
125a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_OK,
126a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_LOCAL_ACCESS_ERR,
127a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_LOCAL_LENGTH_ERR,
128a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_LOCAL_QP_OPERATION_ERR,
129a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_LOCAL_PROTECTION_ERR,
130a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_MEMORY_MGT_OPERATION_ERR,
131a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_REMOTE_INVALID_REQUEST_ERR,
132a7efd777SRam Amrani 	RDMA_CQE_RESP_STS_WORK_REQUEST_FLUSHED_ERR,
133a7efd777SRam Amrani 	MAX_RDMA_CQE_RESPONDER_STATUS_ENUM
134a7efd777SRam Amrani };
135a7efd777SRam Amrani 
136a7efd777SRam Amrani /* CQE type enumeration */
137a7efd777SRam Amrani enum rdma_cqe_type {
138a7efd777SRam Amrani 	RDMA_CQE_TYPE_REQUESTER,
139a7efd777SRam Amrani 	RDMA_CQE_TYPE_RESPONDER_RQ,
140a7efd777SRam Amrani 	RDMA_CQE_TYPE_RESPONDER_SRQ,
14150bc60cbSMichal Kalderon 	RDMA_CQE_TYPE_RESPONDER_XRC_SRQ,
142a7efd777SRam Amrani 	RDMA_CQE_TYPE_INVALID,
143a7efd777SRam Amrani 	MAX_RDMA_CQE_TYPE
144a7efd777SRam Amrani };
145a7efd777SRam Amrani 
146ec72fce4SRam Amrani struct rdma_sq_sge {
147ec72fce4SRam Amrani 	__le32 length;
148ec72fce4SRam Amrani 	struct regpair	addr;
149ec72fce4SRam Amrani 	__le32 l_key;
150ec72fce4SRam Amrani };
151ec72fce4SRam Amrani 
152ec72fce4SRam Amrani struct rdma_rq_sge {
153ec72fce4SRam Amrani 	struct regpair addr;
154ec72fce4SRam Amrani 	__le32 length;
155ec72fce4SRam Amrani 	__le32 flags;
156d52c89f1SMichal Kalderon #define RDMA_RQ_SGE_L_KEY_LO_MASK   0x3FFFFFF
157d52c89f1SMichal Kalderon #define RDMA_RQ_SGE_L_KEY_LO_SHIFT  0
158afa0e13bSRam Amrani #define RDMA_RQ_SGE_NUM_SGES_MASK   0x7
159afa0e13bSRam Amrani #define RDMA_RQ_SGE_NUM_SGES_SHIFT  26
160d52c89f1SMichal Kalderon #define RDMA_RQ_SGE_L_KEY_HI_MASK   0x7
161d52c89f1SMichal Kalderon #define RDMA_RQ_SGE_L_KEY_HI_SHIFT  29
162ec72fce4SRam Amrani };
163ec72fce4SRam Amrani 
164*3491c9e7SYuval Bason struct rdma_srq_wqe_header {
165*3491c9e7SYuval Bason 	struct regpair wr_id;
166*3491c9e7SYuval Bason 	u8 num_sges /* number of SGEs in WQE */;
167*3491c9e7SYuval Bason 	u8 reserved2[7];
168*3491c9e7SYuval Bason };
169*3491c9e7SYuval Bason 
170ec72fce4SRam Amrani struct rdma_srq_sge {
171ec72fce4SRam Amrani 	struct regpair addr;
172ec72fce4SRam Amrani 	__le32 length;
173ec72fce4SRam Amrani 	__le32 l_key;
174ec72fce4SRam Amrani };
175a7efd777SRam Amrani 
176*3491c9e7SYuval Bason union rdma_srq_elm {
177*3491c9e7SYuval Bason 	struct rdma_srq_wqe_header header;
178*3491c9e7SYuval Bason 	struct rdma_srq_sge sge;
179*3491c9e7SYuval Bason };
180*3491c9e7SYuval Bason 
181da090917STomer Tayar /* Rdma doorbell data for flags update */
182da090917STomer Tayar struct rdma_pwm_flags_data {
183da090917STomer Tayar 	__le16 icid; /* internal CID */
184da090917STomer Tayar 	u8 agg_flags; /* aggregative flags */
185da090917STomer Tayar 	u8 reserved;
186da090917STomer Tayar };
187da090917STomer Tayar 
188cecbcddfSRam Amrani /* Rdma doorbell data for SQ and RQ */
189cecbcddfSRam Amrani struct rdma_pwm_val16_data {
190cecbcddfSRam Amrani 	__le16 icid;
191cecbcddfSRam Amrani 	__le16 value;
192cecbcddfSRam Amrani };
193cecbcddfSRam Amrani 
194cecbcddfSRam Amrani union rdma_pwm_val16_data_union {
195cecbcddfSRam Amrani 	struct rdma_pwm_val16_data as_struct;
196cecbcddfSRam Amrani 	__le32 as_dword;
197cecbcddfSRam Amrani };
198cecbcddfSRam Amrani 
199a7efd777SRam Amrani /* Rdma doorbell data for CQ */
200a7efd777SRam Amrani struct rdma_pwm_val32_data {
201a7efd777SRam Amrani 	__le16 icid;
202a7efd777SRam Amrani 	u8 agg_flags;
203a7efd777SRam Amrani 	u8 params;
204a7efd777SRam Amrani #define RDMA_PWM_VAL32_DATA_AGG_CMD_MASK		0x3
205a7efd777SRam Amrani #define RDMA_PWM_VAL32_DATA_AGG_CMD_SHIFT		0
206a7efd777SRam Amrani #define RDMA_PWM_VAL32_DATA_BYPASS_EN_MASK		0x1
207a7efd777SRam Amrani #define RDMA_PWM_VAL32_DATA_BYPASS_EN_SHIFT		2
208da090917STomer Tayar #define RDMA_PWM_VAL32_DATA_CONN_TYPE_IS_IWARP_MASK	0x1
209da090917STomer Tayar #define RDMA_PWM_VAL32_DATA_CONN_TYPE_IS_IWARP_SHIFT	3
210da090917STomer Tayar #define RDMA_PWM_VAL32_DATA_SET_16B_VAL_MASK		0x1
211da090917STomer Tayar #define RDMA_PWM_VAL32_DATA_SET_16B_VAL_SHIFT		4
212da090917STomer Tayar #define RDMA_PWM_VAL32_DATA_RESERVED_MASK		0x7
213da090917STomer Tayar #define RDMA_PWM_VAL32_DATA_RESERVED_SHIFT		5
214a7efd777SRam Amrani 	__le32 value;
215a7efd777SRam Amrani };
216a7efd777SRam Amrani 
217afa0e13bSRam Amrani /* DIF Block size options */
218afa0e13bSRam Amrani enum rdma_dif_block_size {
219afa0e13bSRam Amrani 	RDMA_DIF_BLOCK_512 = 0,
220afa0e13bSRam Amrani 	RDMA_DIF_BLOCK_4096 = 1,
221afa0e13bSRam Amrani 	MAX_RDMA_DIF_BLOCK_SIZE
222afa0e13bSRam Amrani };
223afa0e13bSRam Amrani 
224afa0e13bSRam Amrani /* DIF CRC initial value */
225afa0e13bSRam Amrani enum rdma_dif_crc_seed {
226afa0e13bSRam Amrani 	RDMA_DIF_CRC_SEED_0000 = 0,
227afa0e13bSRam Amrani 	RDMA_DIF_CRC_SEED_FFFF = 1,
228afa0e13bSRam Amrani 	MAX_RDMA_DIF_CRC_SEED
229afa0e13bSRam Amrani };
230afa0e13bSRam Amrani 
231afa0e13bSRam Amrani /* RDMA DIF Error Result Structure */
232afa0e13bSRam Amrani struct rdma_dif_error_result {
233afa0e13bSRam Amrani 	__le32 error_intervals;
234afa0e13bSRam Amrani 	__le32 dif_error_1st_interval;
235afa0e13bSRam Amrani 	u8 flags;
236afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_CRC_MASK      0x1
237afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_CRC_SHIFT     0
238afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_APP_TAG_MASK  0x1
239afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_APP_TAG_SHIFT 1
240afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_REF_TAG_MASK  0x1
241afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_DIF_ERROR_TYPE_REF_TAG_SHIFT 2
242afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_RESERVED0_MASK               0xF
243afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_RESERVED0_SHIFT              3
244afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_TOGGLE_BIT_MASK              0x1
245afa0e13bSRam Amrani #define RDMA_DIF_ERROR_RESULT_TOGGLE_BIT_SHIFT             7
246afa0e13bSRam Amrani 	u8 reserved1[55];
247afa0e13bSRam Amrani };
248afa0e13bSRam Amrani 
249afa0e13bSRam Amrani /* DIF IO direction */
250afa0e13bSRam Amrani enum rdma_dif_io_direction_flg {
251afa0e13bSRam Amrani 	RDMA_DIF_DIR_RX = 0,
252afa0e13bSRam Amrani 	RDMA_DIF_DIR_TX = 1,
253afa0e13bSRam Amrani 	MAX_RDMA_DIF_IO_DIRECTION_FLG
254afa0e13bSRam Amrani };
255afa0e13bSRam Amrani 
256d52c89f1SMichal Kalderon struct rdma_dif_params {
257d52c89f1SMichal Kalderon 	__le32 base_ref_tag;
258d52c89f1SMichal Kalderon 	__le16 app_tag;
259d52c89f1SMichal Kalderon 	__le16 app_tag_mask;
260d52c89f1SMichal Kalderon 	__le16 runt_crc_value;
261d52c89f1SMichal Kalderon 	__le16 flags;
262d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_IO_DIRECTION_FLG_MASK    0x1
263d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_IO_DIRECTION_FLG_SHIFT   0
264d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_BLOCK_SIZE_MASK          0x1
265d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_BLOCK_SIZE_SHIFT         1
266d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_RUNT_VALID_FLG_MASK      0x1
267d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_RUNT_VALID_FLG_SHIFT     2
268d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_VALIDATE_CRC_GUARD_MASK  0x1
269d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_VALIDATE_CRC_GUARD_SHIFT 3
270d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_VALIDATE_REF_TAG_MASK    0x1
271d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_VALIDATE_REF_TAG_SHIFT   4
272d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_VALIDATE_APP_TAG_MASK    0x1
273d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_VALIDATE_APP_TAG_SHIFT   5
274d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_CRC_SEED_MASK            0x1
275d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_CRC_SEED_SHIFT           6
276d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_RX_REF_TAG_CONST_MASK    0x1
277d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_RX_REF_TAG_CONST_SHIFT   7
278d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_BLOCK_GUARD_TYPE_MASK    0x1
279d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_BLOCK_GUARD_TYPE_SHIFT   8
280d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_APP_ESCAPE_MASK          0x1
281d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_APP_ESCAPE_SHIFT         9
282d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_REF_ESCAPE_MASK          0x1
283d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_REF_ESCAPE_SHIFT         10
284d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_RESERVED4_MASK           0x1F
285d52c89f1SMichal Kalderon #define RDMA_DIF_PARAMS_RESERVED4_SHIFT          11
286d52c89f1SMichal Kalderon 	__le32 reserved5;
287afa0e13bSRam Amrani };
288afa0e13bSRam Amrani 
289afa0e13bSRam Amrani 
290afa0e13bSRam Amrani struct rdma_sq_atomic_wqe {
291afa0e13bSRam Amrani 	__le32 reserved1;
292afa0e13bSRam Amrani 	__le32 length;
293afa0e13bSRam Amrani 	__le32 xrc_srq;
294afa0e13bSRam Amrani 	u8 req_type;
295afa0e13bSRam Amrani 	u8 flags;
296afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_COMP_FLG_MASK         0x1
297afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_COMP_FLG_SHIFT        0
298afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_RD_FENCE_FLG_MASK     0x1
299afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_RD_FENCE_FLG_SHIFT    1
300afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_INV_FENCE_FLG_MASK    0x1
301afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_INV_FENCE_FLG_SHIFT   2
302afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_SE_FLG_MASK           0x1
303afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_SE_FLG_SHIFT          3
304afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_INLINE_FLG_MASK       0x1
305afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_INLINE_FLG_SHIFT      4
306afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_DIF_ON_HOST_FLG_MASK  0x1
307afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_DIF_ON_HOST_FLG_SHIFT 5
308afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_RESERVED0_MASK        0x3
309afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_RESERVED0_SHIFT       6
310afa0e13bSRam Amrani 	u8 wqe_size;
311afa0e13bSRam Amrani 	u8 prev_wqe_size;
312afa0e13bSRam Amrani 	struct regpair remote_va;
313afa0e13bSRam Amrani 	__le32 r_key;
314afa0e13bSRam Amrani 	__le32 reserved2;
315afa0e13bSRam Amrani 	struct regpair cmp_data;
316afa0e13bSRam Amrani 	struct regpair swap_data;
317afa0e13bSRam Amrani };
318afa0e13bSRam Amrani 
319afa0e13bSRam Amrani /* First element (16 bytes) of atomic wqe */
320afa0e13bSRam Amrani struct rdma_sq_atomic_wqe_1st {
321afa0e13bSRam Amrani 	__le32 reserved1;
322afa0e13bSRam Amrani 	__le32 length;
323afa0e13bSRam Amrani 	__le32 xrc_srq;
324afa0e13bSRam Amrani 	u8 req_type;
325afa0e13bSRam Amrani 	u8 flags;
326afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_COMP_FLG_MASK       0x1
327afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_COMP_FLG_SHIFT      0
328afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_RD_FENCE_FLG_MASK   0x1
329afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_RD_FENCE_FLG_SHIFT  1
330afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_INV_FENCE_FLG_MASK  0x1
331afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_INV_FENCE_FLG_SHIFT 2
332afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_SE_FLG_MASK         0x1
333afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_SE_FLG_SHIFT        3
334afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_INLINE_FLG_MASK     0x1
335afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_INLINE_FLG_SHIFT    4
336afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_RESERVED0_MASK      0x7
337afa0e13bSRam Amrani #define RDMA_SQ_ATOMIC_WQE_1ST_RESERVED0_SHIFT     5
338afa0e13bSRam Amrani 	u8 wqe_size;
339afa0e13bSRam Amrani 	u8 prev_wqe_size;
340afa0e13bSRam Amrani };
341afa0e13bSRam Amrani 
342afa0e13bSRam Amrani /* Second element (16 bytes) of atomic wqe */
343afa0e13bSRam Amrani struct rdma_sq_atomic_wqe_2nd {
344afa0e13bSRam Amrani 	struct regpair remote_va;
345afa0e13bSRam Amrani 	__le32 r_key;
346afa0e13bSRam Amrani 	__le32 reserved2;
347afa0e13bSRam Amrani };
348afa0e13bSRam Amrani 
349afa0e13bSRam Amrani /* Third element (16 bytes) of atomic wqe */
350afa0e13bSRam Amrani struct rdma_sq_atomic_wqe_3rd {
351afa0e13bSRam Amrani 	struct regpair cmp_data;
352afa0e13bSRam Amrani 	struct regpair swap_data;
353afa0e13bSRam Amrani };
354afa0e13bSRam Amrani 
355afa0e13bSRam Amrani struct rdma_sq_bind_wqe {
356afa0e13bSRam Amrani 	struct regpair addr;
357afa0e13bSRam Amrani 	__le32 l_key;
358afa0e13bSRam Amrani 	u8 req_type;
359afa0e13bSRam Amrani 	u8 flags;
360afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_COMP_FLG_MASK       0x1
361afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_COMP_FLG_SHIFT      0
362afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_RD_FENCE_FLG_MASK   0x1
363afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_RD_FENCE_FLG_SHIFT  1
364afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_INV_FENCE_FLG_MASK  0x1
365afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_INV_FENCE_FLG_SHIFT 2
366afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_SE_FLG_MASK         0x1
367afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_SE_FLG_SHIFT        3
368afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_INLINE_FLG_MASK     0x1
369afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_INLINE_FLG_SHIFT    4
370d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_DIF_ON_HOST_FLG_MASK  0x1
371d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_DIF_ON_HOST_FLG_SHIFT 5
372d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_RESERVED0_MASK      0x3
373d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_RESERVED0_SHIFT     6
374afa0e13bSRam Amrani 	u8 wqe_size;
375afa0e13bSRam Amrani 	u8 prev_wqe_size;
376afa0e13bSRam Amrani 	u8 bind_ctrl;
377afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_ZERO_BASED_MASK     0x1
378afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_ZERO_BASED_SHIFT    0
379d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_RESERVED1_MASK        0x7F
380d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_RESERVED1_SHIFT       1
381afa0e13bSRam Amrani 	u8 access_ctrl;
382afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_REMOTE_READ_MASK    0x1
383afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_REMOTE_READ_SHIFT   0
384afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_REMOTE_WRITE_MASK   0x1
385afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_REMOTE_WRITE_SHIFT  1
386afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_ENABLE_ATOMIC_MASK  0x1
387afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_ENABLE_ATOMIC_SHIFT 2
388afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_LOCAL_READ_MASK     0x1
389afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_LOCAL_READ_SHIFT    3
390afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_LOCAL_WRITE_MASK    0x1
391afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_LOCAL_WRITE_SHIFT   4
392afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_RESERVED2_MASK      0x7
393afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_RESERVED2_SHIFT     5
394afa0e13bSRam Amrani 	u8 reserved3;
395afa0e13bSRam Amrani 	u8 length_hi;
396afa0e13bSRam Amrani 	__le32 length_lo;
397afa0e13bSRam Amrani 	__le32 parent_l_key;
398afa0e13bSRam Amrani 	__le32 reserved4;
399d52c89f1SMichal Kalderon 	struct rdma_dif_params dif_params;
400afa0e13bSRam Amrani };
401afa0e13bSRam Amrani 
402afa0e13bSRam Amrani /* First element (16 bytes) of bind wqe */
403afa0e13bSRam Amrani struct rdma_sq_bind_wqe_1st {
404afa0e13bSRam Amrani 	struct regpair addr;
405afa0e13bSRam Amrani 	__le32 l_key;
406afa0e13bSRam Amrani 	u8 req_type;
407afa0e13bSRam Amrani 	u8 flags;
408afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_COMP_FLG_MASK       0x1
409afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_COMP_FLG_SHIFT      0
410afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_RD_FENCE_FLG_MASK   0x1
411afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_RD_FENCE_FLG_SHIFT  1
412afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_INV_FENCE_FLG_MASK  0x1
413afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_INV_FENCE_FLG_SHIFT 2
414afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_SE_FLG_MASK         0x1
415afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_SE_FLG_SHIFT        3
416afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_INLINE_FLG_MASK     0x1
417afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_INLINE_FLG_SHIFT    4
418afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_RESERVED0_MASK      0x7
419afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_1ST_RESERVED0_SHIFT     5
420afa0e13bSRam Amrani 	u8 wqe_size;
421afa0e13bSRam Amrani 	u8 prev_wqe_size;
422afa0e13bSRam Amrani };
423afa0e13bSRam Amrani 
424afa0e13bSRam Amrani /* Second element (16 bytes) of bind wqe */
425afa0e13bSRam Amrani struct rdma_sq_bind_wqe_2nd {
426afa0e13bSRam Amrani 	u8 bind_ctrl;
427afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_ZERO_BASED_MASK     0x1
428afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_ZERO_BASED_SHIFT    0
429d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_2ND_RESERVED1_MASK      0x7F
430d52c89f1SMichal Kalderon #define RDMA_SQ_BIND_WQE_2ND_RESERVED1_SHIFT     1
431afa0e13bSRam Amrani 	u8 access_ctrl;
432afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_REMOTE_READ_MASK    0x1
433afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_REMOTE_READ_SHIFT   0
434afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_REMOTE_WRITE_MASK   0x1
435afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_REMOTE_WRITE_SHIFT  1
436afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_ENABLE_ATOMIC_MASK  0x1
437afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_ENABLE_ATOMIC_SHIFT 2
438afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_LOCAL_READ_MASK     0x1
439afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_LOCAL_READ_SHIFT    3
440afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_LOCAL_WRITE_MASK    0x1
441afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_LOCAL_WRITE_SHIFT   4
442afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_RESERVED2_MASK      0x7
443afa0e13bSRam Amrani #define RDMA_SQ_BIND_WQE_2ND_RESERVED2_SHIFT     5
444afa0e13bSRam Amrani 	u8 reserved3;
445afa0e13bSRam Amrani 	u8 length_hi;
446afa0e13bSRam Amrani 	__le32 length_lo;
447afa0e13bSRam Amrani 	__le32 parent_l_key;
448afa0e13bSRam Amrani 	__le32 reserved4;
449afa0e13bSRam Amrani };
450afa0e13bSRam Amrani 
451d52c89f1SMichal Kalderon /* Third element (16 bytes) of bind wqe */
452d52c89f1SMichal Kalderon struct rdma_sq_bind_wqe_3rd {
453d52c89f1SMichal Kalderon 	struct rdma_dif_params dif_params;
454d52c89f1SMichal Kalderon };
455d52c89f1SMichal Kalderon 
456afa0e13bSRam Amrani /* Structure with only the SQ WQE common
457afa0e13bSRam Amrani  * fields. Size is of one SQ element (16B)
458afa0e13bSRam Amrani  */
459afa0e13bSRam Amrani struct rdma_sq_common_wqe {
460afa0e13bSRam Amrani 	__le32 reserved1[3];
461afa0e13bSRam Amrani 	u8 req_type;
462afa0e13bSRam Amrani 	u8 flags;
463afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_COMP_FLG_MASK       0x1
464afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_COMP_FLG_SHIFT      0
465afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_RD_FENCE_FLG_MASK   0x1
466afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_RD_FENCE_FLG_SHIFT  1
467afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_INV_FENCE_FLG_MASK  0x1
468afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_INV_FENCE_FLG_SHIFT 2
469afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_SE_FLG_MASK         0x1
470afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_SE_FLG_SHIFT        3
471afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_INLINE_FLG_MASK     0x1
472afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_INLINE_FLG_SHIFT    4
473afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_RESERVED0_MASK      0x7
474afa0e13bSRam Amrani #define RDMA_SQ_COMMON_WQE_RESERVED0_SHIFT     5
475afa0e13bSRam Amrani 	u8 wqe_size;
476afa0e13bSRam Amrani 	u8 prev_wqe_size;
477afa0e13bSRam Amrani };
478afa0e13bSRam Amrani 
479afa0e13bSRam Amrani struct rdma_sq_fmr_wqe {
480afa0e13bSRam Amrani 	struct regpair addr;
481afa0e13bSRam Amrani 	__le32 l_key;
482afa0e13bSRam Amrani 	u8 req_type;
483afa0e13bSRam Amrani 	u8 flags;
484afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_COMP_FLG_MASK                0x1
485afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_COMP_FLG_SHIFT               0
486afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RD_FENCE_FLG_MASK            0x1
487afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RD_FENCE_FLG_SHIFT           1
488afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_INV_FENCE_FLG_MASK           0x1
489afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_INV_FENCE_FLG_SHIFT          2
490afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_SE_FLG_MASK                  0x1
491afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_SE_FLG_SHIFT                 3
492afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_INLINE_FLG_MASK              0x1
493afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_INLINE_FLG_SHIFT             4
494afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_DIF_ON_HOST_FLG_MASK         0x1
495afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_DIF_ON_HOST_FLG_SHIFT        5
496afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RESERVED0_MASK               0x3
497afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RESERVED0_SHIFT              6
498afa0e13bSRam Amrani 	u8 wqe_size;
499afa0e13bSRam Amrani 	u8 prev_wqe_size;
500afa0e13bSRam Amrani 	u8 fmr_ctrl;
501afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_PAGE_SIZE_LOG_MASK           0x1F
502afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_PAGE_SIZE_LOG_SHIFT          0
503afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_ZERO_BASED_MASK              0x1
504afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_ZERO_BASED_SHIFT             5
505afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_BIND_EN_MASK                 0x1
506afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_BIND_EN_SHIFT                6
507afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RESERVED1_MASK               0x1
508afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RESERVED1_SHIFT              7
509afa0e13bSRam Amrani 	u8 access_ctrl;
510afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_REMOTE_READ_MASK             0x1
511afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_REMOTE_READ_SHIFT            0
512afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_REMOTE_WRITE_MASK            0x1
513afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_REMOTE_WRITE_SHIFT           1
514afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_ENABLE_ATOMIC_MASK           0x1
515afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_ENABLE_ATOMIC_SHIFT          2
516afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_LOCAL_READ_MASK              0x1
517afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_LOCAL_READ_SHIFT             3
518afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_LOCAL_WRITE_MASK             0x1
519afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_LOCAL_WRITE_SHIFT            4
520afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RESERVED2_MASK               0x7
521afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_RESERVED2_SHIFT              5
522afa0e13bSRam Amrani 	u8 reserved3;
523afa0e13bSRam Amrani 	u8 length_hi;
524afa0e13bSRam Amrani 	__le32 length_lo;
525afa0e13bSRam Amrani 	struct regpair pbl_addr;
526afa0e13bSRam Amrani };
527afa0e13bSRam Amrani 
528afa0e13bSRam Amrani /* First element (16 bytes) of fmr wqe */
529afa0e13bSRam Amrani struct rdma_sq_fmr_wqe_1st {
530afa0e13bSRam Amrani 	struct regpair addr;
531afa0e13bSRam Amrani 	__le32 l_key;
532afa0e13bSRam Amrani 	u8 req_type;
533afa0e13bSRam Amrani 	u8 flags;
534afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_COMP_FLG_MASK         0x1
535afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_COMP_FLG_SHIFT        0
536afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_RD_FENCE_FLG_MASK     0x1
537afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_RD_FENCE_FLG_SHIFT    1
538afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_INV_FENCE_FLG_MASK    0x1
539afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_INV_FENCE_FLG_SHIFT   2
540afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_SE_FLG_MASK           0x1
541afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_SE_FLG_SHIFT          3
542afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_INLINE_FLG_MASK       0x1
543afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_INLINE_FLG_SHIFT      4
544afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_DIF_ON_HOST_FLG_MASK  0x1
545afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_DIF_ON_HOST_FLG_SHIFT 5
546afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_RESERVED0_MASK        0x3
547afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_1ST_RESERVED0_SHIFT       6
548afa0e13bSRam Amrani 	u8 wqe_size;
549afa0e13bSRam Amrani 	u8 prev_wqe_size;
550afa0e13bSRam Amrani };
551afa0e13bSRam Amrani 
552afa0e13bSRam Amrani /* Second element (16 bytes) of fmr wqe */
553afa0e13bSRam Amrani struct rdma_sq_fmr_wqe_2nd {
554afa0e13bSRam Amrani 	u8 fmr_ctrl;
555afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_PAGE_SIZE_LOG_MASK  0x1F
556afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_PAGE_SIZE_LOG_SHIFT 0
557afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_ZERO_BASED_MASK     0x1
558afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_ZERO_BASED_SHIFT    5
559afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_BIND_EN_MASK        0x1
560afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_BIND_EN_SHIFT       6
561afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_RESERVED1_MASK      0x1
562afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_RESERVED1_SHIFT     7
563afa0e13bSRam Amrani 	u8 access_ctrl;
564afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_REMOTE_READ_MASK    0x1
565afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_REMOTE_READ_SHIFT   0
566afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_REMOTE_WRITE_MASK   0x1
567afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_REMOTE_WRITE_SHIFT  1
568afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_ENABLE_ATOMIC_MASK  0x1
569afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_ENABLE_ATOMIC_SHIFT 2
570afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_LOCAL_READ_MASK     0x1
571afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_LOCAL_READ_SHIFT    3
572afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_LOCAL_WRITE_MASK    0x1
573afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_LOCAL_WRITE_SHIFT   4
574afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_RESERVED2_MASK      0x7
575afa0e13bSRam Amrani #define RDMA_SQ_FMR_WQE_2ND_RESERVED2_SHIFT     5
576afa0e13bSRam Amrani 	u8 reserved3;
577afa0e13bSRam Amrani 	u8 length_hi;
578afa0e13bSRam Amrani 	__le32 length_lo;
579afa0e13bSRam Amrani 	struct regpair pbl_addr;
580afa0e13bSRam Amrani };
581afa0e13bSRam Amrani 
582afa0e13bSRam Amrani 
583afa0e13bSRam Amrani struct rdma_sq_local_inv_wqe {
584afa0e13bSRam Amrani 	struct regpair reserved;
585afa0e13bSRam Amrani 	__le32 inv_l_key;
586afa0e13bSRam Amrani 	u8 req_type;
587afa0e13bSRam Amrani 	u8 flags;
588afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_COMP_FLG_MASK         0x1
589afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_COMP_FLG_SHIFT        0
590afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_RD_FENCE_FLG_MASK     0x1
591afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_RD_FENCE_FLG_SHIFT    1
592afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_INV_FENCE_FLG_MASK    0x1
593afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_INV_FENCE_FLG_SHIFT   2
594afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_SE_FLG_MASK           0x1
595afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_SE_FLG_SHIFT          3
596afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_INLINE_FLG_MASK       0x1
597afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_INLINE_FLG_SHIFT      4
598afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_DIF_ON_HOST_FLG_MASK  0x1
599afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_DIF_ON_HOST_FLG_SHIFT 5
600afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_RESERVED0_MASK        0x3
601afa0e13bSRam Amrani #define RDMA_SQ_LOCAL_INV_WQE_RESERVED0_SHIFT       6
602afa0e13bSRam Amrani 	u8 wqe_size;
603afa0e13bSRam Amrani 	u8 prev_wqe_size;
604afa0e13bSRam Amrani };
605afa0e13bSRam Amrani 
606afa0e13bSRam Amrani struct rdma_sq_rdma_wqe {
607afa0e13bSRam Amrani 	__le32 imm_data;
608afa0e13bSRam Amrani 	__le32 length;
609afa0e13bSRam Amrani 	__le32 xrc_srq;
610afa0e13bSRam Amrani 	u8 req_type;
611afa0e13bSRam Amrani 	u8 flags;
612afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_COMP_FLG_MASK		0x1
613afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_COMP_FLG_SHIFT		0
614afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_RD_FENCE_FLG_MASK	0x1
615afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_RD_FENCE_FLG_SHIFT	1
616afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_INV_FENCE_FLG_MASK	0x1
617afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_INV_FENCE_FLG_SHIFT	2
618afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_SE_FLG_MASK		0x1
619afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_SE_FLG_SHIFT		3
620afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_INLINE_FLG_MASK	0x1
621afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_INLINE_FLG_SHIFT	4
622afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_DIF_ON_HOST_FLG_MASK	0x1
623afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_DIF_ON_HOST_FLG_SHIFT	5
624da090917STomer Tayar #define RDMA_SQ_RDMA_WQE_READ_INV_FLG_MASK	0x1
625da090917STomer Tayar #define RDMA_SQ_RDMA_WQE_READ_INV_FLG_SHIFT	6
626d52c89f1SMichal Kalderon #define RDMA_SQ_RDMA_WQE_RESERVED1_MASK        0x1
627d52c89f1SMichal Kalderon #define RDMA_SQ_RDMA_WQE_RESERVED1_SHIFT       7
628afa0e13bSRam Amrani 	u8 wqe_size;
629afa0e13bSRam Amrani 	u8 prev_wqe_size;
630afa0e13bSRam Amrani 	struct regpair remote_va;
631afa0e13bSRam Amrani 	__le32 r_key;
632afa0e13bSRam Amrani 	u8 dif_flags;
633afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_DIF_BLOCK_SIZE_MASK            0x1
634afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_DIF_BLOCK_SIZE_SHIFT           0
635d52c89f1SMichal Kalderon #define RDMA_SQ_RDMA_WQE_RESERVED2_MASK        0x7F
636d52c89f1SMichal Kalderon #define RDMA_SQ_RDMA_WQE_RESERVED2_SHIFT       1
637d52c89f1SMichal Kalderon 	u8 reserved3[3];
638afa0e13bSRam Amrani };
639afa0e13bSRam Amrani 
640afa0e13bSRam Amrani /* First element (16 bytes) of rdma wqe */
641afa0e13bSRam Amrani struct rdma_sq_rdma_wqe_1st {
642afa0e13bSRam Amrani 	__le32 imm_data;
643afa0e13bSRam Amrani 	__le32 length;
644afa0e13bSRam Amrani 	__le32 xrc_srq;
645afa0e13bSRam Amrani 	u8 req_type;
646afa0e13bSRam Amrani 	u8 flags;
647afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_COMP_FLG_MASK         0x1
648afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_COMP_FLG_SHIFT        0
649afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_RD_FENCE_FLG_MASK     0x1
650afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_RD_FENCE_FLG_SHIFT    1
651afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_INV_FENCE_FLG_MASK    0x1
652afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_INV_FENCE_FLG_SHIFT   2
653afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_SE_FLG_MASK           0x1
654afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_SE_FLG_SHIFT          3
655afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG_MASK       0x1
656afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_INLINE_FLG_SHIFT      4
657afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_MASK  0x1
658afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_1ST_DIF_ON_HOST_FLG_SHIFT 5
659fb1a22beSKalderon, Michal #define RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG_MASK     0x1
660fb1a22beSKalderon, Michal #define RDMA_SQ_RDMA_WQE_1ST_READ_INV_FLG_SHIFT    6
661fb1a22beSKalderon, Michal #define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_MASK        0x1
662fb1a22beSKalderon, Michal #define RDMA_SQ_RDMA_WQE_1ST_RESERVED0_SHIFT       7
663afa0e13bSRam Amrani 	u8 wqe_size;
664afa0e13bSRam Amrani 	u8 prev_wqe_size;
665afa0e13bSRam Amrani };
666afa0e13bSRam Amrani 
667afa0e13bSRam Amrani /* Second element (16 bytes) of rdma wqe */
668afa0e13bSRam Amrani struct rdma_sq_rdma_wqe_2nd {
669afa0e13bSRam Amrani 	struct regpair remote_va;
670afa0e13bSRam Amrani 	__le32 r_key;
671afa0e13bSRam Amrani 	u8 dif_flags;
672afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_DIF_BLOCK_SIZE_MASK         0x1
673afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_DIF_BLOCK_SIZE_SHIFT        0
674afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_DIF_FIRST_SEGMENT_FLG_MASK  0x1
675afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_DIF_FIRST_SEGMENT_FLG_SHIFT 1
676afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_DIF_LAST_SEGMENT_FLG_MASK   0x1
677afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_DIF_LAST_SEGMENT_FLG_SHIFT  2
678afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_RESERVED1_MASK              0x1F
679afa0e13bSRam Amrani #define RDMA_SQ_RDMA_WQE_2ND_RESERVED1_SHIFT             3
680afa0e13bSRam Amrani 	u8 reserved2[3];
681afa0e13bSRam Amrani };
682afa0e13bSRam Amrani 
683afa0e13bSRam Amrani /* SQ WQE req type enumeration */
684afa0e13bSRam Amrani enum rdma_sq_req_type {
685afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_SEND,
686afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_SEND_WITH_IMM,
687afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_SEND_WITH_INVALIDATE,
688afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_RDMA_WR,
689afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_RDMA_WR_WITH_IMM,
690afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_RDMA_RD,
691afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_ATOMIC_CMP_AND_SWAP,
692afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_ATOMIC_ADD,
693afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_LOCAL_INVALIDATE,
694afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_FAST_MR,
695afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_BIND,
696afa0e13bSRam Amrani 	RDMA_SQ_REQ_TYPE_INVALID,
697afa0e13bSRam Amrani 	MAX_RDMA_SQ_REQ_TYPE
698afa0e13bSRam Amrani };
699afa0e13bSRam Amrani 
700afa0e13bSRam Amrani struct rdma_sq_send_wqe {
701afa0e13bSRam Amrani 	__le32 inv_key_or_imm_data;
702afa0e13bSRam Amrani 	__le32 length;
703afa0e13bSRam Amrani 	__le32 xrc_srq;
704afa0e13bSRam Amrani 	u8 req_type;
705afa0e13bSRam Amrani 	u8 flags;
706afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_COMP_FLG_MASK         0x1
707afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_COMP_FLG_SHIFT        0
708afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_RD_FENCE_FLG_MASK     0x1
709afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_RD_FENCE_FLG_SHIFT    1
710afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_INV_FENCE_FLG_MASK    0x1
711afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_INV_FENCE_FLG_SHIFT   2
712afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_SE_FLG_MASK           0x1
713afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_SE_FLG_SHIFT          3
714afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_INLINE_FLG_MASK       0x1
715afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_INLINE_FLG_SHIFT      4
716afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_DIF_ON_HOST_FLG_MASK  0x1
717afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_DIF_ON_HOST_FLG_SHIFT 5
718afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_RESERVED0_MASK        0x3
719afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_RESERVED0_SHIFT       6
720afa0e13bSRam Amrani 	u8 wqe_size;
721afa0e13bSRam Amrani 	u8 prev_wqe_size;
722afa0e13bSRam Amrani 	__le32 reserved1[4];
723afa0e13bSRam Amrani };
724afa0e13bSRam Amrani 
725afa0e13bSRam Amrani struct rdma_sq_send_wqe_1st {
726afa0e13bSRam Amrani 	__le32 inv_key_or_imm_data;
727afa0e13bSRam Amrani 	__le32 length;
728afa0e13bSRam Amrani 	__le32 xrc_srq;
729afa0e13bSRam Amrani 	u8 req_type;
730afa0e13bSRam Amrani 	u8 flags;
731afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_COMP_FLG_MASK       0x1
732afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_COMP_FLG_SHIFT      0
733afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_RD_FENCE_FLG_MASK   0x1
734afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_RD_FENCE_FLG_SHIFT  1
735afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_INV_FENCE_FLG_MASK  0x1
736afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_INV_FENCE_FLG_SHIFT 2
737afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_SE_FLG_MASK         0x1
738afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_SE_FLG_SHIFT        3
739afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_INLINE_FLG_MASK     0x1
740afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_INLINE_FLG_SHIFT    4
741afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_RESERVED0_MASK      0x7
742afa0e13bSRam Amrani #define RDMA_SQ_SEND_WQE_1ST_RESERVED0_SHIFT     5
743afa0e13bSRam Amrani 	u8 wqe_size;
744afa0e13bSRam Amrani 	u8 prev_wqe_size;
745afa0e13bSRam Amrani };
746afa0e13bSRam Amrani 
747afa0e13bSRam Amrani struct rdma_sq_send_wqe_2st {
748afa0e13bSRam Amrani 	__le32 reserved1[4];
749afa0e13bSRam Amrani };
750afa0e13bSRam Amrani 
751ec72fce4SRam Amrani #endif /* __QED_HSI_RDMA__ */
752