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