2 * Broadcom NetXtreme-E RoCE driver.
4 * Copyright (c) 2016 - 2017, Broadcom. All rights reserved. The term
5 * Broadcom refers to Broadcom Limited and/or its subsidiaries.
7 * This software is available to you under a choice of one of two
8 * licenses. You may choose to be licensed under the terms of the GNU
9 * General Public License (GPL) Version 2, available from the file
10 * COPYING in the main directory of this source tree, or the
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in
21 * the documentation and/or other materials provided with the
24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
31 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
33 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
34 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 * Description: Slow Path Operators (header)
40 #ifndef __BNXT_QPLIB_SP_H__
41 #define __BNXT_QPLIB_SP_H__
43 #include <rdma/bnxt_re-abi.h>
44 #define BNXT_QPLIB_RESERVED_QP_WRS 128
46 struct bnxt_qplib_dev_attr
{
47 #define FW_VER_ARR_LEN 4
48 u8 fw_ver
[FW_VER_ARR_LEN
];
49 #define BNXT_QPLIB_NUM_GIDS_SUPPORTED 256
53 #define BNXT_QPLIB_MAX_OUT_RD_ATOM 126
55 u32 max_qp_init_rd_atom
;
59 #define BNXT_QPLIB_MAX_CQ_WQES 0xfffff
74 u8 tqm_alloc_reqs
[MAX_TQM_ALLOC_REQ
];
81 struct bnxt_qplib_pd
{
85 struct bnxt_qplib_gid
{
89 struct bnxt_qplib_gid_info
{
90 struct bnxt_qplib_gid gid
;
94 struct bnxt_qplib_ah
{
95 struct bnxt_qplib_gid dgid
;
96 struct bnxt_qplib_pd
*pd
;
99 /* For Query AH if the hw table and SW table are differnt */
110 struct bnxt_qplib_mrw
{
111 struct bnxt_qplib_pd
*pd
;
114 #define BNXT_QPLIB_FR_PMR 0x80000000
117 #define BNXT_QPLIB_RSVD_LKEY 0xFFFFFFFF
123 struct bnxt_qplib_hwq hwq
;
126 struct bnxt_qplib_frpl
{
128 struct bnxt_qplib_hwq hwq
;
131 #define BNXT_QPLIB_ACCESS_LOCAL_WRITE BIT(0)
132 #define BNXT_QPLIB_ACCESS_REMOTE_READ BIT(1)
133 #define BNXT_QPLIB_ACCESS_REMOTE_WRITE BIT(2)
134 #define BNXT_QPLIB_ACCESS_REMOTE_ATOMIC BIT(3)
135 #define BNXT_QPLIB_ACCESS_MW_BIND BIT(4)
136 #define BNXT_QPLIB_ACCESS_ZERO_BASED BIT(5)
137 #define BNXT_QPLIB_ACCESS_ON_DEMAND BIT(6)
139 struct bnxt_qplib_roce_stats
{
141 u64 seq_err_naks_rcvd
;
142 /* seq_err_naks_rcvd is 64 b */
143 u64 max_retry_exceeded
;
144 /* max_retry_exceeded is 64 b */
146 /* rnr_naks_rcvd is 64 b */
148 u64 unrecoverable_err
;
149 /* unrecoverable_err is 64 b */
151 /* bad_resp_err is 64 b */
153 /* local_qp_op_err is 64 b */
154 u64 local_protection_err
;
155 /* local_protection_err is 64 b */
157 /* mem_mgmt_op_err is 64 b */
158 u64 remote_invalid_req_err
;
159 /* remote_invalid_req_err is 64 b */
160 u64 remote_access_err
;
161 /* remote_access_err is 64 b */
163 /* remote_op_err is 64 b */
165 /* dup_req is 64 b */
167 /* res_exceed_max is 64 b */
168 u64 res_length_mismatch
;
169 /* res_length_mismatch is 64 b */
171 /* res_exceeds_wqe is 64 b */
173 /* res_opcode_err is 64 b */
174 u64 res_rx_invalid_rkey
;
175 /* res_rx_invalid_rkey is 64 b */
176 u64 res_rx_domain_err
;
177 /* res_rx_domain_err is 64 b */
179 /* res_rx_no_perm is 64 b */
180 u64 res_rx_range_err
;
181 /* res_rx_range_err is 64 b */
182 u64 res_tx_invalid_rkey
;
183 /* res_tx_invalid_rkey is 64 b */
184 u64 res_tx_domain_err
;
185 /* res_tx_domain_err is 64 b */
187 /* res_tx_no_perm is 64 b */
188 u64 res_tx_range_err
;
189 /* res_tx_range_err is 64 b */
191 /* res_irrq_oflow is 64 b */
192 u64 res_unsup_opcode
;
193 /* res_unsup_opcode is 64 b */
194 u64 res_unaligned_atomic
;
195 /* res_unaligned_atomic is 64 b */
197 /* res_rem_inv_err is 64 b */
199 /* res_mem_error is 64 b */
201 /* res_srq_err is 64 b */
203 /* res_cmp_err is 64 b */
204 u64 res_invalid_dup_rkey
;
205 /* res_invalid_dup_rkey is 64 b */
206 u64 res_wqe_format_err
;
207 /* res_wqe_format_err is 64 b */
209 /* res_cq_load_err is 64 b */
210 u64 res_srq_load_err
;
211 /* res_srq_load_err is 64 b */
213 /* res_tx_pci_err is 64 b */
215 /* res_rx_pci_err is 64 b */
216 u64 res_oos_drop_count
;
217 /* res_oos_drop_count */
218 u64 active_qp_count_p0
;
219 /* port 0 active qps */
220 u64 active_qp_count_p1
;
221 /* port 1 active qps */
222 u64 active_qp_count_p2
;
223 /* port 2 active qps */
224 u64 active_qp_count_p3
;
225 /* port 3 active qps */
228 struct bnxt_qplib_ext_stat
{
243 u64 rx_roce_good_pkts
;
244 u64 rx_roce_good_bytes
;
245 u64 rx_out_of_buffer
;
246 u64 rx_out_of_sequence
;
252 struct bnxt_qplib_cc_param_ext
{
290 u16 sc_cr_th1
; /* severe congestion cr threshold 1 */
291 u16 sc_cr_th2
; /* severe congestion cr threshold 2 */
294 u16 reduce_cf_rtt_th
;
297 struct bnxt_qplib_cc_param
{
313 struct bnxt_qplib_cc_param_ext cc_ext
;
317 int bnxt_qplib_get_sgid(struct bnxt_qplib_res
*res
,
318 struct bnxt_qplib_sgid_tbl
*sgid_tbl
, int index
,
319 struct bnxt_qplib_gid
*gid
);
320 int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl
*sgid_tbl
,
321 struct bnxt_qplib_gid
*gid
, u16 vlan_id
, bool update
);
322 int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl
*sgid_tbl
,
323 struct bnxt_qplib_gid
*gid
, const u8
*mac
, u16 vlan_id
,
324 bool update
, u32
*index
);
325 int bnxt_qplib_update_sgid(struct bnxt_qplib_sgid_tbl
*sgid_tbl
,
326 struct bnxt_qplib_gid
*gid
, u16 gid_idx
,
328 int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw
*rcfw
,
329 struct bnxt_qplib_dev_attr
*attr
);
330 int bnxt_qplib_set_func_resources(struct bnxt_qplib_res
*res
,
331 struct bnxt_qplib_rcfw
*rcfw
,
332 struct bnxt_qplib_ctx
*ctx
);
333 int bnxt_qplib_create_ah(struct bnxt_qplib_res
*res
, struct bnxt_qplib_ah
*ah
,
335 int bnxt_qplib_destroy_ah(struct bnxt_qplib_res
*res
, struct bnxt_qplib_ah
*ah
,
337 int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res
*res
,
338 struct bnxt_qplib_mrw
*mrw
);
339 int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res
*res
, struct bnxt_qplib_mrw
*mrw
,
341 int bnxt_qplib_reg_mr(struct bnxt_qplib_res
*res
, struct bnxt_qplib_mrw
*mr
,
342 struct ib_umem
*umem
, int num_pbls
, u32 buf_pg_size
);
343 int bnxt_qplib_free_mrw(struct bnxt_qplib_res
*res
, struct bnxt_qplib_mrw
*mr
);
344 int bnxt_qplib_alloc_fast_reg_mr(struct bnxt_qplib_res
*res
,
345 struct bnxt_qplib_mrw
*mr
, int max
);
346 int bnxt_qplib_alloc_fast_reg_page_list(struct bnxt_qplib_res
*res
,
347 struct bnxt_qplib_frpl
*frpl
, int max
);
348 int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res
*res
,
349 struct bnxt_qplib_frpl
*frpl
);
350 int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw
*rcfw
,
351 struct bnxt_qplib_roce_stats
*stats
);
352 int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw
*rcfw
, u32 fid
,
353 struct bnxt_qplib_ext_stat
*estat
);
354 int bnxt_qplib_modify_cc(struct bnxt_qplib_res
*res
,
355 struct bnxt_qplib_cc_param
*cc_param
);
356 int bnxt_qplib_read_context(struct bnxt_qplib_rcfw
*rcfw
, u8 type
, u32 xid
,
357 u32 resp_size
, void *resp_va
);
359 #define BNXT_VAR_MAX_WQE 4352
360 #define BNXT_VAR_MAX_SLOT_ALIGN 256
361 #define BNXT_VAR_MAX_SGE 13
362 #define BNXT_RE_MAX_RQ_WQES 65536
364 #define BNXT_STATIC_MAX_SGE 6
366 #endif /* __BNXT_QPLIB_SP_H__*/