1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40#ifndef __BNXT_QPLIB_SP_H__
41#define __BNXT_QPLIB_SP_H__
42
43#define BNXT_QPLIB_RESERVED_QP_WRS 128
44
45struct bnxt_qplib_dev_attr {
46#define FW_VER_ARR_LEN 4
47 u8 fw_ver[FW_VER_ARR_LEN];
48#define BNXT_QPLIB_NUM_GIDS_SUPPORTED 256
49 u16 max_sgid;
50 u16 max_mrw;
51 u32 max_qp;
52#define BNXT_QPLIB_MAX_OUT_RD_ATOM 126
53 u32 max_qp_rd_atom;
54 u32 max_qp_init_rd_atom;
55 u32 max_qp_wqes;
56 u32 max_qp_sges;
57 u32 max_cq;
58 u32 max_cq_wqes;
59 u32 max_cq_sges;
60 u32 max_mr;
61 u64 max_mr_size;
62 u32 max_pd;
63 u32 max_mw;
64 u32 max_raw_ethy_qp;
65 u32 max_ah;
66 u32 max_srq;
67 u32 max_srq_wqes;
68 u32 max_srq_sges;
69 u32 max_pkey;
70 u32 max_inline_data;
71 u32 l2_db_size;
72 u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ];
73 bool is_atomic;
74 u16 dev_cap_flags;
75};
76
77struct bnxt_qplib_pd {
78 u32 id;
79};
80
81struct bnxt_qplib_gid {
82 u8 data[16];
83};
84
85struct bnxt_qplib_gid_info {
86 struct bnxt_qplib_gid gid;
87 u16 vlan_id;
88};
89
90struct bnxt_qplib_ah {
91 struct bnxt_qplib_gid dgid;
92 struct bnxt_qplib_pd *pd;
93 u32 id;
94 u8 sgid_index;
95
96 u8 host_sgid_index;
97 u8 traffic_class;
98 u32 flow_label;
99 u8 hop_limit;
100 u8 sl;
101 u8 dmac[6];
102 u16 vlan_id;
103 u8 nw_type;
104};
105
106struct bnxt_qplib_mrw {
107 struct bnxt_qplib_pd *pd;
108 int type;
109 u32 flags;
110#define BNXT_QPLIB_FR_PMR 0x80000000
111 u32 lkey;
112 u32 rkey;
113#define BNXT_QPLIB_RSVD_LKEY 0xFFFFFFFF
114 u64 va;
115 u64 total_size;
116 u32 npages;
117 u64 mr_handle;
118 struct bnxt_qplib_hwq hwq;
119};
120
121struct bnxt_qplib_frpl {
122 int max_pg_ptrs;
123 struct bnxt_qplib_hwq hwq;
124};
125
126#define BNXT_QPLIB_ACCESS_LOCAL_WRITE BIT(0)
127#define BNXT_QPLIB_ACCESS_REMOTE_READ BIT(1)
128#define BNXT_QPLIB_ACCESS_REMOTE_WRITE BIT(2)
129#define BNXT_QPLIB_ACCESS_REMOTE_ATOMIC BIT(3)
130#define BNXT_QPLIB_ACCESS_MW_BIND BIT(4)
131#define BNXT_QPLIB_ACCESS_ZERO_BASED BIT(5)
132#define BNXT_QPLIB_ACCESS_ON_DEMAND BIT(6)
133
134struct bnxt_qplib_roce_stats {
135 u64 to_retransmits;
136 u64 seq_err_naks_rcvd;
137
138 u64 max_retry_exceeded;
139
140 u64 rnr_naks_rcvd;
141
142 u64 missing_resp;
143 u64 unrecoverable_err;
144
145 u64 bad_resp_err;
146
147 u64 local_qp_op_err;
148
149 u64 local_protection_err;
150
151 u64 mem_mgmt_op_err;
152
153 u64 remote_invalid_req_err;
154
155 u64 remote_access_err;
156
157 u64 remote_op_err;
158
159 u64 dup_req;
160
161 u64 res_exceed_max;
162
163 u64 res_length_mismatch;
164
165 u64 res_exceeds_wqe;
166
167 u64 res_opcode_err;
168
169 u64 res_rx_invalid_rkey;
170
171 u64 res_rx_domain_err;
172
173 u64 res_rx_no_perm;
174
175 u64 res_rx_range_err;
176
177 u64 res_tx_invalid_rkey;
178
179 u64 res_tx_domain_err;
180
181 u64 res_tx_no_perm;
182
183 u64 res_tx_range_err;
184
185 u64 res_irrq_oflow;
186
187 u64 res_unsup_opcode;
188
189 u64 res_unaligned_atomic;
190
191 u64 res_rem_inv_err;
192
193 u64 res_mem_error;
194
195 u64 res_srq_err;
196
197 u64 res_cmp_err;
198
199 u64 res_invalid_dup_rkey;
200
201 u64 res_wqe_format_err;
202
203 u64 res_cq_load_err;
204
205 u64 res_srq_load_err;
206
207 u64 res_tx_pci_err;
208
209 u64 res_rx_pci_err;
210
211 u64 res_oos_drop_count;
212
213 u64 active_qp_count_p0;
214
215 u64 active_qp_count_p1;
216
217 u64 active_qp_count_p2;
218
219 u64 active_qp_count_p3;
220
221};
222
223struct bnxt_qplib_ext_stat {
224 u64 tx_atomic_req;
225 u64 tx_read_req;
226 u64 tx_read_res;
227 u64 tx_write_req;
228 u64 tx_send_req;
229 u64 tx_roce_pkts;
230 u64 tx_roce_bytes;
231 u64 rx_atomic_req;
232 u64 rx_read_req;
233 u64 rx_read_res;
234 u64 rx_write_req;
235 u64 rx_send_req;
236 u64 rx_roce_pkts;
237 u64 rx_roce_bytes;
238 u64 rx_roce_good_pkts;
239 u64 rx_roce_good_bytes;
240 u64 rx_out_of_buffer;
241 u64 rx_out_of_sequence;
242 u64 tx_cnp;
243 u64 rx_cnp;
244 u64 rx_ecn_marked;
245};
246
247int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res,
248 struct bnxt_qplib_sgid_tbl *sgid_tbl, int index,
249 struct bnxt_qplib_gid *gid);
250int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
251 struct bnxt_qplib_gid *gid, u16 vlan_id, bool update);
252int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
253 struct bnxt_qplib_gid *gid, const u8 *mac, u16 vlan_id,
254 bool update, u32 *index);
255int bnxt_qplib_update_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
256 struct bnxt_qplib_gid *gid, u16 gid_idx,
257 const u8 *smac);
258int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
259 struct bnxt_qplib_dev_attr *attr, bool vf);
260int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
261 struct bnxt_qplib_rcfw *rcfw,
262 struct bnxt_qplib_ctx *ctx);
263int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
264 bool block);
265void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
266 bool block);
267int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
268 struct bnxt_qplib_mrw *mrw);
269int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
270 bool block);
271int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
272 struct ib_umem *umem, int num_pbls, u32 buf_pg_size);
273int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr);
274int bnxt_qplib_alloc_fast_reg_mr(struct bnxt_qplib_res *res,
275 struct bnxt_qplib_mrw *mr, int max);
276int bnxt_qplib_alloc_fast_reg_page_list(struct bnxt_qplib_res *res,
277 struct bnxt_qplib_frpl *frpl, int max);
278int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res *res,
279 struct bnxt_qplib_frpl *frpl);
280int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids);
281int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw,
282 struct bnxt_qplib_roce_stats *stats);
283int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid,
284 struct bnxt_qplib_ext_stat *estat);
285
286#endif
287