2 * Copyright (c) 2017-2018 Cavium, Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
31 #ifndef __ECORE_ROCE_H__
32 #define __ECORE_ROCE_H__
34 #include "ecore_status.h"
36 #define ECORE_ROCE_QP_TO_ICID(qp_idx) ((qp_idx)*2)
37 #define ECORE_ROCE_ICID_TO_QP(icid) ((icid)/2)
39 /* functions for enabling/disabling edpm in rdma PFs according to existence of
40 * qps during DCBx update or bar size
43 ecore_roce_dpm_dcbx(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
46 ecore_rdma_dpm_bar(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
49 ecore_roce_dcqcn_cfg(struct ecore_hwfn *p_hwfn,
50 struct ecore_roce_dcqcn_params *params,
51 struct roce_init_func_ramrod_data *p_ramrod,
52 struct ecore_ptt *p_ptt);
55 ecore_roce_setup(struct ecore_hwfn *p_hwfn);
58 ecore_roce_stop_rl(struct ecore_hwfn *p_hwfn);
61 ecore_roce_stop(struct ecore_hwfn *p_hwfn);
64 ecore_roce_query_qp(struct ecore_hwfn *p_hwfn,
65 struct ecore_rdma_qp *qp,
66 struct ecore_rdma_query_qp_out_params *out_params);
69 ecore_roce_destroy_qp(struct ecore_hwfn *p_hwfn,
70 struct ecore_rdma_qp *qp,
71 struct ecore_rdma_destroy_qp_out_params *out_params);
74 ecore_roce_alloc_qp_idx(struct ecore_hwfn *p_hwfn,
77 #define IS_ECORE_DCQCN(p_hwfn) \
78 (!!(p_hwfn->pf_params.rdma_pf_params.enable_dcqcn))
80 struct ecore_roce_info {
81 struct roce_events_stats event_stats;
82 struct roce_dcqcn_received_stats dcqcn_rx_stats;
83 struct roce_dcqcn_sent_stats dcqcn_tx_stats;
86 u8 dcqcn_reaction_point;
90 ecore_roce_modify_qp(struct ecore_hwfn *p_hwfn,
91 struct ecore_rdma_qp *qp,
92 enum ecore_roce_qp_state prev_state,
93 struct ecore_rdma_modify_qp_in_params *params);
95 #endif /*__ECORE_ROCE_H__*/