xref: /freebsd/sys/dev/qlnx/qlnxr/qlnxr_roce.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
1*fa790ea9SDavid C Somayajulu /*
2*fa790ea9SDavid C Somayajulu  * Copyright (c) 2018-2019 Cavium, Inc.
3*fa790ea9SDavid C Somayajulu  * All rights reserved.
4*fa790ea9SDavid C Somayajulu  *
5*fa790ea9SDavid C Somayajulu  *  Redistribution and use in source and binary forms, with or without
6*fa790ea9SDavid C Somayajulu  *  modification, are permitted provided that the following conditions
7*fa790ea9SDavid C Somayajulu  *  are met:
8*fa790ea9SDavid C Somayajulu  *
9*fa790ea9SDavid C Somayajulu  *  1. Redistributions of source code must retain the above copyright
10*fa790ea9SDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer.
11*fa790ea9SDavid C Somayajulu  *  2. Redistributions in binary form must reproduce the above copyright
12*fa790ea9SDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer in the
13*fa790ea9SDavid C Somayajulu  *     documentation and/or other materials provided with the distribution.
14*fa790ea9SDavid C Somayajulu  *
15*fa790ea9SDavid C Somayajulu  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16*fa790ea9SDavid C Somayajulu  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17*fa790ea9SDavid C Somayajulu  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18*fa790ea9SDavid C Somayajulu  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19*fa790ea9SDavid C Somayajulu  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20*fa790ea9SDavid C Somayajulu  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21*fa790ea9SDavid C Somayajulu  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22*fa790ea9SDavid C Somayajulu  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23*fa790ea9SDavid C Somayajulu  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24*fa790ea9SDavid C Somayajulu  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25*fa790ea9SDavid C Somayajulu  *  POSSIBILITY OF SUCH DAMAGE.
26*fa790ea9SDavid C Somayajulu  *
27*fa790ea9SDavid C Somayajulu  */
28*fa790ea9SDavid C Somayajulu 
29*fa790ea9SDavid C Somayajulu #ifndef __QLNXR_ROCE_H__
30*fa790ea9SDavid C Somayajulu #define __QLNXR_ROCE_H__
31*fa790ea9SDavid C Somayajulu 
32*fa790ea9SDavid C Somayajulu /*
33*fa790ea9SDavid C Somayajulu  * roce completion notification queue element
34*fa790ea9SDavid C Somayajulu  */
35*fa790ea9SDavid C Somayajulu struct roce_cnqe {
36*fa790ea9SDavid C Somayajulu 	struct regpair cq_handle;
37*fa790ea9SDavid C Somayajulu };
38*fa790ea9SDavid C Somayajulu 
39*fa790ea9SDavid C Somayajulu struct roce_cqe_responder {
40*fa790ea9SDavid C Somayajulu 	struct regpair srq_wr_id;
41*fa790ea9SDavid C Somayajulu 	struct regpair qp_handle;
42*fa790ea9SDavid C Somayajulu 	__le32 imm_data_or_inv_r_Key;
43*fa790ea9SDavid C Somayajulu 	__le32 length;
44*fa790ea9SDavid C Somayajulu 	__le32 reserved0;
45*fa790ea9SDavid C Somayajulu 	__le16 rq_cons;
46*fa790ea9SDavid C Somayajulu 	u8 flags;
47*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_TOGGLE_BIT_MASK  0x1
48*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_TOGGLE_BIT_SHIFT 0
49*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_TYPE_MASK        0x3
50*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_TYPE_SHIFT       1
51*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_INV_FLG_MASK     0x1
52*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_INV_FLG_SHIFT    3
53*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_IMM_FLG_MASK     0x1
54*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_IMM_FLG_SHIFT    4
55*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_RDMA_FLG_MASK    0x1
56*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_RDMA_FLG_SHIFT   5
57*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_RESERVED2_MASK   0x3
58*fa790ea9SDavid C Somayajulu #define ROCE_CQE_RESPONDER_RESERVED2_SHIFT  6
59*fa790ea9SDavid C Somayajulu 	u8 status;
60*fa790ea9SDavid C Somayajulu };
61*fa790ea9SDavid C Somayajulu 
62*fa790ea9SDavid C Somayajulu struct roce_cqe_requester {
63*fa790ea9SDavid C Somayajulu 	__le16 sq_cons;
64*fa790ea9SDavid C Somayajulu 	__le16 reserved0;
65*fa790ea9SDavid C Somayajulu 	__le32 reserved1;
66*fa790ea9SDavid C Somayajulu 	struct regpair qp_handle;
67*fa790ea9SDavid C Somayajulu 	struct regpair reserved2;
68*fa790ea9SDavid C Somayajulu 	__le32 reserved3;
69*fa790ea9SDavid C Somayajulu 	__le16 reserved4;
70*fa790ea9SDavid C Somayajulu 	u8 flags;
71*fa790ea9SDavid C Somayajulu #define ROCE_CQE_REQUESTER_TOGGLE_BIT_MASK  0x1
72*fa790ea9SDavid C Somayajulu #define ROCE_CQE_REQUESTER_TOGGLE_BIT_SHIFT 0
73*fa790ea9SDavid C Somayajulu #define ROCE_CQE_REQUESTER_TYPE_MASK        0x3
74*fa790ea9SDavid C Somayajulu #define ROCE_CQE_REQUESTER_TYPE_SHIFT       1
75*fa790ea9SDavid C Somayajulu #define ROCE_CQE_REQUESTER_RESERVED5_MASK   0x1F
76*fa790ea9SDavid C Somayajulu #define ROCE_CQE_REQUESTER_RESERVED5_SHIFT  3
77*fa790ea9SDavid C Somayajulu 	u8 status;
78*fa790ea9SDavid C Somayajulu };
79*fa790ea9SDavid C Somayajulu 
80*fa790ea9SDavid C Somayajulu struct roce_cqe_common {
81*fa790ea9SDavid C Somayajulu 	struct regpair reserved0;
82*fa790ea9SDavid C Somayajulu 	struct regpair qp_handle;
83*fa790ea9SDavid C Somayajulu 	__le16 reserved1[7];
84*fa790ea9SDavid C Somayajulu 	u8 flags;
85*fa790ea9SDavid C Somayajulu #define ROCE_CQE_COMMON_TOGGLE_BIT_MASK  0x1
86*fa790ea9SDavid C Somayajulu #define ROCE_CQE_COMMON_TOGGLE_BIT_SHIFT 0
87*fa790ea9SDavid C Somayajulu #define ROCE_CQE_COMMON_TYPE_MASK        0x3
88*fa790ea9SDavid C Somayajulu #define ROCE_CQE_COMMON_TYPE_SHIFT       1
89*fa790ea9SDavid C Somayajulu #define ROCE_CQE_COMMON_RESERVED2_MASK   0x1F
90*fa790ea9SDavid C Somayajulu #define ROCE_CQE_COMMON_RESERVED2_SHIFT  3
91*fa790ea9SDavid C Somayajulu 	u8 status;
92*fa790ea9SDavid C Somayajulu };
93*fa790ea9SDavid C Somayajulu 
94*fa790ea9SDavid C Somayajulu /*
95*fa790ea9SDavid C Somayajulu  * roce completion queue element
96*fa790ea9SDavid C Somayajulu  */
97*fa790ea9SDavid C Somayajulu union roce_cqe {
98*fa790ea9SDavid C Somayajulu 	struct roce_cqe_responder resp;
99*fa790ea9SDavid C Somayajulu 	struct roce_cqe_requester req;
100*fa790ea9SDavid C Somayajulu 	struct roce_cqe_common cmn;
101*fa790ea9SDavid C Somayajulu };
102*fa790ea9SDavid C Somayajulu 
103*fa790ea9SDavid C Somayajulu /*
104*fa790ea9SDavid C Somayajulu  * CQE requester status enumeration
105*fa790ea9SDavid C Somayajulu  */
106*fa790ea9SDavid C Somayajulu enum roce_cqe_requester_status_enum {
107*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_OK,
108*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_BAD_RESPONSE_ERR,
109*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_LOCAL_LENGTH_ERR,
110*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_LOCAL_QP_OPERATION_ERR,
111*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_LOCAL_PROTECTION_ERR,
112*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_MEMORY_MGT_OPERATION_ERR,
113*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_REMOTE_INVALID_REQUEST_ERR,
114*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_REMOTE_ACCESS_ERR,
115*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_REMOTE_OPERATION_ERR,
116*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_RNR_NAK_RETRY_CNT_ERR,
117*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_TRANSPORT_RETRY_CNT_ERR,
118*fa790ea9SDavid C Somayajulu 	ROCE_CQE_REQ_STS_WORK_REQUEST_FLUSHED_ERR,
119*fa790ea9SDavid C Somayajulu 	MAX_ROCE_CQE_REQUESTER_STATUS_ENUM
120*fa790ea9SDavid C Somayajulu };
121*fa790ea9SDavid C Somayajulu 
122*fa790ea9SDavid C Somayajulu /*
123*fa790ea9SDavid C Somayajulu  * CQE responder status enumeration
124*fa790ea9SDavid C Somayajulu  */
125*fa790ea9SDavid C Somayajulu enum roce_cqe_responder_status_enum {
126*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_OK,
127*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_LOCAL_ACCESS_ERR,
128*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_LOCAL_LENGTH_ERR,
129*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_LOCAL_QP_OPERATION_ERR,
130*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_LOCAL_PROTECTION_ERR,
131*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_MEMORY_MGT_OPERATION_ERR,
132*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_REMOTE_INVALID_REQUEST_ERR,
133*fa790ea9SDavid C Somayajulu 	ROCE_CQE_RESP_STS_WORK_REQUEST_FLUSHED_ERR,
134*fa790ea9SDavid C Somayajulu 	MAX_ROCE_CQE_RESPONDER_STATUS_ENUM
135*fa790ea9SDavid C Somayajulu };
136*fa790ea9SDavid C Somayajulu 
137*fa790ea9SDavid C Somayajulu /*
138*fa790ea9SDavid C Somayajulu  * CQE type enumeration
139*fa790ea9SDavid C Somayajulu  */
140*fa790ea9SDavid C Somayajulu enum roce_cqe_type {
141*fa790ea9SDavid C Somayajulu 	ROCE_CQE_TYPE_REQUESTER,
142*fa790ea9SDavid C Somayajulu 	ROCE_CQE_TYPE_RESPONDER_RQ,
143*fa790ea9SDavid C Somayajulu 	ROCE_CQE_TYPE_RESPONDER_SRQ,
144*fa790ea9SDavid C Somayajulu 	ROCE_CQE_TYPE_INVALID,
145*fa790ea9SDavid C Somayajulu 	MAX_ROCE_CQE_TYPE
146*fa790ea9SDavid C Somayajulu };
147*fa790ea9SDavid C Somayajulu 
148*fa790ea9SDavid C Somayajulu /*
149*fa790ea9SDavid C Somayajulu  * memory window type enumeration
150*fa790ea9SDavid C Somayajulu  */
151*fa790ea9SDavid C Somayajulu enum roce_mw_type {
152*fa790ea9SDavid C Somayajulu 	ROCE_MW_TYPE_1,
153*fa790ea9SDavid C Somayajulu 	ROCE_MW_TYPE_2A,
154*fa790ea9SDavid C Somayajulu 	MAX_ROCE_MW_TYPE
155*fa790ea9SDavid C Somayajulu };
156*fa790ea9SDavid C Somayajulu 
157*fa790ea9SDavid C Somayajulu struct roce_rq_sge {
158*fa790ea9SDavid C Somayajulu 	struct regpair addr;
159*fa790ea9SDavid C Somayajulu 	__le32 length;
160*fa790ea9SDavid C Somayajulu 	__le32 flags;
161*fa790ea9SDavid C Somayajulu #define ROCE_RQ_SGE_L_KEY_MASK      0x3FFFFFF
162*fa790ea9SDavid C Somayajulu #define ROCE_RQ_SGE_L_KEY_SHIFT     0
163*fa790ea9SDavid C Somayajulu #define ROCE_RQ_SGE_NUM_SGES_MASK   0x7
164*fa790ea9SDavid C Somayajulu #define ROCE_RQ_SGE_NUM_SGES_SHIFT  26
165*fa790ea9SDavid C Somayajulu #define ROCE_RQ_SGE_RESERVED0_MASK  0x7
166*fa790ea9SDavid C Somayajulu #define ROCE_RQ_SGE_RESERVED0_SHIFT 29
167*fa790ea9SDavid C Somayajulu };
168*fa790ea9SDavid C Somayajulu 
169*fa790ea9SDavid C Somayajulu struct roce_sq_atomic_wqe {
170*fa790ea9SDavid C Somayajulu 	struct regpair remote_va;
171*fa790ea9SDavid C Somayajulu 	__le32 xrc_srq;
172*fa790ea9SDavid C Somayajulu 	u8 req_type;
173*fa790ea9SDavid C Somayajulu 	u8 flags;
174*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_COMP_FLG_MASK       0x1
175*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_COMP_FLG_SHIFT      0
176*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_RD_FENCE_FLG_MASK   0x1
177*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_RD_FENCE_FLG_SHIFT  1
178*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_INV_FENCE_FLG_MASK  0x1
179*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_INV_FENCE_FLG_SHIFT 2
180*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_SE_FLG_MASK         0x1
181*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_SE_FLG_SHIFT        3
182*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_INLINE_FLG_MASK     0x1
183*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_INLINE_FLG_SHIFT    4
184*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_RESERVED0_MASK      0x7
185*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_RESERVED0_SHIFT     5
186*fa790ea9SDavid C Somayajulu 	u8 reserved1;
187*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
188*fa790ea9SDavid C Somayajulu 	struct regpair swap_data;
189*fa790ea9SDavid C Somayajulu 	__le32 r_key;
190*fa790ea9SDavid C Somayajulu 	__le32 reserved2;
191*fa790ea9SDavid C Somayajulu 	struct regpair cmp_data;
192*fa790ea9SDavid C Somayajulu 	struct regpair reserved3;
193*fa790ea9SDavid C Somayajulu };
194*fa790ea9SDavid C Somayajulu 
195*fa790ea9SDavid C Somayajulu /*
196*fa790ea9SDavid C Somayajulu  * First element (16 bytes) of atomic wqe
197*fa790ea9SDavid C Somayajulu  */
198*fa790ea9SDavid C Somayajulu struct roce_sq_atomic_wqe_1st {
199*fa790ea9SDavid C Somayajulu 	struct regpair remote_va;
200*fa790ea9SDavid C Somayajulu 	__le32 xrc_srq;
201*fa790ea9SDavid C Somayajulu 	u8 req_type;
202*fa790ea9SDavid C Somayajulu 	u8 flags;
203*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_COMP_FLG_MASK       0x1
204*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_COMP_FLG_SHIFT      0
205*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_RD_FENCE_FLG_MASK   0x1
206*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_RD_FENCE_FLG_SHIFT  1
207*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_INV_FENCE_FLG_MASK  0x1
208*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_INV_FENCE_FLG_SHIFT 2
209*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_SE_FLG_MASK         0x1
210*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_SE_FLG_SHIFT        3
211*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_INLINE_FLG_MASK     0x1
212*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_INLINE_FLG_SHIFT    4
213*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_RESERVED0_MASK      0x7
214*fa790ea9SDavid C Somayajulu #define ROCE_SQ_ATOMIC_WQE_1ST_RESERVED0_SHIFT     5
215*fa790ea9SDavid C Somayajulu 	u8 reserved1;
216*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
217*fa790ea9SDavid C Somayajulu };
218*fa790ea9SDavid C Somayajulu 
219*fa790ea9SDavid C Somayajulu /*
220*fa790ea9SDavid C Somayajulu  * Second element (16 bytes) of atomic wqe
221*fa790ea9SDavid C Somayajulu  */
222*fa790ea9SDavid C Somayajulu struct roce_sq_atomic_wqe_2nd {
223*fa790ea9SDavid C Somayajulu 	struct regpair swap_data;
224*fa790ea9SDavid C Somayajulu 	__le32 r_key;
225*fa790ea9SDavid C Somayajulu 	__le32 reserved2;
226*fa790ea9SDavid C Somayajulu };
227*fa790ea9SDavid C Somayajulu 
228*fa790ea9SDavid C Somayajulu /*
229*fa790ea9SDavid C Somayajulu  * Third element (16 bytes) of atomic wqe
230*fa790ea9SDavid C Somayajulu  */
231*fa790ea9SDavid C Somayajulu struct roce_sq_atomic_wqe_3rd {
232*fa790ea9SDavid C Somayajulu 	struct regpair cmp_data;
233*fa790ea9SDavid C Somayajulu 	struct regpair reserved3;
234*fa790ea9SDavid C Somayajulu };
235*fa790ea9SDavid C Somayajulu 
236*fa790ea9SDavid C Somayajulu struct roce_sq_bind_wqe {
237*fa790ea9SDavid C Somayajulu 	struct regpair addr;
238*fa790ea9SDavid C Somayajulu 	__le32 l_key;
239*fa790ea9SDavid C Somayajulu 	u8 req_type;
240*fa790ea9SDavid C Somayajulu 	u8 flags;
241*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_COMP_FLG_MASK       0x1
242*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_COMP_FLG_SHIFT      0
243*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RD_FENCE_FLG_MASK   0x1
244*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RD_FENCE_FLG_SHIFT  1
245*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_INV_FENCE_FLG_MASK  0x1
246*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_INV_FENCE_FLG_SHIFT 2
247*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_SE_FLG_MASK         0x1
248*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_SE_FLG_SHIFT        3
249*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_INLINE_FLG_MASK     0x1
250*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_INLINE_FLG_SHIFT    4
251*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RESERVED0_MASK      0x7
252*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RESERVED0_SHIFT     5
253*fa790ea9SDavid C Somayajulu 	u8 access_ctrl;
254*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_REMOTE_READ_MASK    0x1
255*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_REMOTE_READ_SHIFT   0
256*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_REMOTE_WRITE_MASK   0x1
257*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_REMOTE_WRITE_SHIFT  1
258*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_ENABLE_ATOMIC_MASK  0x1
259*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_ENABLE_ATOMIC_SHIFT 2
260*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_LOCAL_READ_MASK     0x1
261*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_LOCAL_READ_SHIFT    3
262*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_LOCAL_WRITE_MASK    0x1
263*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_LOCAL_WRITE_SHIFT   4
264*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RESERVED1_MASK      0x7
265*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RESERVED1_SHIFT     5
266*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
267*fa790ea9SDavid C Somayajulu 	u8 bind_ctrl;
268*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_ZERO_BASED_MASK     0x1
269*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_ZERO_BASED_SHIFT    0
270*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_MW_TYPE_MASK        0x1
271*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_MW_TYPE_SHIFT       1
272*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RESERVED2_MASK      0x3F
273*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_RESERVED2_SHIFT     2
274*fa790ea9SDavid C Somayajulu 	u8 reserved3[2];
275*fa790ea9SDavid C Somayajulu 	u8 length_hi;
276*fa790ea9SDavid C Somayajulu 	__le32 length_lo;
277*fa790ea9SDavid C Somayajulu 	__le32 parent_l_key;
278*fa790ea9SDavid C Somayajulu 	__le32 reserved6;
279*fa790ea9SDavid C Somayajulu };
280*fa790ea9SDavid C Somayajulu 
281*fa790ea9SDavid C Somayajulu /*
282*fa790ea9SDavid C Somayajulu  * First element (16 bytes) of bind wqe
283*fa790ea9SDavid C Somayajulu  */
284*fa790ea9SDavid C Somayajulu struct roce_sq_bind_wqe_1st {
285*fa790ea9SDavid C Somayajulu 	struct regpair addr;
286*fa790ea9SDavid C Somayajulu 	__le32 l_key;
287*fa790ea9SDavid C Somayajulu 	u8 req_type;
288*fa790ea9SDavid C Somayajulu 	u8 flags;
289*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_COMP_FLG_MASK       0x1
290*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_COMP_FLG_SHIFT      0
291*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_RD_FENCE_FLG_MASK   0x1
292*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_RD_FENCE_FLG_SHIFT  1
293*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_INV_FENCE_FLG_MASK  0x1
294*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_INV_FENCE_FLG_SHIFT 2
295*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_SE_FLG_MASK         0x1
296*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_SE_FLG_SHIFT        3
297*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_INLINE_FLG_MASK     0x1
298*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_INLINE_FLG_SHIFT    4
299*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_RESERVED0_MASK      0x7
300*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_RESERVED0_SHIFT     5
301*fa790ea9SDavid C Somayajulu 	u8 access_ctrl;
302*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_REMOTE_READ_MASK    0x1
303*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_REMOTE_READ_SHIFT   0
304*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_REMOTE_WRITE_MASK   0x1
305*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_REMOTE_WRITE_SHIFT  1
306*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_ENABLE_ATOMIC_MASK  0x1
307*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_ENABLE_ATOMIC_SHIFT 2
308*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_LOCAL_READ_MASK     0x1
309*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_LOCAL_READ_SHIFT    3
310*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_LOCAL_WRITE_MASK    0x1
311*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_LOCAL_WRITE_SHIFT   4
312*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_RESERVED1_MASK      0x7
313*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_1ST_RESERVED1_SHIFT     5
314*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
315*fa790ea9SDavid C Somayajulu };
316*fa790ea9SDavid C Somayajulu 
317*fa790ea9SDavid C Somayajulu /*
318*fa790ea9SDavid C Somayajulu  * Second element (16 bytes) of bind wqe
319*fa790ea9SDavid C Somayajulu  */
320*fa790ea9SDavid C Somayajulu struct roce_sq_bind_wqe_2nd {
321*fa790ea9SDavid C Somayajulu 	u8 bind_ctrl;
322*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_2ND_ZERO_BASED_MASK  0x1
323*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_2ND_ZERO_BASED_SHIFT 0
324*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_2ND_MW_TYPE_MASK     0x1
325*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_2ND_MW_TYPE_SHIFT    1
326*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_2ND_RESERVED2_MASK   0x3F
327*fa790ea9SDavid C Somayajulu #define ROCE_SQ_BIND_WQE_2ND_RESERVED2_SHIFT  2
328*fa790ea9SDavid C Somayajulu 	u8 reserved3[2];
329*fa790ea9SDavid C Somayajulu 	u8 length_hi;
330*fa790ea9SDavid C Somayajulu 	__le32 length_lo;
331*fa790ea9SDavid C Somayajulu 	__le32 parent_l_key;
332*fa790ea9SDavid C Somayajulu 	__le32 reserved6;
333*fa790ea9SDavid C Somayajulu };
334*fa790ea9SDavid C Somayajulu 
335*fa790ea9SDavid C Somayajulu /*
336*fa790ea9SDavid C Somayajulu  * Structure with only the SQ WQE common fields. Size is of one SQ element (16B)
337*fa790ea9SDavid C Somayajulu  */
338*fa790ea9SDavid C Somayajulu struct roce_sq_common_wqe {
339*fa790ea9SDavid C Somayajulu 	__le32 reserved1[3];
340*fa790ea9SDavid C Somayajulu 	u8 req_type;
341*fa790ea9SDavid C Somayajulu 	u8 flags;
342*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_COMP_FLG_MASK       0x1
343*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_COMP_FLG_SHIFT      0
344*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_RD_FENCE_FLG_MASK   0x1
345*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_RD_FENCE_FLG_SHIFT  1
346*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_INV_FENCE_FLG_MASK  0x1
347*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_INV_FENCE_FLG_SHIFT 2
348*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_SE_FLG_MASK         0x1
349*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_SE_FLG_SHIFT        3
350*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_INLINE_FLG_MASK     0x1
351*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_INLINE_FLG_SHIFT    4
352*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_RESERVED0_MASK      0x7
353*fa790ea9SDavid C Somayajulu #define ROCE_SQ_COMMON_WQE_RESERVED0_SHIFT     5
354*fa790ea9SDavid C Somayajulu 	u8 reserved2;
355*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
356*fa790ea9SDavid C Somayajulu };
357*fa790ea9SDavid C Somayajulu 
358*fa790ea9SDavid C Somayajulu struct roce_sq_fmr_wqe {
359*fa790ea9SDavid C Somayajulu 	struct regpair addr;
360*fa790ea9SDavid C Somayajulu 	__le32 l_key;
361*fa790ea9SDavid C Somayajulu 	u8 req_type;
362*fa790ea9SDavid C Somayajulu 	u8 flags;
363*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_COMP_FLG_MASK       0x1
364*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_COMP_FLG_SHIFT      0
365*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RD_FENCE_FLG_MASK   0x1
366*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RD_FENCE_FLG_SHIFT  1
367*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_INV_FENCE_FLG_MASK  0x1
368*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_INV_FENCE_FLG_SHIFT 2
369*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_SE_FLG_MASK         0x1
370*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_SE_FLG_SHIFT        3
371*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_INLINE_FLG_MASK     0x1
372*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_INLINE_FLG_SHIFT    4
373*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RESERVED0_MASK      0x7
374*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RESERVED0_SHIFT     5
375*fa790ea9SDavid C Somayajulu 	u8 access_ctrl;
376*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_REMOTE_READ_MASK    0x1
377*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_REMOTE_READ_SHIFT   0
378*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_REMOTE_WRITE_MASK   0x1
379*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_REMOTE_WRITE_SHIFT  1
380*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_ENABLE_ATOMIC_MASK  0x1
381*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_ENABLE_ATOMIC_SHIFT 2
382*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_LOCAL_READ_MASK     0x1
383*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_LOCAL_READ_SHIFT    3
384*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_LOCAL_WRITE_MASK    0x1
385*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_LOCAL_WRITE_SHIFT   4
386*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RESERVED1_MASK      0x7
387*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RESERVED1_SHIFT     5
388*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
389*fa790ea9SDavid C Somayajulu 	u8 fmr_ctrl;
390*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_PAGE_SIZE_LOG_MASK  0x1F
391*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_PAGE_SIZE_LOG_SHIFT 0
392*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_ZERO_BASED_MASK     0x1
393*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_ZERO_BASED_SHIFT    5
394*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_BIND_EN_MASK        0x1
395*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_BIND_EN_SHIFT       6
396*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RESERVED2_MASK      0x1
397*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_RESERVED2_SHIFT     7
398*fa790ea9SDavid C Somayajulu 	u8 reserved3[2];
399*fa790ea9SDavid C Somayajulu 	u8 length_hi;
400*fa790ea9SDavid C Somayajulu 	__le32 length_lo;
401*fa790ea9SDavid C Somayajulu 	struct regpair pbl_addr;
402*fa790ea9SDavid C Somayajulu };
403*fa790ea9SDavid C Somayajulu 
404*fa790ea9SDavid C Somayajulu /*
405*fa790ea9SDavid C Somayajulu  * First element (16 bytes) of fmr wqe
406*fa790ea9SDavid C Somayajulu  */
407*fa790ea9SDavid C Somayajulu struct roce_sq_fmr_wqe_1st {
408*fa790ea9SDavid C Somayajulu 	struct regpair addr;
409*fa790ea9SDavid C Somayajulu 	__le32 l_key;
410*fa790ea9SDavid C Somayajulu 	u8 req_type;
411*fa790ea9SDavid C Somayajulu 	u8 flags;
412*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_COMP_FLG_MASK       0x1
413*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_COMP_FLG_SHIFT      0
414*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_RD_FENCE_FLG_MASK   0x1
415*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_RD_FENCE_FLG_SHIFT  1
416*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_INV_FENCE_FLG_MASK  0x1
417*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_INV_FENCE_FLG_SHIFT 2
418*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_SE_FLG_MASK         0x1
419*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_SE_FLG_SHIFT        3
420*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_INLINE_FLG_MASK     0x1
421*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_INLINE_FLG_SHIFT    4
422*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_RESERVED0_MASK      0x7
423*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_RESERVED0_SHIFT     5
424*fa790ea9SDavid C Somayajulu 	u8 access_ctrl;
425*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_REMOTE_READ_MASK    0x1
426*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_REMOTE_READ_SHIFT   0
427*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_REMOTE_WRITE_MASK   0x1
428*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_REMOTE_WRITE_SHIFT  1
429*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_ENABLE_ATOMIC_MASK  0x1
430*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_ENABLE_ATOMIC_SHIFT 2
431*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_LOCAL_READ_MASK     0x1
432*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_LOCAL_READ_SHIFT    3
433*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_LOCAL_WRITE_MASK    0x1
434*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_LOCAL_WRITE_SHIFT   4
435*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_RESERVED1_MASK      0x7
436*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_1ST_RESERVED1_SHIFT     5
437*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
438*fa790ea9SDavid C Somayajulu };
439*fa790ea9SDavid C Somayajulu 
440*fa790ea9SDavid C Somayajulu /*
441*fa790ea9SDavid C Somayajulu  * Second element (16 bytes) of fmr wqe
442*fa790ea9SDavid C Somayajulu  */
443*fa790ea9SDavid C Somayajulu struct roce_sq_fmr_wqe_2nd {
444*fa790ea9SDavid C Somayajulu 	u8 fmr_ctrl;
445*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_PAGE_SIZE_LOG_MASK  0x1F
446*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_PAGE_SIZE_LOG_SHIFT 0
447*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_ZERO_BASED_MASK     0x1
448*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_ZERO_BASED_SHIFT    5
449*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_BIND_EN_MASK        0x1
450*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_BIND_EN_SHIFT       6
451*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_RESERVED2_MASK      0x1
452*fa790ea9SDavid C Somayajulu #define ROCE_SQ_FMR_WQE_2ND_RESERVED2_SHIFT     7
453*fa790ea9SDavid C Somayajulu 	u8 reserved3[2];
454*fa790ea9SDavid C Somayajulu 	u8 length_hi;
455*fa790ea9SDavid C Somayajulu 	__le32 length_lo;
456*fa790ea9SDavid C Somayajulu 	struct regpair pbl_addr;
457*fa790ea9SDavid C Somayajulu };
458*fa790ea9SDavid C Somayajulu 
459*fa790ea9SDavid C Somayajulu struct roce_sq_local_inv_wqe {
460*fa790ea9SDavid C Somayajulu 	struct regpair reserved;
461*fa790ea9SDavid C Somayajulu 	__le32 inv_l_key;
462*fa790ea9SDavid C Somayajulu 	u8 req_type;
463*fa790ea9SDavid C Somayajulu 	u8 flags;
464*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_COMP_FLG_MASK       0x1
465*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_COMP_FLG_SHIFT      0
466*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_RD_FENCE_FLG_MASK   0x1
467*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_RD_FENCE_FLG_SHIFT  1
468*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_INV_FENCE_FLG_MASK  0x1
469*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_INV_FENCE_FLG_SHIFT 2
470*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_SE_FLG_MASK         0x1
471*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_SE_FLG_SHIFT        3
472*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_INLINE_FLG_MASK     0x1
473*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_INLINE_FLG_SHIFT    4
474*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_RESERVED0_MASK      0x7
475*fa790ea9SDavid C Somayajulu #define ROCE_SQ_LOCAL_INV_WQE_RESERVED0_SHIFT     5
476*fa790ea9SDavid C Somayajulu 	u8 reserved1;
477*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
478*fa790ea9SDavid C Somayajulu };
479*fa790ea9SDavid C Somayajulu 
480*fa790ea9SDavid C Somayajulu struct roce_sq_rdma_wqe {
481*fa790ea9SDavid C Somayajulu 	__le32 imm_data;
482*fa790ea9SDavid C Somayajulu 	__le32 length;
483*fa790ea9SDavid C Somayajulu 	__le32 xrc_srq;
484*fa790ea9SDavid C Somayajulu 	u8 req_type;
485*fa790ea9SDavid C Somayajulu 	u8 flags;
486*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_COMP_FLG_MASK       0x1
487*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_COMP_FLG_SHIFT      0
488*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_RD_FENCE_FLG_MASK   0x1
489*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_RD_FENCE_FLG_SHIFT  1
490*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_INV_FENCE_FLG_MASK  0x1
491*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_INV_FENCE_FLG_SHIFT 2
492*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_SE_FLG_MASK         0x1
493*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_SE_FLG_SHIFT        3
494*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_INLINE_FLG_MASK     0x1
495*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_INLINE_FLG_SHIFT    4
496*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_RESERVED0_MASK      0x7
497*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_RESERVED0_SHIFT     5
498*fa790ea9SDavid C Somayajulu 	u8 wqe_size;
499*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
500*fa790ea9SDavid C Somayajulu 	struct regpair remote_va;
501*fa790ea9SDavid C Somayajulu 	__le32 r_key;
502*fa790ea9SDavid C Somayajulu 	__le32 reserved1;
503*fa790ea9SDavid C Somayajulu };
504*fa790ea9SDavid C Somayajulu 
505*fa790ea9SDavid C Somayajulu /*
506*fa790ea9SDavid C Somayajulu  * First element (16 bytes) of rdma wqe
507*fa790ea9SDavid C Somayajulu  */
508*fa790ea9SDavid C Somayajulu struct roce_sq_rdma_wqe_1st {
509*fa790ea9SDavid C Somayajulu 	__le32 imm_data;
510*fa790ea9SDavid C Somayajulu 	__le32 length;
511*fa790ea9SDavid C Somayajulu 	__le32 xrc_srq;
512*fa790ea9SDavid C Somayajulu 	u8 req_type;
513*fa790ea9SDavid C Somayajulu 	u8 flags;
514*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_COMP_FLG_MASK       0x1
515*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_COMP_FLG_SHIFT      0
516*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_RD_FENCE_FLG_MASK   0x1
517*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_RD_FENCE_FLG_SHIFT  1
518*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_INV_FENCE_FLG_MASK  0x1
519*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_INV_FENCE_FLG_SHIFT 2
520*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_SE_FLG_MASK         0x1
521*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_SE_FLG_SHIFT        3
522*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_INLINE_FLG_MASK     0x1
523*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_INLINE_FLG_SHIFT    4
524*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_RESERVED0_MASK      0x7
525*fa790ea9SDavid C Somayajulu #define ROCE_SQ_RDMA_WQE_1ST_RESERVED0_SHIFT     5
526*fa790ea9SDavid C Somayajulu 	u8 wqe_size;
527*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
528*fa790ea9SDavid C Somayajulu };
529*fa790ea9SDavid C Somayajulu 
530*fa790ea9SDavid C Somayajulu /*
531*fa790ea9SDavid C Somayajulu  * Second element (16 bytes) of rdma wqe
532*fa790ea9SDavid C Somayajulu  */
533*fa790ea9SDavid C Somayajulu struct roce_sq_rdma_wqe_2nd {
534*fa790ea9SDavid C Somayajulu 	struct regpair remote_va;
535*fa790ea9SDavid C Somayajulu 	__le32 r_key;
536*fa790ea9SDavid C Somayajulu 	__le32 reserved1;
537*fa790ea9SDavid C Somayajulu };
538*fa790ea9SDavid C Somayajulu 
539*fa790ea9SDavid C Somayajulu /*
540*fa790ea9SDavid C Somayajulu  * SQ WQE req type enumeration
541*fa790ea9SDavid C Somayajulu  */
542*fa790ea9SDavid C Somayajulu enum roce_sq_req_type {
543*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_SEND,
544*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_SEND_WITH_IMM,
545*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_SEND_WITH_INVALIDATE,
546*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_RDMA_WR,
547*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_RDMA_WR_WITH_IMM,
548*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_RDMA_RD,
549*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_ATOMIC_CMP_AND_SWAP,
550*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_ATOMIC_ADD,
551*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_LOCAL_INVALIDATE,
552*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_FAST_MR,
553*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_BIND,
554*fa790ea9SDavid C Somayajulu 	ROCE_SQ_REQ_TYPE_INVALID,
555*fa790ea9SDavid C Somayajulu 	MAX_ROCE_SQ_REQ_TYPE
556*fa790ea9SDavid C Somayajulu };
557*fa790ea9SDavid C Somayajulu 
558*fa790ea9SDavid C Somayajulu struct roce_sq_send_wqe {
559*fa790ea9SDavid C Somayajulu 	__le32 inv_key_or_imm_data;
560*fa790ea9SDavid C Somayajulu 	__le32 length;
561*fa790ea9SDavid C Somayajulu 	__le32 xrc_srq;
562*fa790ea9SDavid C Somayajulu 	u8 req_type;
563*fa790ea9SDavid C Somayajulu 	u8 flags;
564*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_COMP_FLG_MASK       0x1
565*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_COMP_FLG_SHIFT      0
566*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_RD_FENCE_FLG_MASK   0x1
567*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_RD_FENCE_FLG_SHIFT  1
568*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_INV_FENCE_FLG_MASK  0x1
569*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_INV_FENCE_FLG_SHIFT 2
570*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_SE_FLG_MASK         0x1
571*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_SE_FLG_SHIFT        3
572*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_INLINE_FLG_MASK     0x1
573*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_INLINE_FLG_SHIFT    4
574*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_RESERVED0_MASK      0x7
575*fa790ea9SDavid C Somayajulu #define ROCE_SQ_SEND_WQE_RESERVED0_SHIFT     5
576*fa790ea9SDavid C Somayajulu 	u8 wqe_size;
577*fa790ea9SDavid C Somayajulu 	u8 prev_wqe_size;
578*fa790ea9SDavid C Somayajulu };
579*fa790ea9SDavid C Somayajulu 
580*fa790ea9SDavid C Somayajulu struct roce_sq_sge {
581*fa790ea9SDavid C Somayajulu 	__le32 length;
582*fa790ea9SDavid C Somayajulu 	struct regpair addr;
583*fa790ea9SDavid C Somayajulu 	__le32 l_key;
584*fa790ea9SDavid C Somayajulu };
585*fa790ea9SDavid C Somayajulu 
586*fa790ea9SDavid C Somayajulu struct roce_srq_prod {
587*fa790ea9SDavid C Somayajulu 	__le16 prod;
588*fa790ea9SDavid C Somayajulu };
589*fa790ea9SDavid C Somayajulu 
590*fa790ea9SDavid C Somayajulu struct roce_srq_sge {
591*fa790ea9SDavid C Somayajulu 	struct regpair addr;
592*fa790ea9SDavid C Somayajulu 	__le32 length;
593*fa790ea9SDavid C Somayajulu 	__le32 l_key;
594*fa790ea9SDavid C Somayajulu 	struct regpair wr_id;
595*fa790ea9SDavid C Somayajulu 	u8 flags;
596*fa790ea9SDavid C Somayajulu #define ROCE_SRQ_SGE_NUM_SGES_MASK   0x3
597*fa790ea9SDavid C Somayajulu #define ROCE_SRQ_SGE_NUM_SGES_SHIFT  0
598*fa790ea9SDavid C Somayajulu #define ROCE_SRQ_SGE_RESERVED0_MASK  0x3F
599*fa790ea9SDavid C Somayajulu #define ROCE_SRQ_SGE_RESERVED0_SHIFT 2
600*fa790ea9SDavid C Somayajulu 	u8 reserved1;
601*fa790ea9SDavid C Somayajulu 	__le16 reserved2;
602*fa790ea9SDavid C Somayajulu 	__le32 reserved3;
603*fa790ea9SDavid C Somayajulu };
604*fa790ea9SDavid C Somayajulu 
605*fa790ea9SDavid C Somayajulu /*
606*fa790ea9SDavid C Somayajulu  * RoCE doorbell data for SQ and RQ
607*fa790ea9SDavid C Somayajulu  */
608*fa790ea9SDavid C Somayajulu struct roce_pwm_val16_data {
609*fa790ea9SDavid C Somayajulu 	__le16 icid;
610*fa790ea9SDavid C Somayajulu 	__le16 prod_val;
611*fa790ea9SDavid C Somayajulu };
612*fa790ea9SDavid C Somayajulu 
613*fa790ea9SDavid C Somayajulu union roce_pwm_val16_data_union {
614*fa790ea9SDavid C Somayajulu 	struct roce_pwm_val16_data as_struct;
615*fa790ea9SDavid C Somayajulu 	__le32 as_dword;
616*fa790ea9SDavid C Somayajulu };
617*fa790ea9SDavid C Somayajulu 
618*fa790ea9SDavid C Somayajulu /*
619*fa790ea9SDavid C Somayajulu  * RoCE doorbell data for CQ
620*fa790ea9SDavid C Somayajulu  */
621*fa790ea9SDavid C Somayajulu struct roce_pwm_val32_data {
622*fa790ea9SDavid C Somayajulu 	__le16 icid;
623*fa790ea9SDavid C Somayajulu 	u8 agg_flags;
624*fa790ea9SDavid C Somayajulu 	u8 params;
625*fa790ea9SDavid C Somayajulu #define ROCE_PWM_VAL32_DATA_AGG_CMD_MASK    0x3
626*fa790ea9SDavid C Somayajulu #define ROCE_PWM_VAL32_DATA_AGG_CMD_SHIFT   0
627*fa790ea9SDavid C Somayajulu #define ROCE_PWM_VAL32_DATA_BYPASS_EN_MASK  0x1
628*fa790ea9SDavid C Somayajulu #define ROCE_PWM_VAL32_DATA_BYPASS_EN_SHIFT 2
629*fa790ea9SDavid C Somayajulu #define ROCE_PWM_VAL32_DATA_RESERVED_MASK   0x1F
630*fa790ea9SDavid C Somayajulu #define ROCE_PWM_VAL32_DATA_RESERVED_SHIFT  3
631*fa790ea9SDavid C Somayajulu 	__le32 cq_cons_val;
632*fa790ea9SDavid C Somayajulu };
633*fa790ea9SDavid C Somayajulu 
634*fa790ea9SDavid C Somayajulu union roce_pwm_val32_data_union {
635*fa790ea9SDavid C Somayajulu 	struct roce_pwm_val32_data as_struct;
636*fa790ea9SDavid C Somayajulu 	struct regpair as_repair;
637*fa790ea9SDavid C Somayajulu };
638*fa790ea9SDavid C Somayajulu 
639*fa790ea9SDavid C Somayajulu #endif /* __QLNXR_ROCE_H__ */
640