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};
75
76struct bnxt_qplib_pd {
77 u32 id;
78};
79
80struct bnxt_qplib_gid {
81 u8 data[16];
82};
83
84struct bnxt_qplib_gid_info {
85 struct bnxt_qplib_gid gid;
86 u16 vlan_id;
87};
88
89struct bnxt_qplib_ah {
90 struct bnxt_qplib_gid dgid;
91 struct bnxt_qplib_pd *pd;
92 u32 id;
93 u8 sgid_index;
94
95 u8 host_sgid_index;
96 u8 traffic_class;
97 u32 flow_label;
98 u8 hop_limit;
99 u8 sl;
100 u8 dmac[6];
101 u16 vlan_id;
102 u8 nw_type;
103};
104
105struct bnxt_qplib_mrw {
106 struct bnxt_qplib_pd *pd;
107 int type;
108 u32 flags;
109#define BNXT_QPLIB_FR_PMR 0x80000000
110 u32 lkey;
111 u32 rkey;
112#define BNXT_QPLIB_RSVD_LKEY 0xFFFFFFFF
113 u64 va;
114 u64 total_size;
115 u32 npages;
116 u64 mr_handle;
117 struct bnxt_qplib_hwq hwq;
118};
119
120struct bnxt_qplib_frpl {
121 int max_pg_ptrs;
122 struct bnxt_qplib_hwq hwq;
123};
124
125#define BNXT_QPLIB_ACCESS_LOCAL_WRITE BIT(0)
126#define BNXT_QPLIB_ACCESS_REMOTE_READ BIT(1)
127#define BNXT_QPLIB_ACCESS_REMOTE_WRITE BIT(2)
128#define BNXT_QPLIB_ACCESS_REMOTE_ATOMIC BIT(3)
129#define BNXT_QPLIB_ACCESS_MW_BIND BIT(4)
130#define BNXT_QPLIB_ACCESS_ZERO_BASED BIT(5)
131#define BNXT_QPLIB_ACCESS_ON_DEMAND BIT(6)
132
133struct bnxt_qplib_roce_stats {
134 u64 to_retransmits;
135 u64 seq_err_naks_rcvd;
136
137 u64 max_retry_exceeded;
138
139 u64 rnr_naks_rcvd;
140
141 u64 missing_resp;
142 u64 unrecoverable_err;
143
144 u64 bad_resp_err;
145
146 u64 local_qp_op_err;
147
148 u64 local_protection_err;
149
150 u64 mem_mgmt_op_err;
151
152 u64 remote_invalid_req_err;
153
154 u64 remote_access_err;
155
156 u64 remote_op_err;
157
158 u64 dup_req;
159
160 u64 res_exceed_max;
161
162 u64 res_length_mismatch;
163
164 u64 res_exceeds_wqe;
165
166 u64 res_opcode_err;
167
168 u64 res_rx_invalid_rkey;
169
170 u64 res_rx_domain_err;
171
172 u64 res_rx_no_perm;
173
174 u64 res_rx_range_err;
175
176 u64 res_tx_invalid_rkey;
177
178 u64 res_tx_domain_err;
179
180 u64 res_tx_no_perm;
181
182 u64 res_tx_range_err;
183
184 u64 res_irrq_oflow;
185
186 u64 res_unsup_opcode;
187
188 u64 res_unaligned_atomic;
189
190 u64 res_rem_inv_err;
191
192 u64 res_mem_error;
193
194 u64 res_srq_err;
195
196 u64 res_cmp_err;
197
198 u64 res_invalid_dup_rkey;
199
200 u64 res_wqe_format_err;
201
202 u64 res_cq_load_err;
203
204 u64 res_srq_load_err;
205
206 u64 res_tx_pci_err;
207
208 u64 res_rx_pci_err;
209
210 u64 res_oos_drop_count;
211
212 u64 active_qp_count_p0;
213
214 u64 active_qp_count_p1;
215
216 u64 active_qp_count_p2;
217
218 u64 active_qp_count_p3;
219
220};
221
222int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res,
223 struct bnxt_qplib_sgid_tbl *sgid_tbl, int index,
224 struct bnxt_qplib_gid *gid);
225int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
226 struct bnxt_qplib_gid *gid, u16 vlan_id, bool update);
227int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
228 struct bnxt_qplib_gid *gid, u8 *mac, u16 vlan_id,
229 bool update, u32 *index);
230int bnxt_qplib_update_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
231 struct bnxt_qplib_gid *gid, u16 gid_idx, u8 *smac);
232int bnxt_qplib_get_pkey(struct bnxt_qplib_res *res,
233 struct bnxt_qplib_pkey_tbl *pkey_tbl, u16 index,
234 u16 *pkey);
235int bnxt_qplib_del_pkey(struct bnxt_qplib_res *res,
236 struct bnxt_qplib_pkey_tbl *pkey_tbl, u16 *pkey,
237 bool update);
238int bnxt_qplib_add_pkey(struct bnxt_qplib_res *res,
239 struct bnxt_qplib_pkey_tbl *pkey_tbl, u16 *pkey,
240 bool update);
241int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
242 struct bnxt_qplib_dev_attr *attr, bool vf);
243int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
244 struct bnxt_qplib_rcfw *rcfw,
245 struct bnxt_qplib_ctx *ctx);
246int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
247 bool block);
248void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
249 bool block);
250int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
251 struct bnxt_qplib_mrw *mrw);
252int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
253 bool block);
254int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
255 struct ib_umem *umem, int num_pbls, u32 buf_pg_size);
256int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr);
257int bnxt_qplib_alloc_fast_reg_mr(struct bnxt_qplib_res *res,
258 struct bnxt_qplib_mrw *mr, int max);
259int bnxt_qplib_alloc_fast_reg_page_list(struct bnxt_qplib_res *res,
260 struct bnxt_qplib_frpl *frpl, int max);
261int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res *res,
262 struct bnxt_qplib_frpl *frpl);
263int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids);
264int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw,
265 struct bnxt_qplib_roce_stats *stats);
266#endif
267