xref: /freebsd/sys/dev/qlnx/qlnxe/ecore_roce.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
111e25f0dSDavid C Somayajulu /*
211e25f0dSDavid C Somayajulu  * Copyright (c) 2017-2018 Cavium, Inc.
311e25f0dSDavid C Somayajulu  * All rights reserved.
411e25f0dSDavid C Somayajulu  *
511e25f0dSDavid C Somayajulu  *  Redistribution and use in source and binary forms, with or without
611e25f0dSDavid C Somayajulu  *  modification, are permitted provided that the following conditions
711e25f0dSDavid C Somayajulu  *  are met:
811e25f0dSDavid C Somayajulu  *
911e25f0dSDavid C Somayajulu  *  1. Redistributions of source code must retain the above copyright
1011e25f0dSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer.
1111e25f0dSDavid C Somayajulu  *  2. Redistributions in binary form must reproduce the above copyright
1211e25f0dSDavid C Somayajulu  *     notice, this list of conditions and the following disclaimer in the
1311e25f0dSDavid C Somayajulu  *     documentation and/or other materials provided with the distribution.
1411e25f0dSDavid C Somayajulu  *
1511e25f0dSDavid C Somayajulu  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1611e25f0dSDavid C Somayajulu  *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1711e25f0dSDavid C Somayajulu  *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1811e25f0dSDavid C Somayajulu  *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
1911e25f0dSDavid C Somayajulu  *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2011e25f0dSDavid C Somayajulu  *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2111e25f0dSDavid C Somayajulu  *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2211e25f0dSDavid C Somayajulu  *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2311e25f0dSDavid C Somayajulu  *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2411e25f0dSDavid C Somayajulu  *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2511e25f0dSDavid C Somayajulu  *  POSSIBILITY OF SUCH DAMAGE.
2611e25f0dSDavid C Somayajulu  *
2711e25f0dSDavid C Somayajulu  */
2811e25f0dSDavid C Somayajulu 
29*217ec208SDavid C Somayajulu #ifndef __ECORE_ROCE_H__
30*217ec208SDavid C Somayajulu #define __ECORE_ROCE_H__
3111e25f0dSDavid C Somayajulu 
3211e25f0dSDavid C Somayajulu #include "ecore_status.h"
3311e25f0dSDavid C Somayajulu 
34*217ec208SDavid C Somayajulu #define ECORE_ROCE_QP_TO_ICID(qp_idx)		((qp_idx)*2)
35*217ec208SDavid C Somayajulu #define ECORE_ROCE_ICID_TO_QP(icid)		((icid)/2)
3611e25f0dSDavid C Somayajulu 
3711e25f0dSDavid C Somayajulu /* functions for enabling/disabling edpm in rdma PFs according to existence of
3811e25f0dSDavid C Somayajulu  * qps during DCBx update or bar size
3911e25f0dSDavid C Somayajulu  */
40*217ec208SDavid C Somayajulu void
41*217ec208SDavid C Somayajulu ecore_roce_dpm_dcbx(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
4211e25f0dSDavid C Somayajulu 
43*217ec208SDavid C Somayajulu void
44*217ec208SDavid C Somayajulu ecore_rdma_dpm_bar(struct ecore_hwfn *p_hwfn, struct ecore_ptt *p_ptt);
4511e25f0dSDavid C Somayajulu 
46*217ec208SDavid C Somayajulu enum _ecore_status_t
47*217ec208SDavid C Somayajulu ecore_roce_dcqcn_cfg(struct ecore_hwfn *p_hwfn,
48*217ec208SDavid C Somayajulu 		     struct ecore_roce_dcqcn_params *params,
49*217ec208SDavid C Somayajulu 		     struct roce_init_func_ramrod_data *p_ramrod,
50*217ec208SDavid C Somayajulu 		     struct ecore_ptt *p_ptt);
519efd0ba7SDavid C Somayajulu 
52*217ec208SDavid C Somayajulu enum _ecore_status_t
53*217ec208SDavid C Somayajulu ecore_roce_setup(struct ecore_hwfn *p_hwfn);
5411e25f0dSDavid C Somayajulu 
55*217ec208SDavid C Somayajulu enum _ecore_status_t
56*217ec208SDavid C Somayajulu ecore_roce_stop_rl(struct ecore_hwfn *p_hwfn);
5711e25f0dSDavid C Somayajulu 
58*217ec208SDavid C Somayajulu enum _ecore_status_t
59*217ec208SDavid C Somayajulu ecore_roce_stop(struct ecore_hwfn *p_hwfn);
6011e25f0dSDavid C Somayajulu 
61*217ec208SDavid C Somayajulu enum _ecore_status_t
62*217ec208SDavid C Somayajulu ecore_roce_query_qp(struct ecore_hwfn *p_hwfn,
63*217ec208SDavid C Somayajulu 		    struct ecore_rdma_qp *qp,
64*217ec208SDavid C Somayajulu 		    struct ecore_rdma_query_qp_out_params *out_params);
6511e25f0dSDavid C Somayajulu 
66*217ec208SDavid C Somayajulu enum _ecore_status_t
67*217ec208SDavid C Somayajulu ecore_roce_destroy_qp(struct ecore_hwfn *p_hwfn,
68*217ec208SDavid C Somayajulu 		      struct ecore_rdma_qp *qp,
69*217ec208SDavid C Somayajulu 		      struct ecore_rdma_destroy_qp_out_params *out_params);
7011e25f0dSDavid C Somayajulu 
71*217ec208SDavid C Somayajulu enum _ecore_status_t
72*217ec208SDavid C Somayajulu ecore_roce_alloc_qp_idx(struct ecore_hwfn *p_hwfn,
73*217ec208SDavid C Somayajulu 			u16 *qp_idx16);
7411e25f0dSDavid C Somayajulu 
7511e25f0dSDavid C Somayajulu #define IS_ECORE_DCQCN(p_hwfn)	\
7611e25f0dSDavid C Somayajulu 	(!!(p_hwfn->pf_params.rdma_pf_params.enable_dcqcn))
7711e25f0dSDavid C Somayajulu 
7811e25f0dSDavid C Somayajulu struct ecore_roce_info {
7911e25f0dSDavid C Somayajulu 	struct roce_events_stats	event_stats;
80*217ec208SDavid C Somayajulu 	struct roce_dcqcn_received_stats dcqcn_rx_stats;
81*217ec208SDavid C Somayajulu 	struct roce_dcqcn_sent_stats	dcqcn_tx_stats;
8211e25f0dSDavid C Somayajulu 
8311e25f0dSDavid C Somayajulu 	u8				dcqcn_enabled;
8411e25f0dSDavid C Somayajulu 	u8				dcqcn_reaction_point;
8511e25f0dSDavid C Somayajulu };
8611e25f0dSDavid C Somayajulu 
87*217ec208SDavid C Somayajulu enum _ecore_status_t
88*217ec208SDavid C Somayajulu ecore_roce_modify_qp(struct ecore_hwfn *p_hwfn,
89*217ec208SDavid C Somayajulu 		     struct ecore_rdma_qp *qp,
90*217ec208SDavid C Somayajulu 		     enum ecore_roce_qp_state prev_state,
91*217ec208SDavid C Somayajulu 		     struct ecore_rdma_modify_qp_in_params *params);
9211e25f0dSDavid C Somayajulu 
93*217ec208SDavid C Somayajulu #endif /*__ECORE_ROCE_H__*/
94