0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040 #ifndef __BNXT_QPLIB_SP_H__
0041 #define __BNXT_QPLIB_SP_H__
0042
0043 #define BNXT_QPLIB_RESERVED_QP_WRS 128
0044
0045 struct bnxt_qplib_dev_attr {
0046 #define FW_VER_ARR_LEN 4
0047 u8 fw_ver[FW_VER_ARR_LEN];
0048 #define BNXT_QPLIB_NUM_GIDS_SUPPORTED 256
0049 u16 max_sgid;
0050 u16 max_mrw;
0051 u32 max_qp;
0052 #define BNXT_QPLIB_MAX_OUT_RD_ATOM 126
0053 u32 max_qp_rd_atom;
0054 u32 max_qp_init_rd_atom;
0055 u32 max_qp_wqes;
0056 u32 max_qp_sges;
0057 u32 max_cq;
0058 u32 max_cq_wqes;
0059 u32 max_cq_sges;
0060 u32 max_mr;
0061 u64 max_mr_size;
0062 u32 max_pd;
0063 u32 max_mw;
0064 u32 max_raw_ethy_qp;
0065 u32 max_ah;
0066 u32 max_srq;
0067 u32 max_srq_wqes;
0068 u32 max_srq_sges;
0069 u32 max_pkey;
0070 u32 max_inline_data;
0071 u32 l2_db_size;
0072 u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ];
0073 bool is_atomic;
0074 u16 dev_cap_flags;
0075 };
0076
0077 struct bnxt_qplib_pd {
0078 u32 id;
0079 };
0080
0081 struct bnxt_qplib_gid {
0082 u8 data[16];
0083 };
0084
0085 struct bnxt_qplib_gid_info {
0086 struct bnxt_qplib_gid gid;
0087 u16 vlan_id;
0088 };
0089
0090 struct bnxt_qplib_ah {
0091 struct bnxt_qplib_gid dgid;
0092 struct bnxt_qplib_pd *pd;
0093 u32 id;
0094 u8 sgid_index;
0095
0096 u8 host_sgid_index;
0097 u8 traffic_class;
0098 u32 flow_label;
0099 u8 hop_limit;
0100 u8 sl;
0101 u8 dmac[6];
0102 u16 vlan_id;
0103 u8 nw_type;
0104 };
0105
0106 struct bnxt_qplib_mrw {
0107 struct bnxt_qplib_pd *pd;
0108 int type;
0109 u32 flags;
0110 #define BNXT_QPLIB_FR_PMR 0x80000000
0111 u32 lkey;
0112 u32 rkey;
0113 #define BNXT_QPLIB_RSVD_LKEY 0xFFFFFFFF
0114 u64 va;
0115 u64 total_size;
0116 u32 npages;
0117 u64 mr_handle;
0118 struct bnxt_qplib_hwq hwq;
0119 };
0120
0121 struct bnxt_qplib_frpl {
0122 int max_pg_ptrs;
0123 struct bnxt_qplib_hwq hwq;
0124 };
0125
0126 #define BNXT_QPLIB_ACCESS_LOCAL_WRITE BIT(0)
0127 #define BNXT_QPLIB_ACCESS_REMOTE_READ BIT(1)
0128 #define BNXT_QPLIB_ACCESS_REMOTE_WRITE BIT(2)
0129 #define BNXT_QPLIB_ACCESS_REMOTE_ATOMIC BIT(3)
0130 #define BNXT_QPLIB_ACCESS_MW_BIND BIT(4)
0131 #define BNXT_QPLIB_ACCESS_ZERO_BASED BIT(5)
0132 #define BNXT_QPLIB_ACCESS_ON_DEMAND BIT(6)
0133
0134 struct bnxt_qplib_roce_stats {
0135 u64 to_retransmits;
0136 u64 seq_err_naks_rcvd;
0137
0138 u64 max_retry_exceeded;
0139
0140 u64 rnr_naks_rcvd;
0141
0142 u64 missing_resp;
0143 u64 unrecoverable_err;
0144
0145 u64 bad_resp_err;
0146
0147 u64 local_qp_op_err;
0148
0149 u64 local_protection_err;
0150
0151 u64 mem_mgmt_op_err;
0152
0153 u64 remote_invalid_req_err;
0154
0155 u64 remote_access_err;
0156
0157 u64 remote_op_err;
0158
0159 u64 dup_req;
0160
0161 u64 res_exceed_max;
0162
0163 u64 res_length_mismatch;
0164
0165 u64 res_exceeds_wqe;
0166
0167 u64 res_opcode_err;
0168
0169 u64 res_rx_invalid_rkey;
0170
0171 u64 res_rx_domain_err;
0172
0173 u64 res_rx_no_perm;
0174
0175 u64 res_rx_range_err;
0176
0177 u64 res_tx_invalid_rkey;
0178
0179 u64 res_tx_domain_err;
0180
0181 u64 res_tx_no_perm;
0182
0183 u64 res_tx_range_err;
0184
0185 u64 res_irrq_oflow;
0186
0187 u64 res_unsup_opcode;
0188
0189 u64 res_unaligned_atomic;
0190
0191 u64 res_rem_inv_err;
0192
0193 u64 res_mem_error;
0194
0195 u64 res_srq_err;
0196
0197 u64 res_cmp_err;
0198
0199 u64 res_invalid_dup_rkey;
0200
0201 u64 res_wqe_format_err;
0202
0203 u64 res_cq_load_err;
0204
0205 u64 res_srq_load_err;
0206
0207 u64 res_tx_pci_err;
0208
0209 u64 res_rx_pci_err;
0210
0211 u64 res_oos_drop_count;
0212
0213 u64 active_qp_count_p0;
0214
0215 u64 active_qp_count_p1;
0216
0217 u64 active_qp_count_p2;
0218
0219 u64 active_qp_count_p3;
0220
0221 };
0222
0223 struct bnxt_qplib_ext_stat {
0224 u64 tx_atomic_req;
0225 u64 tx_read_req;
0226 u64 tx_read_res;
0227 u64 tx_write_req;
0228 u64 tx_send_req;
0229 u64 tx_roce_pkts;
0230 u64 tx_roce_bytes;
0231 u64 rx_atomic_req;
0232 u64 rx_read_req;
0233 u64 rx_read_res;
0234 u64 rx_write_req;
0235 u64 rx_send_req;
0236 u64 rx_roce_pkts;
0237 u64 rx_roce_bytes;
0238 u64 rx_roce_good_pkts;
0239 u64 rx_roce_good_bytes;
0240 u64 rx_out_of_buffer;
0241 u64 rx_out_of_sequence;
0242 u64 tx_cnp;
0243 u64 rx_cnp;
0244 u64 rx_ecn_marked;
0245 };
0246
0247 int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res,
0248 struct bnxt_qplib_sgid_tbl *sgid_tbl, int index,
0249 struct bnxt_qplib_gid *gid);
0250 int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
0251 struct bnxt_qplib_gid *gid, u16 vlan_id, bool update);
0252 int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
0253 struct bnxt_qplib_gid *gid, const u8 *mac, u16 vlan_id,
0254 bool update, u32 *index);
0255 int bnxt_qplib_update_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
0256 struct bnxt_qplib_gid *gid, u16 gid_idx,
0257 const u8 *smac);
0258 int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
0259 struct bnxt_qplib_dev_attr *attr, bool vf);
0260 int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
0261 struct bnxt_qplib_rcfw *rcfw,
0262 struct bnxt_qplib_ctx *ctx);
0263 int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
0264 bool block);
0265 void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
0266 bool block);
0267 int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
0268 struct bnxt_qplib_mrw *mrw);
0269 int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
0270 bool block);
0271 int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
0272 struct ib_umem *umem, int num_pbls, u32 buf_pg_size);
0273 int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr);
0274 int bnxt_qplib_alloc_fast_reg_mr(struct bnxt_qplib_res *res,
0275 struct bnxt_qplib_mrw *mr, int max);
0276 int bnxt_qplib_alloc_fast_reg_page_list(struct bnxt_qplib_res *res,
0277 struct bnxt_qplib_frpl *frpl, int max);
0278 int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res *res,
0279 struct bnxt_qplib_frpl *frpl);
0280 int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids);
0281 int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw,
0282 struct bnxt_qplib_roce_stats *stats);
0283 int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid,
0284 struct bnxt_qplib_ext_stat *estat);
0285
0286 #endif