Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Broadcom NetXtreme-E RoCE driver.
0003  *
0004  * Copyright (c) 2016 - 2017, Broadcom. All rights reserved.  The term
0005  * Broadcom refers to Broadcom Limited and/or its subsidiaries.
0006  *
0007  * This software is available to you under a choice of one of two
0008  * licenses.  You may choose to be licensed under the terms of the GNU
0009  * General Public License (GPL) Version 2, available from the file
0010  * COPYING in the main directory of this source tree, or the
0011  * BSD license below:
0012  *
0013  * Redistribution and use in source and binary forms, with or without
0014  * modification, are permitted provided that the following conditions
0015  * are met:
0016  *
0017  * 1. Redistributions of source code must retain the above copyright
0018  *    notice, this list of conditions and the following disclaimer.
0019  * 2. Redistributions in binary form must reproduce the above copyright
0020  *    notice, this list of conditions and the following disclaimer in
0021  *    the documentation and/or other materials provided with the
0022  *    distribution.
0023  *
0024  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
0025  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
0026  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
0027  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
0028  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0029  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0030  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
0031  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
0032  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
0033  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
0034  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0035  *
0036  * Description: Slow Path Operators (header)
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     /* For Query AH if the hw table and SW table are differnt */
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     /* seq_err_naks_rcvd is 64 b */
0138     u64 max_retry_exceeded;
0139     /* max_retry_exceeded is 64 b */
0140     u64 rnr_naks_rcvd;
0141     /* rnr_naks_rcvd is 64 b */
0142     u64 missing_resp;
0143     u64 unrecoverable_err;
0144     /* unrecoverable_err is 64 b */
0145     u64 bad_resp_err;
0146     /* bad_resp_err is 64 b */
0147     u64 local_qp_op_err;
0148     /* local_qp_op_err is 64 b */
0149     u64 local_protection_err;
0150     /* local_protection_err is 64 b */
0151     u64 mem_mgmt_op_err;
0152     /* mem_mgmt_op_err is 64 b */
0153     u64 remote_invalid_req_err;
0154     /* remote_invalid_req_err is 64 b */
0155     u64 remote_access_err;
0156     /* remote_access_err is 64 b */
0157     u64 remote_op_err;
0158     /* remote_op_err is 64 b */
0159     u64 dup_req;
0160     /* dup_req is 64 b */
0161     u64 res_exceed_max;
0162     /* res_exceed_max is 64 b */
0163     u64 res_length_mismatch;
0164     /* res_length_mismatch is 64 b */
0165     u64 res_exceeds_wqe;
0166     /* res_exceeds_wqe is 64 b */
0167     u64 res_opcode_err;
0168     /* res_opcode_err is 64 b */
0169     u64 res_rx_invalid_rkey;
0170     /* res_rx_invalid_rkey is 64 b */
0171     u64 res_rx_domain_err;
0172     /* res_rx_domain_err is 64 b */
0173     u64 res_rx_no_perm;
0174     /* res_rx_no_perm is 64 b */
0175     u64 res_rx_range_err;
0176     /* res_rx_range_err is 64 b */
0177     u64 res_tx_invalid_rkey;
0178     /* res_tx_invalid_rkey is 64 b */
0179     u64 res_tx_domain_err;
0180     /* res_tx_domain_err is 64 b */
0181     u64 res_tx_no_perm;
0182     /* res_tx_no_perm is 64 b */
0183     u64 res_tx_range_err;
0184     /* res_tx_range_err is 64 b */
0185     u64 res_irrq_oflow;
0186     /* res_irrq_oflow is 64 b */
0187     u64 res_unsup_opcode;
0188     /* res_unsup_opcode is 64 b */
0189     u64 res_unaligned_atomic;
0190     /* res_unaligned_atomic is 64 b */
0191     u64 res_rem_inv_err;
0192     /* res_rem_inv_err is 64 b */
0193     u64 res_mem_error;
0194     /* res_mem_error is 64 b */
0195     u64 res_srq_err;
0196     /* res_srq_err is 64 b */
0197     u64 res_cmp_err;
0198     /* res_cmp_err is 64 b */
0199     u64 res_invalid_dup_rkey;
0200     /* res_invalid_dup_rkey is 64 b */
0201     u64 res_wqe_format_err;
0202     /* res_wqe_format_err is 64 b */
0203     u64 res_cq_load_err;
0204     /* res_cq_load_err is 64 b */
0205     u64 res_srq_load_err;
0206     /* res_srq_load_err is 64 b */
0207     u64 res_tx_pci_err;
0208     /* res_tx_pci_err is 64 b */
0209     u64 res_rx_pci_err;
0210     /* res_rx_pci_err is 64 b */
0211     u64 res_oos_drop_count;
0212     /* res_oos_drop_count */
0213     u64     active_qp_count_p0;
0214     /* port 0 active qps */
0215     u64     active_qp_count_p1;
0216     /* port 1 active qps */
0217     u64     active_qp_count_p2;
0218     /* port 2 active qps */
0219     u64     active_qp_count_p3;
0220     /* port 3 active qps */
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 /* __BNXT_QPLIB_SP_H__*/