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