2 * Copyright (c) 2016 Hisilicon Limited.
4 * This software is available to you under a choice of one of two
5 * licenses. You may choose to be licensed under the terms of the GNU
6 * General Public License (GPL) Version 2, available from the file
7 * COPYING in the main directory of this source tree, or the
8 * OpenIB.org BSD license below:
10 * Redistribution and use in source and binary forms, with or
11 * without modification, are permitted provided that the following
14 * - Redistributions of source code must retain the above
15 * copyright notice, this list of conditions and the following
18 * - Redistributions in binary form must reproduce the above
19 * copyright notice, this list of conditions and the following
20 * disclaimer in the documentation and/or other materials
21 * provided with the distribution.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
27 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
28 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
29 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33 #ifndef _HNS_ROCE_HW_V1_H
34 #define _HNS_ROCE_HW_V1_H
36 #define CQ_STATE_VALID 2
38 #define HNS_ROCE_V1_MAX_PD_NUM 0x8000
39 #define HNS_ROCE_V1_MAX_CQ_NUM 0x10000
40 #define HNS_ROCE_V1_MAX_CQE_NUM 0x8000
42 #define HNS_ROCE_V1_MAX_QP_NUM 0x40000
43 #define HNS_ROCE_V1_MAX_WQE_NUM 0x4000
45 #define HNS_ROCE_V1_MAX_MTPT_NUM 0x80000
47 #define HNS_ROCE_V1_MAX_MTT_SEGS 0x100000
49 #define HNS_ROCE_V1_MAX_QP_INIT_RDMA 128
50 #define HNS_ROCE_V1_MAX_QP_DEST_RDMA 128
52 #define HNS_ROCE_V1_MAX_SQ_DESC_SZ 64
53 #define HNS_ROCE_V1_MAX_RQ_DESC_SZ 64
54 #define HNS_ROCE_V1_SG_NUM 2
55 #define HNS_ROCE_V1_INLINE_SIZE 32
57 #define HNS_ROCE_V1_UAR_NUM 256
58 #define HNS_ROCE_V1_PHY_UAR_NUM 8
60 #define HNS_ROCE_V1_GID_NUM 16
62 #define HNS_ROCE_V1_NUM_COMP_EQE 0x8000
63 #define HNS_ROCE_V1_NUM_ASYNC_EQE 0x400
65 #define HNS_ROCE_V1_QPC_ENTRY_SIZE 256
66 #define HNS_ROCE_V1_IRRL_ENTRY_SIZE 8
67 #define HNS_ROCE_V1_CQC_ENTRY_SIZE 64
68 #define HNS_ROCE_V1_MTPT_ENTRY_SIZE 64
69 #define HNS_ROCE_V1_MTT_ENTRY_SIZE 64
71 #define HNS_ROCE_V1_CQE_ENTRY_SIZE 32
72 #define HNS_ROCE_V1_PAGE_SIZE_SUPPORT 0xFFFFF000
74 #define HNS_ROCE_V1_EXT_RAQ_WF 8
75 #define HNS_ROCE_V1_RAQ_ENTRY 64
76 #define HNS_ROCE_V1_RAQ_DEPTH 32768
77 #define HNS_ROCE_V1_RAQ_SIZE (HNS_ROCE_V1_RAQ_ENTRY * HNS_ROCE_V1_RAQ_DEPTH)
79 #define HNS_ROCE_V1_SDB_DEPTH 0x400
80 #define HNS_ROCE_V1_ODB_DEPTH 0x400
82 #define HNS_ROCE_V1_DB_RSVD 0x80
84 #define HNS_ROCE_V1_SDB_ALEPT HNS_ROCE_V1_DB_RSVD
85 #define HNS_ROCE_V1_SDB_ALFUL (HNS_ROCE_V1_SDB_DEPTH - HNS_ROCE_V1_DB_RSVD)
86 #define HNS_ROCE_V1_ODB_ALEPT HNS_ROCE_V1_DB_RSVD
87 #define HNS_ROCE_V1_ODB_ALFUL (HNS_ROCE_V1_ODB_DEPTH - HNS_ROCE_V1_DB_RSVD)
89 #define HNS_ROCE_V1_EXT_SDB_DEPTH 0x4000
90 #define HNS_ROCE_V1_EXT_ODB_DEPTH 0x4000
91 #define HNS_ROCE_V1_EXT_SDB_ENTRY 16
92 #define HNS_ROCE_V1_EXT_ODB_ENTRY 16
93 #define HNS_ROCE_V1_EXT_SDB_SIZE \
94 (HNS_ROCE_V1_EXT_SDB_DEPTH * HNS_ROCE_V1_EXT_SDB_ENTRY)
95 #define HNS_ROCE_V1_EXT_ODB_SIZE \
96 (HNS_ROCE_V1_EXT_ODB_DEPTH * HNS_ROCE_V1_EXT_ODB_ENTRY)
98 #define HNS_ROCE_V1_EXT_SDB_ALEPT HNS_ROCE_V1_DB_RSVD
99 #define HNS_ROCE_V1_EXT_SDB_ALFUL \
100 (HNS_ROCE_V1_EXT_SDB_DEPTH - HNS_ROCE_V1_DB_RSVD)
101 #define HNS_ROCE_V1_EXT_ODB_ALEPT HNS_ROCE_V1_DB_RSVD
102 #define HNS_ROCE_V1_EXT_ODB_ALFUL \
103 (HNS_ROCE_V1_EXT_ODB_DEPTH - HNS_ROCE_V1_DB_RSVD)
105 #define HNS_ROCE_BT_RSV_BUF_SIZE (1 << 17)
107 #define HNS_ROCE_ODB_POLL_MODE 0
109 #define HNS_ROCE_SDB_NORMAL_MODE 0
110 #define HNS_ROCE_SDB_EXTEND_MODE 1
112 #define HNS_ROCE_ODB_EXTEND_MODE 1
114 #define KEY_VALID 0x02
116 #define HNS_ROCE_CQE_QPN_MASK 0x3ffff
117 #define HNS_ROCE_CQE_STATUS_MASK 0x1f
118 #define HNS_ROCE_CQE_OPCODE_MASK 0xf
120 #define HNS_ROCE_CQE_SUCCESS 0x00
121 #define HNS_ROCE_CQE_SYNDROME_LOCAL_LENGTH_ERR 0x01
122 #define HNS_ROCE_CQE_SYNDROME_LOCAL_QP_OP_ERR 0x02
123 #define HNS_ROCE_CQE_SYNDROME_LOCAL_PROT_ERR 0x03
124 #define HNS_ROCE_CQE_SYNDROME_WR_FLUSH_ERR 0x04
125 #define HNS_ROCE_CQE_SYNDROME_MEM_MANAGE_OPERATE_ERR 0x05
126 #define HNS_ROCE_CQE_SYNDROME_BAD_RESP_ERR 0x06
127 #define HNS_ROCE_CQE_SYNDROME_LOCAL_ACCESS_ERR 0x07
128 #define HNS_ROCE_CQE_SYNDROME_REMOTE_INVAL_REQ_ERR 0x08
129 #define HNS_ROCE_CQE_SYNDROME_REMOTE_ACCESS_ERR 0x09
130 #define HNS_ROCE_CQE_SYNDROME_REMOTE_OP_ERR 0x0a
131 #define HNS_ROCE_CQE_SYNDROME_TRANSPORT_RETRY_EXC_ERR 0x0b
132 #define HNS_ROCE_CQE_SYNDROME_RNR_RETRY_EXC_ERR 0x0c
134 #define QP1C_CFGN_OFFSET 0x28
135 #define PHY_PORT_OFFSET 0x8
136 #define MTPT_IDX_SHIFT 16
137 #define ALL_PORT_VAL_OPEN 0x3f
138 #define POL_TIME_INTERVAL_VAL 0x80
139 #define SLEEP_TIME_INTERVAL 20
140 #define SQ_PSN_SHIFT 8
141 #define QKEY_VAL 0x80010000
142 #define SDB_INV_CNT_OFFSET 8
144 struct hns_roce_cq_context {
155 #define CQ_CONTEXT_CQC_BYTE_4_CQC_STATE_S 0
156 #define CQ_CONTEXT_CQC_BYTE_4_CQC_STATE_M \
157 (((1UL << 2) - 1) << CQ_CONTEXT_CQC_BYTE_4_CQC_STATE_S)
159 #define CQ_CONTEXT_CQC_BYTE_4_CQN_S 16
160 #define CQ_CONTEXT_CQC_BYTE_4_CQN_M \
161 (((1UL << 16) - 1) << CQ_CONTEXT_CQC_BYTE_4_CQN_S)
163 #define CQ_CONTEXT_CQC_BYTE_12_CQ_BT_H_S 0
164 #define CQ_CONTEXT_CQC_BYTE_12_CQ_BT_H_M \
165 (((1UL << 17) - 1) << CQ_CONTEXT_CQC_BYTE_12_CQ_BT_H_S)
167 #define CQ_CONTEXT_CQC_BYTE_12_CQ_CQE_SHIFT_S 20
168 #define CQ_CONTEXT_CQC_BYTE_12_CQ_CQE_SHIFT_M \
169 (((1UL << 4) - 1) << CQ_CONTEXT_CQC_BYTE_12_CQ_CQE_SHIFT_S)
171 #define CQ_CONTEXT_CQC_BYTE_12_CEQN_S 24
172 #define CQ_CONTEXT_CQC_BYTE_12_CEQN_M \
173 (((1UL << 5) - 1) << CQ_CONTEXT_CQC_BYTE_12_CEQN_S)
175 #define CQ_CONTEXT_CQC_BYTE_20_CUR_CQE_BA0_H_S 0
176 #define CQ_CONTEXT_CQC_BYTE_20_CUR_CQE_BA0_H_M \
177 (((1UL << 5) - 1) << CQ_CONTEXT_CQC_BYTE_20_CUR_CQE_BA0_H_S)
179 #define CQ_CONTEXT_CQC_BYTE_20_CQ_CUR_INDEX_S 16
180 #define CQ_CONTEXT_CQC_BYTE_20_CQ_CUR_INDEX_M \
181 (((1UL << 16) - 1) << CQ_CONTEXT_CQC_BYTE_20_CQ_CUR_INDEX_S)
183 #define CQ_CONTEXT_CQC_BYTE_20_CQE_TPTR_ADDR_H_S 8
184 #define CQ_CONTEXT_CQC_BYTE_20_CQE_TPTR_ADDR_H_M \
185 (((1UL << 5) - 1) << CQ_CONTEXT_CQC_BYTE_20_CQE_TPTR_ADDR_H_S)
187 #define CQ_CONTEXT_CQC_BYTE_32_CUR_CQE_BA1_H_S 0
188 #define CQ_CONTEXT_CQC_BYTE_32_CUR_CQE_BA1_H_M \
189 (((1UL << 5) - 1) << CQ_CONTEXT_CQC_BYTE_32_CUR_CQE_BA1_H_S)
191 #define CQ_CONTEXT_CQC_BYTE_32_SE_FLAG_S 9
193 #define CQ_CONTEXT_CQC_BYTE_32_CE_FLAG_S 8
194 #define CQ_CONTEXT_CQC_BYTE_32_NOTIFICATION_FLAG_S 14
195 #define CQ_CQNTEXT_CQC_BYTE_32_TYPE_OF_COMPLETION_NOTIFICATION_S 15
197 #define CQ_CONTEXT_CQC_BYTE_32_CQ_CONS_IDX_S 16
198 #define CQ_CONTEXT_CQC_BYTE_32_CQ_CONS_IDX_M \
199 (((1UL << 16) - 1) << CQ_CONTEXT_CQC_BYTE_32_CQ_CONS_IDX_S)
201 struct hns_roce_cqe {
215 #define CQE_BYTE_4_OWNER_S 7
216 #define CQE_BYTE_4_SQ_RQ_FLAG_S 14
218 #define CQE_BYTE_4_STATUS_OF_THE_OPERATION_S 8
219 #define CQE_BYTE_4_STATUS_OF_THE_OPERATION_M \
220 (((1UL << 5) - 1) << CQE_BYTE_4_STATUS_OF_THE_OPERATION_S)
222 #define CQE_BYTE_4_WQE_INDEX_S 16
223 #define CQE_BYTE_4_WQE_INDEX_M (((1UL << 14) - 1) << CQE_BYTE_4_WQE_INDEX_S)
225 #define CQE_BYTE_4_OPERATION_TYPE_S 0
226 #define CQE_BYTE_4_OPERATION_TYPE_M \
227 (((1UL << 4) - 1) << CQE_BYTE_4_OPERATION_TYPE_S)
229 #define CQE_BYTE_4_IMM_INDICATOR_S 15
231 #define CQE_BYTE_16_LOCAL_QPN_S 0
232 #define CQE_BYTE_16_LOCAL_QPN_M (((1UL << 24) - 1) << CQE_BYTE_16_LOCAL_QPN_S)
234 #define CQE_BYTE_20_PORT_NUM_S 26
235 #define CQE_BYTE_20_PORT_NUM_M (((1UL << 3) - 1) << CQE_BYTE_20_PORT_NUM_S)
237 #define CQE_BYTE_20_SL_S 24
238 #define CQE_BYTE_20_SL_M (((1UL << 2) - 1) << CQE_BYTE_20_SL_S)
240 #define CQE_BYTE_20_REMOTE_QPN_S 0
241 #define CQE_BYTE_20_REMOTE_QPN_M \
242 (((1UL << 24) - 1) << CQE_BYTE_20_REMOTE_QPN_S)
244 #define CQE_BYTE_20_GRH_PRESENT_S 29
246 #define CQE_BYTE_28_P_KEY_IDX_S 16
247 #define CQE_BYTE_28_P_KEY_IDX_M (((1UL << 16) - 1) << CQE_BYTE_28_P_KEY_IDX_S)
249 #define CQ_DB_REQ_NOT_SOL 0
250 #define CQ_DB_REQ_NOT (1 << 16)
252 struct hns_roce_v1_mpt_entry {
271 #define MPT_BYTE_4_KEY_STATE_S 0
272 #define MPT_BYTE_4_KEY_STATE_M (((1UL << 2) - 1) << MPT_BYTE_4_KEY_STATE_S)
274 #define MPT_BYTE_4_KEY_S 8
275 #define MPT_BYTE_4_KEY_M (((1UL << 8) - 1) << MPT_BYTE_4_KEY_S)
277 #define MPT_BYTE_4_PAGE_SIZE_S 16
278 #define MPT_BYTE_4_PAGE_SIZE_M (((1UL << 2) - 1) << MPT_BYTE_4_PAGE_SIZE_S)
280 #define MPT_BYTE_4_MW_TYPE_S 20
282 #define MPT_BYTE_4_MW_BIND_ENABLE_S 21
284 #define MPT_BYTE_4_OWN_S 22
286 #define MPT_BYTE_4_MEMORY_LOCATION_TYPE_S 24
287 #define MPT_BYTE_4_MEMORY_LOCATION_TYPE_M \
288 (((1UL << 2) - 1) << MPT_BYTE_4_MEMORY_LOCATION_TYPE_S)
290 #define MPT_BYTE_4_REMOTE_ATOMIC_S 26
291 #define MPT_BYTE_4_LOCAL_WRITE_S 27
292 #define MPT_BYTE_4_REMOTE_WRITE_S 28
293 #define MPT_BYTE_4_REMOTE_READ_S 29
294 #define MPT_BYTE_4_REMOTE_INVAL_ENABLE_S 30
295 #define MPT_BYTE_4_ADDRESS_TYPE_S 31
297 #define MPT_BYTE_12_PBL_ADDR_H_S 0
298 #define MPT_BYTE_12_PBL_ADDR_H_M \
299 (((1UL << 17) - 1) << MPT_BYTE_12_PBL_ADDR_H_S)
301 #define MPT_BYTE_12_MW_BIND_COUNTER_S 17
302 #define MPT_BYTE_12_MW_BIND_COUNTER_M \
303 (((1UL << 15) - 1) << MPT_BYTE_12_MW_BIND_COUNTER_S)
305 #define MPT_BYTE_28_PD_S 0
306 #define MPT_BYTE_28_PD_M (((1UL << 16) - 1) << MPT_BYTE_28_PD_S)
308 #define MPT_BYTE_28_L_KEY_IDX_L_S 16
309 #define MPT_BYTE_28_L_KEY_IDX_L_M \
310 (((1UL << 16) - 1) << MPT_BYTE_28_L_KEY_IDX_L_S)
312 #define MPT_BYTE_36_PA0_H_S 0
313 #define MPT_BYTE_36_PA0_H_M (((1UL << 5) - 1) << MPT_BYTE_36_PA0_H_S)
315 #define MPT_BYTE_36_PA1_L_S 8
316 #define MPT_BYTE_36_PA1_L_M (((1UL << 24) - 1) << MPT_BYTE_36_PA1_L_S)
318 #define MPT_BYTE_40_PA1_H_S 0
319 #define MPT_BYTE_40_PA1_H_M (((1UL << 13) - 1) << MPT_BYTE_40_PA1_H_S)
321 #define MPT_BYTE_40_PA2_L_S 16
322 #define MPT_BYTE_40_PA2_L_M (((1UL << 16) - 1) << MPT_BYTE_40_PA2_L_S)
324 #define MPT_BYTE_44_PA2_H_S 0
325 #define MPT_BYTE_44_PA2_H_M (((1UL << 21) - 1) << MPT_BYTE_44_PA2_H_S)
327 #define MPT_BYTE_44_PA3_L_S 24
328 #define MPT_BYTE_44_PA3_L_M (((1UL << 8) - 1) << MPT_BYTE_44_PA3_L_S)
330 #define MPT_BYTE_48_PA3_H_S 0
331 #define MPT_BYTE_48_PA3_H_M (((1UL << 29) - 1) << MPT_BYTE_48_PA3_H_S)
333 #define MPT_BYTE_56_PA4_H_S 0
334 #define MPT_BYTE_56_PA4_H_M (((1UL << 5) - 1) << MPT_BYTE_56_PA4_H_S)
336 #define MPT_BYTE_56_PA5_L_S 8
337 #define MPT_BYTE_56_PA5_L_M (((1UL << 24) - 1) << MPT_BYTE_56_PA5_L_S)
339 #define MPT_BYTE_60_PA5_H_S 0
340 #define MPT_BYTE_60_PA5_H_M (((1UL << 13) - 1) << MPT_BYTE_60_PA5_H_S)
342 #define MPT_BYTE_60_PA6_L_S 16
343 #define MPT_BYTE_60_PA6_L_M (((1UL << 16) - 1) << MPT_BYTE_60_PA6_L_S)
345 #define MPT_BYTE_64_PA6_H_S 0
346 #define MPT_BYTE_64_PA6_H_M (((1UL << 21) - 1) << MPT_BYTE_64_PA6_H_S)
348 #define MPT_BYTE_64_L_KEY_IDX_H_S 24
349 #define MPT_BYTE_64_L_KEY_IDX_H_M \
350 (((1UL << 8) - 1) << MPT_BYTE_64_L_KEY_IDX_H_S)
352 struct hns_roce_wqe_ctrl_seg {
359 struct hns_roce_wqe_data_seg {
365 struct hns_roce_wqe_raddr_seg {
367 __be32 len;/* reserved */
371 struct hns_roce_rq_wqe_ctrl {
379 #define RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_S 16
380 #define RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_M \
381 (((1UL << 6) - 1) << RQ_WQE_CTRL_RWQE_BYTE_12_RWQE_SGE_NUM_S)
383 #define HNS_ROCE_QP_DESTROY_TIMEOUT_MSECS 10000
387 struct hns_roce_ud_send_wqe {
394 unsigned char dgid[GID_LEN];
415 #define UD_SEND_WQE_U32_4_DMAC_0_S 0
416 #define UD_SEND_WQE_U32_4_DMAC_0_M \
417 (((1UL << 8) - 1) << UD_SEND_WQE_U32_4_DMAC_0_S)
419 #define UD_SEND_WQE_U32_4_DMAC_1_S 8
420 #define UD_SEND_WQE_U32_4_DMAC_1_M \
421 (((1UL << 8) - 1) << UD_SEND_WQE_U32_4_DMAC_1_S)
423 #define UD_SEND_WQE_U32_4_DMAC_2_S 16
424 #define UD_SEND_WQE_U32_4_DMAC_2_M \
425 (((1UL << 8) - 1) << UD_SEND_WQE_U32_4_DMAC_2_S)
427 #define UD_SEND_WQE_U32_4_DMAC_3_S 24
428 #define UD_SEND_WQE_U32_4_DMAC_3_M \
429 (((1UL << 8) - 1) << UD_SEND_WQE_U32_4_DMAC_3_S)
431 #define UD_SEND_WQE_U32_8_DMAC_4_S 0
432 #define UD_SEND_WQE_U32_8_DMAC_4_M \
433 (((1UL << 8) - 1) << UD_SEND_WQE_U32_8_DMAC_4_S)
435 #define UD_SEND_WQE_U32_8_DMAC_5_S 8
436 #define UD_SEND_WQE_U32_8_DMAC_5_M \
437 (((1UL << 8) - 1) << UD_SEND_WQE_U32_8_DMAC_5_S)
439 #define UD_SEND_WQE_U32_8_OPERATION_TYPE_S 16
440 #define UD_SEND_WQE_U32_8_OPERATION_TYPE_M \
441 (((1UL << 4) - 1) << UD_SEND_WQE_U32_8_OPERATION_TYPE_S)
443 #define UD_SEND_WQE_U32_8_NUMBER_OF_DATA_SEG_S 24
444 #define UD_SEND_WQE_U32_8_NUMBER_OF_DATA_SEG_M \
445 (((1UL << 6) - 1) << UD_SEND_WQE_U32_8_NUMBER_OF_DATA_SEG_S)
447 #define UD_SEND_WQE_U32_8_SEND_GL_ROUTING_HDR_FLAG_S 31
449 #define UD_SEND_WQE_U32_16_DEST_QP_S 0
450 #define UD_SEND_WQE_U32_16_DEST_QP_M \
451 (((1UL << 24) - 1) << UD_SEND_WQE_U32_16_DEST_QP_S)
453 #define UD_SEND_WQE_U32_16_MAX_STATIC_RATE_S 24
454 #define UD_SEND_WQE_U32_16_MAX_STATIC_RATE_M \
455 (((1UL << 8) - 1) << UD_SEND_WQE_U32_16_MAX_STATIC_RATE_S)
457 #define UD_SEND_WQE_U32_36_FLOW_LABEL_S 0
458 #define UD_SEND_WQE_U32_36_FLOW_LABEL_M \
459 (((1UL << 20) - 1) << UD_SEND_WQE_U32_36_FLOW_LABEL_S)
461 #define UD_SEND_WQE_U32_36_PRIORITY_S 20
462 #define UD_SEND_WQE_U32_36_PRIORITY_M \
463 (((1UL << 4) - 1) << UD_SEND_WQE_U32_36_PRIORITY_S)
465 #define UD_SEND_WQE_U32_36_SGID_INDEX_S 24
466 #define UD_SEND_WQE_U32_36_SGID_INDEX_M \
467 (((1UL << 8) - 1) << UD_SEND_WQE_U32_36_SGID_INDEX_S)
469 #define UD_SEND_WQE_U32_40_HOP_LIMIT_S 0
470 #define UD_SEND_WQE_U32_40_HOP_LIMIT_M \
471 (((1UL << 8) - 1) << UD_SEND_WQE_U32_40_HOP_LIMIT_S)
473 #define UD_SEND_WQE_U32_40_TRAFFIC_CLASS_S 8
474 #define UD_SEND_WQE_U32_40_TRAFFIC_CLASS_M \
475 (((1UL << 8) - 1) << UD_SEND_WQE_U32_40_TRAFFIC_CLASS_S)
477 struct hns_roce_sqp_context {
490 #define QP1C_BYTES_4_SQ_WQE_SHIFT_S 8
491 #define QP1C_BYTES_4_SQ_WQE_SHIFT_M \
492 (((1UL << 4) - 1) << QP1C_BYTES_4_SQ_WQE_SHIFT_S)
494 #define QP1C_BYTES_4_RQ_WQE_SHIFT_S 12
495 #define QP1C_BYTES_4_RQ_WQE_SHIFT_M \
496 (((1UL << 4) - 1) << QP1C_BYTES_4_RQ_WQE_SHIFT_S)
498 #define QP1C_BYTES_4_PD_S 16
499 #define QP1C_BYTES_4_PD_M (((1UL << 16) - 1) << QP1C_BYTES_4_PD_S)
501 #define QP1C_BYTES_12_SQ_RQ_BT_H_S 0
502 #define QP1C_BYTES_12_SQ_RQ_BT_H_M \
503 (((1UL << 17) - 1) << QP1C_BYTES_12_SQ_RQ_BT_H_S)
505 #define QP1C_BYTES_16_RQ_HEAD_S 0
506 #define QP1C_BYTES_16_RQ_HEAD_M (((1UL << 15) - 1) << QP1C_BYTES_16_RQ_HEAD_S)
508 #define QP1C_BYTES_16_PORT_NUM_S 16
509 #define QP1C_BYTES_16_PORT_NUM_M \
510 (((1UL << 3) - 1) << QP1C_BYTES_16_PORT_NUM_S)
512 #define QP1C_BYTES_16_SIGNALING_TYPE_S 27
513 #define QP1C_BYTES_16_LOCAL_ENABLE_E2E_CREDIT_S 28
514 #define QP1C_BYTES_16_RQ_BA_FLG_S 29
515 #define QP1C_BYTES_16_SQ_BA_FLG_S 30
516 #define QP1C_BYTES_16_QP1_ERR_S 31
518 #define QP1C_BYTES_20_SQ_HEAD_S 0
519 #define QP1C_BYTES_20_SQ_HEAD_M (((1UL << 15) - 1) << QP1C_BYTES_20_SQ_HEAD_S)
521 #define QP1C_BYTES_20_PKEY_IDX_S 16
522 #define QP1C_BYTES_20_PKEY_IDX_M \
523 (((1UL << 16) - 1) << QP1C_BYTES_20_PKEY_IDX_S)
525 #define QP1C_BYTES_28_CUR_RQ_WQE_BA_H_S 0
526 #define QP1C_BYTES_28_CUR_RQ_WQE_BA_H_M \
527 (((1UL << 5) - 1) << QP1C_BYTES_28_CUR_RQ_WQE_BA_H_S)
529 #define QP1C_BYTES_28_RQ_CUR_IDX_S 16
530 #define QP1C_BYTES_28_RQ_CUR_IDX_M \
531 (((1UL << 15) - 1) << QP1C_BYTES_28_RQ_CUR_IDX_S)
533 #define QP1C_BYTES_32_TX_CQ_NUM_S 0
534 #define QP1C_BYTES_32_TX_CQ_NUM_M \
535 (((1UL << 16) - 1) << QP1C_BYTES_32_TX_CQ_NUM_S)
537 #define QP1C_BYTES_32_RX_CQ_NUM_S 16
538 #define QP1C_BYTES_32_RX_CQ_NUM_M \
539 (((1UL << 16) - 1) << QP1C_BYTES_32_RX_CQ_NUM_S)
541 #define QP1C_BYTES_40_CUR_SQ_WQE_BA_H_S 0
542 #define QP1C_BYTES_40_CUR_SQ_WQE_BA_H_M \
543 (((1UL << 5) - 1) << QP1C_BYTES_40_CUR_SQ_WQE_BA_H_S)
545 #define QP1C_BYTES_40_SQ_CUR_IDX_S 16
546 #define QP1C_BYTES_40_SQ_CUR_IDX_M \
547 (((1UL << 15) - 1) << QP1C_BYTES_40_SQ_CUR_IDX_S)
549 #define HNS_ROCE_WQE_INLINE (1UL<<31)
550 #define HNS_ROCE_WQE_SE (1UL<<30)
552 #define HNS_ROCE_WQE_SGE_NUM_BIT 24
553 #define HNS_ROCE_WQE_IMM (1UL<<23)
554 #define HNS_ROCE_WQE_FENCE (1UL<<21)
555 #define HNS_ROCE_WQE_CQ_NOTIFY (1UL<<20)
557 #define HNS_ROCE_WQE_OPCODE_SEND (0<<16)
558 #define HNS_ROCE_WQE_OPCODE_RDMA_READ (1<<16)
559 #define HNS_ROCE_WQE_OPCODE_RDMA_WRITE (2<<16)
560 #define HNS_ROCE_WQE_OPCODE_LOCAL_INV (4<<16)
561 #define HNS_ROCE_WQE_OPCODE_UD_SEND (7<<16)
562 #define HNS_ROCE_WQE_OPCODE_MASK (15<<16)
564 struct hns_roce_qp_context {
597 u32 rx_cur_sq_wqe_ba_l;
620 u32 tx_cur_sq_wqe_ba_l;
625 #define QP_CONTEXT_QPC_BYTES_4_TRANSPORT_SERVICE_TYPE_S 0
626 #define QP_CONTEXT_QPC_BYTES_4_TRANSPORT_SERVICE_TYPE_M \
627 (((1UL << 3) - 1) << QP_CONTEXT_QPC_BYTES_4_TRANSPORT_SERVICE_TYPE_S)
629 #define QP_CONTEXT_QPC_BYTE_4_ENABLE_FPMR_S 3
630 #define QP_CONTEXT_QPC_BYTE_4_RDMA_READ_ENABLE_S 4
631 #define QP_CONTEXT_QPC_BYTE_4_RDMA_WRITE_ENABLE_S 5
632 #define QP_CONTEXT_QPC_BYTE_4_ATOMIC_OPERATION_ENABLE_S 6
633 #define QP_CONTEXT_QPC_BYTE_4_RDMAR_USE_S 7
635 #define QP_CONTEXT_QPC_BYTES_4_SQ_WQE_SHIFT_S 8
636 #define QP_CONTEXT_QPC_BYTES_4_SQ_WQE_SHIFT_M \
637 (((1UL << 4) - 1) << QP_CONTEXT_QPC_BYTES_4_SQ_WQE_SHIFT_S)
639 #define QP_CONTEXT_QPC_BYTES_4_RQ_WQE_SHIFT_S 12
640 #define QP_CONTEXT_QPC_BYTES_4_RQ_WQE_SHIFT_M \
641 (((1UL << 4) - 1) << QP_CONTEXT_QPC_BYTES_4_RQ_WQE_SHIFT_S)
643 #define QP_CONTEXT_QPC_BYTES_4_PD_S 16
644 #define QP_CONTEXT_QPC_BYTES_4_PD_M \
645 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_4_PD_S)
647 #define QP_CONTEXT_QPC_BYTES_8_TX_COMPLETION_S 0
648 #define QP_CONTEXT_QPC_BYTES_8_TX_COMPLETION_M \
649 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_8_TX_COMPLETION_S)
651 #define QP_CONTEXT_QPC_BYTES_8_RX_COMPLETION_S 16
652 #define QP_CONTEXT_QPC_BYTES_8_RX_COMPLETION_M \
653 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_8_RX_COMPLETION_S)
655 #define QP_CONTEXT_QPC_BYTES_12_SRQ_NUMBER_S 0
656 #define QP_CONTEXT_QPC_BYTES_12_SRQ_NUMBER_M \
657 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_12_SRQ_NUMBER_S)
659 #define QP_CONTEXT_QPC_BYTES_12_P_KEY_INDEX_S 16
660 #define QP_CONTEXT_QPC_BYTES_12_P_KEY_INDEX_M \
661 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_12_P_KEY_INDEX_S)
663 #define QP_CONTEXT_QPC_BYTES_16_QP_NUM_S 0
664 #define QP_CONTEXT_QPC_BYTES_16_QP_NUM_M \
665 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_16_QP_NUM_S)
667 #define QP_CONTEXT_QPC_BYTES_24_SQ_RQ_BT_H_S 0
668 #define QP_CONTEXT_QPC_BYTES_24_SQ_RQ_BT_H_M \
669 (((1UL << 17) - 1) << QP_CONTEXT_QPC_BYTES_24_SQ_RQ_BT_H_S)
671 #define QP_CONTEXT_QPC_BYTES_24_MINIMUM_RNR_NAK_TIMER_S 18
672 #define QP_CONTEXT_QPC_BYTES_24_MINIMUM_RNR_NAK_TIMER_M \
673 (((1UL << 5) - 1) << QP_CONTEXT_QPC_BYTES_24_MINIMUM_RNR_NAK_TIMER_S)
675 #define QP_CONTEXT_QPC_BYTE_24_REMOTE_ENABLE_E2E_CREDITS_S 23
677 #define QP_CONTEXT_QPC_BYTES_32_IRRL_BA_H_S 0
678 #define QP_CONTEXT_QPC_BYTES_32_IRRL_BA_H_M \
679 (((1UL << 17) - 1) << QP_CONTEXT_QPC_BYTES_32_IRRL_BA_H_S)
681 #define QP_CONTEXT_QPC_BYTES_32_MIG_STATE_S 18
682 #define QP_CONTEXT_QPC_BYTES_32_MIG_STATE_M \
683 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_32_MIG_STATE_S)
685 #define QP_CONTEXT_QPC_BYTE_32_LOCAL_ENABLE_E2E_CREDITS_S 20
686 #define QP_CONTEXT_QPC_BYTE_32_SIGNALING_TYPE_S 21
687 #define QP_CONTEXT_QPC_BYTE_32_LOOPBACK_INDICATOR_S 22
688 #define QP_CONTEXT_QPC_BYTE_32_GLOBAL_HEADER_S 23
690 #define QP_CONTEXT_QPC_BYTES_32_RESPONDER_RESOURCES_S 24
691 #define QP_CONTEXT_QPC_BYTES_32_RESPONDER_RESOURCES_M \
692 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_32_RESPONDER_RESOURCES_S)
694 #define QP_CONTEXT_QPC_BYTES_36_DEST_QP_S 0
695 #define QP_CONTEXT_QPC_BYTES_36_DEST_QP_M \
696 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_36_DEST_QP_S)
698 #define QP_CONTEXT_QPC_BYTES_36_SGID_INDEX_S 24
699 #define QP_CONTEXT_QPC_BYTES_36_SGID_INDEX_M \
700 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_36_SGID_INDEX_S)
702 #define QP_CONTEXT_QPC_BYTES_44_DMAC_H_S 0
703 #define QP_CONTEXT_QPC_BYTES_44_DMAC_H_M \
704 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_44_DMAC_H_S)
706 #define QP_CONTEXT_QPC_BYTES_44_MAXIMUM_STATIC_RATE_S 16
707 #define QP_CONTEXT_QPC_BYTES_44_MAXIMUM_STATIC_RATE_M \
708 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_44_MAXIMUM_STATIC_RATE_S)
710 #define QP_CONTEXT_QPC_BYTES_44_HOPLMT_S 24
711 #define QP_CONTEXT_QPC_BYTES_44_HOPLMT_M \
712 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_44_HOPLMT_S)
714 #define QP_CONTEXT_QPC_BYTES_48_FLOWLABEL_S 0
715 #define QP_CONTEXT_QPC_BYTES_48_FLOWLABEL_M \
716 (((1UL << 20) - 1) << QP_CONTEXT_QPC_BYTES_48_FLOWLABEL_S)
718 #define QP_CONTEXT_QPC_BYTES_48_TCLASS_S 20
719 #define QP_CONTEXT_QPC_BYTES_48_TCLASS_M \
720 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_48_TCLASS_S)
722 #define QP_CONTEXT_QPC_BYTES_48_MTU_S 28
723 #define QP_CONTEXT_QPC_BYTES_48_MTU_M \
724 (((1UL << 4) - 1) << QP_CONTEXT_QPC_BYTES_48_MTU_S)
726 #define QP_CONTEXT_QPC_BYTES_68_RQ_HEAD_S 0
727 #define QP_CONTEXT_QPC_BYTES_68_RQ_HEAD_M \
728 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_68_RQ_HEAD_S)
730 #define QP_CONTEXT_QPC_BYTES_68_RQ_CUR_INDEX_S 16
731 #define QP_CONTEXT_QPC_BYTES_68_RQ_CUR_INDEX_M \
732 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_68_RQ_CUR_INDEX_S)
734 #define QP_CONTEXT_QPC_BYTES_76_CUR_RQ_WQE_BA_H_S 0
735 #define QP_CONTEXT_QPC_BYTES_76_CUR_RQ_WQE_BA_H_M \
736 (((1UL << 5) - 1) << QP_CONTEXT_QPC_BYTES_76_CUR_RQ_WQE_BA_H_S)
738 #define QP_CONTEXT_QPC_BYTES_76_RX_REQ_MSN_S 8
739 #define QP_CONTEXT_QPC_BYTES_76_RX_REQ_MSN_M \
740 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_76_RX_REQ_MSN_S)
742 #define QP_CONTEXT_QPC_BYTES_84_LAST_ACK_PSN_S 0
743 #define QP_CONTEXT_QPC_BYTES_84_LAST_ACK_PSN_M \
744 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_84_LAST_ACK_PSN_S)
746 #define QP_CONTEXT_QPC_BYTES_84_TRRL_HEAD_S 24
747 #define QP_CONTEXT_QPC_BYTES_84_TRRL_HEAD_M \
748 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_84_TRRL_HEAD_S)
750 #define QP_CONTEXT_QPC_BYTES_88_RX_REQ_EPSN_S 0
751 #define QP_CONTEXT_QPC_BYTES_88_RX_REQ_EPSN_M \
752 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_88_RX_REQ_EPSN_S)
754 #define QP_CONTEXT_QPC_BYTES_88_RX_REQ_PSN_ERR_FLAG_S 24
755 #define QP_CONTEXT_QPC_BYTES_88_RX_LAST_OPCODE_FLG_S 25
757 #define QP_CONTEXT_QPC_BYTES_88_RQ_REQ_LAST_OPERATION_TYPE_S 26
758 #define QP_CONTEXT_QPC_BYTES_88_RQ_REQ_LAST_OPERATION_TYPE_M \
759 (((1UL << 2) - 1) << \
760 QP_CONTEXT_QPC_BYTES_88_RQ_REQ_LAST_OPERATION_TYPE_S)
762 #define QP_CONTEXT_QPC_BYTES_88_RQ_REQ_RDMA_WR_FLAG_S 29
763 #define QP_CONTEXT_QPC_BYTES_88_RQ_REQ_RDMA_WR_FLAG_M \
764 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_88_RQ_REQ_RDMA_WR_FLAG_S)
766 #define QP_CONTEXT_QPC_BYTES_108_TRRL_SDB_PSN_S 0
767 #define QP_CONTEXT_QPC_BYTES_108_TRRL_SDB_PSN_M \
768 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_108_TRRL_SDB_PSN_S)
770 #define QP_CONTEXT_QPC_BYTES_108_TRRL_SDB_PSN_FLG_S 24
771 #define QP_CONTEXT_QPC_BYTES_108_TRRL_TDB_PSN_FLG_S 25
773 #define QP_CONTEXT_QPC_BYTES_112_TRRL_TDB_PSN_S 0
774 #define QP_CONTEXT_QPC_BYTES_112_TRRL_TDB_PSN_M \
775 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_112_TRRL_TDB_PSN_S)
777 #define QP_CONTEXT_QPC_BYTES_112_TRRL_TAIL_S 24
778 #define QP_CONTEXT_QPC_BYTES_112_TRRL_TAIL_M \
779 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_112_TRRL_TAIL_S)
781 #define QP_CONTEXT_QPC_BYTES_120_RX_CUR_SQ_WQE_BA_H_S 0
782 #define QP_CONTEXT_QPC_BYTES_120_RX_CUR_SQ_WQE_BA_H_M \
783 (((1UL << 5) - 1) << QP_CONTEXT_QPC_BYTES_120_RX_CUR_SQ_WQE_BA_H_S)
785 #define QP_CONTEXT_QPC_BYTES_124_RX_ACK_MSN_S 0
786 #define QP_CONTEXT_QPC_BYTES_124_RX_ACK_MSN_M \
787 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_124_RX_ACK_MSN_S)
789 #define QP_CONTEXT_QPC_BYTES_124_IRRL_MSG_IDX_S 16
790 #define QP_CONTEXT_QPC_BYTES_124_IRRL_MSG_IDX_M \
791 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_124_IRRL_MSG_IDX_S)
793 #define QP_CONTEXT_QPC_BYTES_128_RX_ACK_EPSN_S 0
794 #define QP_CONTEXT_QPC_BYTES_128_RX_ACK_EPSN_M \
795 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_128_RX_ACK_EPSN_S)
797 #define QP_CONTEXT_QPC_BYTES_128_RX_ACK_PSN_ERR_FLG_S 24
799 #define QP_CONTEXT_QPC_BYTES_128_ACK_LAST_OPERATION_TYPE_S 25
800 #define QP_CONTEXT_QPC_BYTES_128_ACK_LAST_OPERATION_TYPE_M \
801 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_128_ACK_LAST_OPERATION_TYPE_S)
803 #define QP_CONTEXT_QPC_BYTES_128_IRRL_PSN_VLD_FLG_S 27
805 #define QP_CONTEXT_QPC_BYTES_132_IRRL_PSN_S 0
806 #define QP_CONTEXT_QPC_BYTES_132_IRRL_PSN_M \
807 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_132_IRRL_PSN_S)
809 #define QP_CONTEXT_QPC_BYTES_132_IRRL_TAIL_S 24
810 #define QP_CONTEXT_QPC_BYTES_132_IRRL_TAIL_M \
811 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_132_IRRL_TAIL_S)
813 #define QP_CONTEXT_QPC_BYTES_136_RETRY_MSG_PSN_S 0
814 #define QP_CONTEXT_QPC_BYTES_136_RETRY_MSG_PSN_M \
815 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_136_RETRY_MSG_PSN_S)
817 #define QP_CONTEXT_QPC_BYTES_136_RETRY_MSG_FPKT_PSN_L_S 24
818 #define QP_CONTEXT_QPC_BYTES_136_RETRY_MSG_FPKT_PSN_L_M \
819 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_136_RETRY_MSG_FPKT_PSN_L_S)
821 #define QP_CONTEXT_QPC_BYTES_140_RETRY_MSG_FPKT_PSN_H_S 0
822 #define QP_CONTEXT_QPC_BYTES_140_RETRY_MSG_FPKT_PSN_H_M \
823 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_140_RETRY_MSG_FPKT_PSN_H_S)
825 #define QP_CONTEXT_QPC_BYTES_140_RETRY_MSG_MSN_S 16
826 #define QP_CONTEXT_QPC_BYTES_140_RETRY_MSG_MSN_M \
827 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_140_RETRY_MSG_MSN_S)
829 #define QP_CONTEXT_QPC_BYTES_140_RNR_RETRY_FLG_S 31
831 #define QP_CONTEXT_QPC_BYTES_144_QP_STATE_S 0
832 #define QP_CONTEXT_QPC_BYTES_144_QP_STATE_M \
833 (((1UL << 3) - 1) << QP_CONTEXT_QPC_BYTES_144_QP_STATE_S)
835 #define QP_CONTEXT_QPC_BYTES_148_CHECK_FLAG_S 0
836 #define QP_CONTEXT_QPC_BYTES_148_CHECK_FLAG_M \
837 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_148_CHECK_FLAG_S)
839 #define QP_CONTEXT_QPC_BYTES_148_RETRY_COUNT_S 2
840 #define QP_CONTEXT_QPC_BYTES_148_RETRY_COUNT_M \
841 (((1UL << 3) - 1) << QP_CONTEXT_QPC_BYTES_148_RETRY_COUNT_S)
843 #define QP_CONTEXT_QPC_BYTES_148_RNR_RETRY_COUNT_S 5
844 #define QP_CONTEXT_QPC_BYTES_148_RNR_RETRY_COUNT_M \
845 (((1UL << 3) - 1) << QP_CONTEXT_QPC_BYTES_148_RNR_RETRY_COUNT_S)
847 #define QP_CONTEXT_QPC_BYTES_148_LSN_S 8
848 #define QP_CONTEXT_QPC_BYTES_148_LSN_M \
849 (((1UL << 16) - 1) << QP_CONTEXT_QPC_BYTES_148_LSN_S)
851 #define QP_CONTEXT_QPC_BYTES_156_RETRY_COUNT_INIT_S 0
852 #define QP_CONTEXT_QPC_BYTES_156_RETRY_COUNT_INIT_M \
853 (((1UL << 3) - 1) << QP_CONTEXT_QPC_BYTES_156_RETRY_COUNT_INIT_S)
855 #define QP_CONTEXT_QPC_BYTES_156_ACK_TIMEOUT_S 3
856 #define QP_CONTEXT_QPC_BYTES_156_ACK_TIMEOUT_M \
857 (((1UL << 5) - 1) << QP_CONTEXT_QPC_BYTES_156_ACK_TIMEOUT_S)
859 #define QP_CONTEXT_QPC_BYTES_156_RNR_RETRY_COUNT_INIT_S 8
860 #define QP_CONTEXT_QPC_BYTES_156_RNR_RETRY_COUNT_INIT_M \
861 (((1UL << 3) - 1) << QP_CONTEXT_QPC_BYTES_156_RNR_RETRY_COUNT_INIT_S)
863 #define QP_CONTEXT_QPC_BYTES_156_PORT_NUM_S 11
864 #define QP_CONTEXT_QPC_BYTES_156_PORT_NUM_M \
865 (((1UL << 3) - 1) << QP_CONTEXT_QPC_BYTES_156_PORT_NUM_S)
867 #define QP_CONTEXT_QPC_BYTES_156_SL_S 14
868 #define QP_CONTEXT_QPC_BYTES_156_SL_M \
869 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_156_SL_S)
871 #define QP_CONTEXT_QPC_BYTES_156_INITIATOR_DEPTH_S 16
872 #define QP_CONTEXT_QPC_BYTES_156_INITIATOR_DEPTH_M \
873 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_156_INITIATOR_DEPTH_S)
875 #define QP_CONTEXT_QPC_BYTES_156_ACK_REQ_IND_S 24
876 #define QP_CONTEXT_QPC_BYTES_156_ACK_REQ_IND_M \
877 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_156_ACK_REQ_IND_S)
879 #define QP_CONTEXT_QPC_BYTES_164_SQ_PSN_S 0
880 #define QP_CONTEXT_QPC_BYTES_164_SQ_PSN_M \
881 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_164_SQ_PSN_S)
883 #define QP_CONTEXT_QPC_BYTES_164_IRRL_HEAD_S 24
884 #define QP_CONTEXT_QPC_BYTES_164_IRRL_HEAD_M \
885 (((1UL << 8) - 1) << QP_CONTEXT_QPC_BYTES_164_IRRL_HEAD_S)
887 #define QP_CONTEXT_QPC_BYTES_168_RETRY_SQ_PSN_S 0
888 #define QP_CONTEXT_QPC_BYTES_168_RETRY_SQ_PSN_M \
889 (((1UL << 24) - 1) << QP_CONTEXT_QPC_BYTES_168_RETRY_SQ_PSN_S)
891 #define QP_CONTEXT_QPC_BYTES_168_SGE_USE_FLA_S 24
892 #define QP_CONTEXT_QPC_BYTES_168_SGE_USE_FLA_M \
893 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_168_SGE_USE_FLA_S)
895 #define QP_CONTEXT_QPC_BYTES_168_DB_TYPE_S 26
896 #define QP_CONTEXT_QPC_BYTES_168_DB_TYPE_M \
897 (((1UL << 2) - 1) << QP_CONTEXT_QPC_BYTES_168_DB_TYPE_S)
899 #define QP_CONTEXT_QPC_BYTES_168_MSG_LP_IND_S 28
900 #define QP_CONTEXT_QPC_BYTES_168_CSDB_LP_IND_S 29
901 #define QP_CONTEXT_QPC_BYTES_168_QP_ERR_FLG_S 30
903 #define QP_CONTEXT_QPC_BYTES_176_DB_CUR_INDEX_S 0
904 #define QP_CONTEXT_QPC_BYTES_176_DB_CUR_INDEX_M \
905 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_176_DB_CUR_INDEX_S)
907 #define QP_CONTEXT_QPC_BYTES_176_RETRY_DB_CUR_INDEX_S 16
908 #define QP_CONTEXT_QPC_BYTES_176_RETRY_DB_CUR_INDEX_M \
909 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_176_RETRY_DB_CUR_INDEX_S)
911 #define QP_CONTEXT_QPC_BYTES_180_SQ_HEAD_S 0
912 #define QP_CONTEXT_QPC_BYTES_180_SQ_HEAD_M \
913 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_180_SQ_HEAD_S)
915 #define QP_CONTEXT_QPC_BYTES_180_SQ_CUR_INDEX_S 16
916 #define QP_CONTEXT_QPC_BYTES_180_SQ_CUR_INDEX_M \
917 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_180_SQ_CUR_INDEX_S)
919 #define QP_CONTEXT_QPC_BYTES_188_TX_CUR_SQ_WQE_BA_H_S 0
920 #define QP_CONTEXT_QPC_BYTES_188_TX_CUR_SQ_WQE_BA_H_M \
921 (((1UL << 5) - 1) << QP_CONTEXT_QPC_BYTES_188_TX_CUR_SQ_WQE_BA_H_S)
923 #define QP_CONTEXT_QPC_BYTES_188_PKT_RETRY_FLG_S 8
925 #define QP_CONTEXT_QPC_BYTES_188_TX_RETRY_CUR_INDEX_S 16
926 #define QP_CONTEXT_QPC_BYTES_188_TX_RETRY_CUR_INDEX_M \
927 (((1UL << 15) - 1) << QP_CONTEXT_QPC_BYTES_188_TX_RETRY_CUR_INDEX_S)
929 struct hns_roce_rq_db {
934 #define RQ_DOORBELL_U32_4_RQ_HEAD_S 0
935 #define RQ_DOORBELL_U32_4_RQ_HEAD_M \
936 (((1UL << 15) - 1) << RQ_DOORBELL_U32_4_RQ_HEAD_S)
938 #define RQ_DOORBELL_U32_8_QPN_S 0
939 #define RQ_DOORBELL_U32_8_QPN_M (((1UL << 24) - 1) << RQ_DOORBELL_U32_8_QPN_S)
941 #define RQ_DOORBELL_U32_8_CMD_S 28
942 #define RQ_DOORBELL_U32_8_CMD_M (((1UL << 3) - 1) << RQ_DOORBELL_U32_8_CMD_S)
944 #define RQ_DOORBELL_U32_8_HW_SYNC_S 31
946 struct hns_roce_sq_db {
951 #define SQ_DOORBELL_U32_4_SQ_HEAD_S 0
952 #define SQ_DOORBELL_U32_4_SQ_HEAD_M \
953 (((1UL << 15) - 1) << SQ_DOORBELL_U32_4_SQ_HEAD_S)
955 #define SQ_DOORBELL_U32_4_PORT_S 18
956 #define SQ_DOORBELL_U32_4_PORT_M (((1UL << 3) - 1) << SQ_DOORBELL_U32_4_PORT_S)
958 #define SQ_DOORBELL_U32_8_QPN_S 0
959 #define SQ_DOORBELL_U32_8_QPN_M (((1UL << 24) - 1) << SQ_DOORBELL_U32_8_QPN_S)
961 #define SQ_DOORBELL_HW_SYNC_S 31
963 struct hns_roce_ext_db {
966 struct hns_roce_buf_list *sdb_buf_list;
967 struct hns_roce_buf_list *odb_buf_list;
970 struct hns_roce_db_table {
973 struct hns_roce_ext_db *ext_db;
976 struct hns_roce_bt_table {
977 struct hns_roce_buf_list qpc_buf;
978 struct hns_roce_buf_list mtpt_buf;
979 struct hns_roce_buf_list cqc_buf;
982 struct hns_roce_v1_priv {
983 struct hns_roce_db_table db_table;
984 struct hns_roce_raq_table raq_table;
985 struct hns_roce_bt_table bt_table;
988 int hns_dsaf_roce_reset(struct fwnode_handle *dsaf_fwnode, bool dereset);