1*14b24e2bSVaishali Kulkarni /*
2*14b24e2bSVaishali Kulkarni * CDDL HEADER START
3*14b24e2bSVaishali Kulkarni *
4*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the
5*14b24e2bSVaishali Kulkarni * Common Development and Distribution License, v.1,  (the "License").
6*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
7*14b24e2bSVaishali Kulkarni *
8*14b24e2bSVaishali Kulkarni * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*14b24e2bSVaishali Kulkarni * or http://opensource.org/licenses/CDDL-1.0.
10*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions
11*14b24e2bSVaishali Kulkarni * and limitations under the License.
12*14b24e2bSVaishali Kulkarni *
13*14b24e2bSVaishali Kulkarni * When distributing Covered Code, include this CDDL HEADER in each
14*14b24e2bSVaishali Kulkarni * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*14b24e2bSVaishali Kulkarni * If applicable, add the following below this CDDL HEADER, with the
16*14b24e2bSVaishali Kulkarni * fields enclosed by brackets "[]" replaced with your own identifying
17*14b24e2bSVaishali Kulkarni * information: Portions Copyright [yyyy] [name of copyright owner]
18*14b24e2bSVaishali Kulkarni *
19*14b24e2bSVaishali Kulkarni * CDDL HEADER END
20*14b24e2bSVaishali Kulkarni */
21*14b24e2bSVaishali Kulkarni 
22*14b24e2bSVaishali Kulkarni /*
23*14b24e2bSVaishali Kulkarni * Copyright 2014-2017 Cavium, Inc.
24*14b24e2bSVaishali Kulkarni * The contents of this file are subject to the terms of the Common Development
25*14b24e2bSVaishali Kulkarni * and Distribution License, v.1,  (the "License").
26*14b24e2bSVaishali Kulkarni 
27*14b24e2bSVaishali Kulkarni * You may not use this file except in compliance with the License.
28*14b24e2bSVaishali Kulkarni 
29*14b24e2bSVaishali Kulkarni * You can obtain a copy of the License at available
30*14b24e2bSVaishali Kulkarni * at http://opensource.org/licenses/CDDL-1.0
31*14b24e2bSVaishali Kulkarni 
32*14b24e2bSVaishali Kulkarni * See the License for the specific language governing permissions and
33*14b24e2bSVaishali Kulkarni * limitations under the License.
34*14b24e2bSVaishali Kulkarni */
35*14b24e2bSVaishali Kulkarni 
36*14b24e2bSVaishali Kulkarni #ifndef __ECORE_SP_COMMANDS_H__
37*14b24e2bSVaishali Kulkarni #define __ECORE_SP_COMMANDS_H__
38*14b24e2bSVaishali Kulkarni 
39*14b24e2bSVaishali Kulkarni #include "ecore.h"
40*14b24e2bSVaishali Kulkarni #include "ecore_spq.h"
41*14b24e2bSVaishali Kulkarni #include "ecore_sp_api.h"
42*14b24e2bSVaishali Kulkarni 
43*14b24e2bSVaishali Kulkarni #define ECORE_SP_EQ_COMPLETION  0x01
44*14b24e2bSVaishali Kulkarni #define ECORE_SP_CQE_COMPLETION 0x02
45*14b24e2bSVaishali Kulkarni 
46*14b24e2bSVaishali Kulkarni struct ecore_sp_init_data {
47*14b24e2bSVaishali Kulkarni 	/* The CID and FID aren't necessarily derived from hwfn,
48*14b24e2bSVaishali Kulkarni 	 * e.g., in IOV scenarios. CID might defer between SPQ and
49*14b24e2bSVaishali Kulkarni 	 * other elements.
50*14b24e2bSVaishali Kulkarni 	 */
51*14b24e2bSVaishali Kulkarni 	u32				cid;
52*14b24e2bSVaishali Kulkarni 	u16				opaque_fid;
53*14b24e2bSVaishali Kulkarni 
54*14b24e2bSVaishali Kulkarni 	/* Information regarding operation upon sending & completion */
55*14b24e2bSVaishali Kulkarni 	enum spq_mode			comp_mode;
56*14b24e2bSVaishali Kulkarni 	struct ecore_spq_comp_cb	*p_comp_data;
57*14b24e2bSVaishali Kulkarni 
58*14b24e2bSVaishali Kulkarni };
59*14b24e2bSVaishali Kulkarni 
60*14b24e2bSVaishali Kulkarni /**
61*14b24e2bSVaishali Kulkarni  * @brief Acquire and initialize and SPQ entry for a given ramrod.
62*14b24e2bSVaishali Kulkarni  *
63*14b24e2bSVaishali Kulkarni  * @param p_hwfn
64*14b24e2bSVaishali Kulkarni  * @param pp_ent - will be filled with a pointer to an entry upon success
65*14b24e2bSVaishali Kulkarni  * @param cmd - dependent upon protocol
66*14b24e2bSVaishali Kulkarni  * @param protocol
67*14b24e2bSVaishali Kulkarni  * @param p_data - various configuration required for ramrod
68*14b24e2bSVaishali Kulkarni  *
69*14b24e2bSVaishali Kulkarni  * @return ECORE_SUCCESS upon success, otherwise failure.
70*14b24e2bSVaishali Kulkarni  */
71*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_init_request(struct ecore_hwfn *p_hwfn,
72*14b24e2bSVaishali Kulkarni 					   struct ecore_spq_entry **pp_ent,
73*14b24e2bSVaishali Kulkarni 					   u8 cmd,
74*14b24e2bSVaishali Kulkarni 					   u8 protocol,
75*14b24e2bSVaishali Kulkarni 					   struct ecore_sp_init_data *p_data);
76*14b24e2bSVaishali Kulkarni 
77*14b24e2bSVaishali Kulkarni /**
78*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_pf_start - PF Function Start Ramrod
79*14b24e2bSVaishali Kulkarni  *
80*14b24e2bSVaishali Kulkarni  * This ramrod is sent to initialize a physical function (PF). It will
81*14b24e2bSVaishali Kulkarni  * configure the function related parameters and write its completion to the
82*14b24e2bSVaishali Kulkarni  * event ring specified in the parameters.
83*14b24e2bSVaishali Kulkarni  *
84*14b24e2bSVaishali Kulkarni  * Ramrods complete on the common event ring for the PF. This ring is
85*14b24e2bSVaishali Kulkarni  * allocated by the driver on host memory and its parameters are written
86*14b24e2bSVaishali Kulkarni  * to the internal RAM of the UStorm by the Function Start Ramrod.
87*14b24e2bSVaishali Kulkarni  *
88*14b24e2bSVaishali Kulkarni  * @param p_hwfn
89*14b24e2bSVaishali Kulkarni  * @param p_tunn - pf start tunneling configuration
90*14b24e2bSVaishali Kulkarni  * @param mode
91*14b24e2bSVaishali Kulkarni  * @param allow_npar_tx_switch - npar tx switching to be used
92*14b24e2bSVaishali Kulkarni  *	  for vports configured for tx-switching.
93*14b24e2bSVaishali Kulkarni  *
94*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
95*14b24e2bSVaishali Kulkarni  */
96*14b24e2bSVaishali Kulkarni 
97*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_pf_start(struct ecore_hwfn *p_hwfn,
98*14b24e2bSVaishali Kulkarni 				       struct ecore_tunnel_info *p_tunn,
99*14b24e2bSVaishali Kulkarni 				       enum ecore_mf_mode mode,
100*14b24e2bSVaishali Kulkarni 				       bool allow_npar_tx_switch);
101*14b24e2bSVaishali Kulkarni 
102*14b24e2bSVaishali Kulkarni /**
103*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_pf_update - PF Function Update Ramrod
104*14b24e2bSVaishali Kulkarni  *
105*14b24e2bSVaishali Kulkarni  * This ramrod updates function-related parameters. Every parameter can be
106*14b24e2bSVaishali Kulkarni  * updated independently, according to configuration flags.
107*14b24e2bSVaishali Kulkarni  *
108*14b24e2bSVaishali Kulkarni  * @note Final phase API.
109*14b24e2bSVaishali Kulkarni  *
110*14b24e2bSVaishali Kulkarni  * @param p_hwfn
111*14b24e2bSVaishali Kulkarni  *
112*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
113*14b24e2bSVaishali Kulkarni  */
114*14b24e2bSVaishali Kulkarni 
115*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_pf_update_dcbx(struct ecore_hwfn *p_hwfn);
116*14b24e2bSVaishali Kulkarni 
117*14b24e2bSVaishali Kulkarni /**
118*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_pf_stop - PF Function Stop Ramrod
119*14b24e2bSVaishali Kulkarni  *
120*14b24e2bSVaishali Kulkarni  * This ramrod is sent to close a Physical Function (PF). It is the last ramrod
121*14b24e2bSVaishali Kulkarni  * sent and the last completion written to the PFs Event Ring. This ramrod also
122*14b24e2bSVaishali Kulkarni  * deletes the context for the Slowhwfn connection on this PF.
123*14b24e2bSVaishali Kulkarni  *
124*14b24e2bSVaishali Kulkarni  * @note Not required for first packet.
125*14b24e2bSVaishali Kulkarni  *
126*14b24e2bSVaishali Kulkarni  * @param p_hwfn
127*14b24e2bSVaishali Kulkarni  *
128*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
129*14b24e2bSVaishali Kulkarni  */
130*14b24e2bSVaishali Kulkarni 
131*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_pf_stop(struct ecore_hwfn *p_hwfn);
132*14b24e2bSVaishali Kulkarni 
133*14b24e2bSVaishali Kulkarni /**
134*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_heartbeat_ramrod - Send empty Ramrod
135*14b24e2bSVaishali Kulkarni  *
136*14b24e2bSVaishali Kulkarni  * @param p_hwfn
137*14b24e2bSVaishali Kulkarni  *
138*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
139*14b24e2bSVaishali Kulkarni  */
140*14b24e2bSVaishali Kulkarni 
141*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_heartbeat_ramrod(struct ecore_hwfn *p_hwfn);
142*14b24e2bSVaishali Kulkarni 
143*14b24e2bSVaishali Kulkarni struct ecore_rl_update_params {
144*14b24e2bSVaishali Kulkarni 	u8 qcn_update_param_flg;
145*14b24e2bSVaishali Kulkarni 	u8 dcqcn_update_param_flg;
146*14b24e2bSVaishali Kulkarni 	u8 rl_init_flg;
147*14b24e2bSVaishali Kulkarni 	u8 rl_start_flg;
148*14b24e2bSVaishali Kulkarni 	u8 rl_stop_flg;
149*14b24e2bSVaishali Kulkarni 	u8 rl_id_first;
150*14b24e2bSVaishali Kulkarni 	u8 rl_id_last;
151*14b24e2bSVaishali Kulkarni 	u8 rl_dc_qcn_flg; /* If set, RL will used for DCQCN */
152*14b24e2bSVaishali Kulkarni 	u32 rl_bc_rate; /* Byte Counter Limit */
153*14b24e2bSVaishali Kulkarni 	u16 rl_max_rate; /* Maximum rate in 1.6 Mbps resolution */
154*14b24e2bSVaishali Kulkarni 	u16 rl_r_ai; /* Active increase rate */
155*14b24e2bSVaishali Kulkarni 	u16 rl_r_hai; /* Hyper active increase rate */
156*14b24e2bSVaishali Kulkarni 	u16 dcqcn_g; /* DCQCN Alpha update gain in 1/64K resolution */
157*14b24e2bSVaishali Kulkarni 	u32 dcqcn_k_us; /* DCQCN Alpha update interval */
158*14b24e2bSVaishali Kulkarni 	u32 dcqcn_timeuot_us;
159*14b24e2bSVaishali Kulkarni 	u32 qcn_timeuot_us;
160*14b24e2bSVaishali Kulkarni };
161*14b24e2bSVaishali Kulkarni 
162*14b24e2bSVaishali Kulkarni /**
163*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_rl_update - Update rate limiters
164*14b24e2bSVaishali Kulkarni  *
165*14b24e2bSVaishali Kulkarni  * @param p_hwfn
166*14b24e2bSVaishali Kulkarni  * @param params
167*14b24e2bSVaishali Kulkarni  *
168*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
169*14b24e2bSVaishali Kulkarni  */
170*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_rl_update(struct ecore_hwfn *p_hwfn,
171*14b24e2bSVaishali Kulkarni 					struct ecore_rl_update_params *params);
172*14b24e2bSVaishali Kulkarni 
173*14b24e2bSVaishali Kulkarni /**
174*14b24e2bSVaishali Kulkarni  * @brief ecore_sp_pf_update_stag - PF STAG value update Ramrod
175*14b24e2bSVaishali Kulkarni  *
176*14b24e2bSVaishali Kulkarni  * @param p_hwfn
177*14b24e2bSVaishali Kulkarni  *
178*14b24e2bSVaishali Kulkarni  * @return enum _ecore_status_t
179*14b24e2bSVaishali Kulkarni  */
180*14b24e2bSVaishali Kulkarni 
181*14b24e2bSVaishali Kulkarni enum _ecore_status_t ecore_sp_pf_update_stag(struct ecore_hwfn *p_hwfn);
182*14b24e2bSVaishali Kulkarni 
183*14b24e2bSVaishali Kulkarni #endif /*__ECORE_SP_COMMANDS_H__*/