2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
9 #ifndef _INIT_FW_FUNCS_H
10 #define _INIT_FW_FUNCS_H
11 /* forward declarations */
12 struct init_qm_pq_params;
14 * @brief ecore_qm_pf_mem_size - prepare QM ILT sizes
16 * Returns the required host memory size in 4KB units.
17 * Must be called before all QM init HSI functions.
19 * @param pf_id - physical function ID
20 * @param num_pf_cids - number of connections used by this PF
21 * @param num_vf_cids - number of connections used by VFs of this PF
22 * @param num_tids - number of tasks used by this PF
23 * @param num_pf_pqs - number of PQs used by this PF
24 * @param num_vf_pqs - number of PQs used by VFs of this PF
26 * @return The required host memory size in 4KB units.
28 u32 ecore_qm_pf_mem_size(u8 pf_id,
31 u32 num_tids, u16 num_pf_pqs, u16 num_vf_pqs);
33 * @brief ecore_qm_common_rt_init -
34 * Prepare QM runtime init values for the engine phase
37 * @param max_ports_per_engine - max number of ports per engine in HW
38 * @param max_phys_tcs_per_port - max number of physical TCs per port in HW
39 * @param pf_rl_en - enable per-PF rate limiters
40 * @param pf_wfq_en - enable per-PF WFQ
41 * @param vport_rl_en - enable per-VPORT rate limiters
42 * @param vport_wfq_en - enable per-VPORT WFQ
43 * @param port_params - array of size MAX_NUM_PORTS with params for each port
45 * @return 0 on success, -1 on error.
47 int ecore_qm_common_rt_init(struct ecore_hwfn *p_hwfn,
48 u8 max_ports_per_engine,
49 u8 max_phys_tcs_per_port,
54 struct init_qm_port_params
55 port_params[MAX_NUM_PORTS]);
57 int ecore_qm_pf_rt_init(struct ecore_hwfn *p_hwfn,
58 struct ecore_ptt *p_ptt,
61 u8 max_phys_tcs_per_port,
73 struct init_qm_pq_params *pq_params,
74 struct init_qm_vport_params *vport_params);
76 * @brief ecore_init_pf_wfq Initializes the WFQ weight of the specified PF
79 * @param p_ptt - ptt window used for writing the registers
80 * @param pf_id - PF ID
81 * @param pf_wfq - WFQ weight. Must be non-zero.
83 * @return 0 on success, -1 on error.
85 int ecore_init_pf_wfq(struct ecore_hwfn *p_hwfn,
86 struct ecore_ptt *p_ptt,
90 * @brief ecore_init_pf_rl Initializes the rate limit of the specified PF
93 * @param p_ptt - ptt window used for writing the registers
94 * @param pf_id - PF ID
95 * @param pf_rl - rate limit in Mb/sec units
97 * @return 0 on success, -1 on error.
99 int ecore_init_pf_rl(struct ecore_hwfn *p_hwfn,
100 struct ecore_ptt *p_ptt,
104 * @brief ecore_init_vport_wfq Initializes the WFQ weight of specified VPORT
107 * @param p_ptt - ptt window used for writing the registers
108 * @param first_tx_pq_id- An array containing the first Tx PQ ID associated
109 * with the VPORT for each TC. This array is filled by
110 * ecore_qm_pf_rt_init
111 * @param vport_wfq - WFQ weight. Must be non-zero.
113 * @return 0 on success, -1 on error.
115 int ecore_init_vport_wfq(struct ecore_hwfn *p_hwfn,
116 struct ecore_ptt *p_ptt,
117 u16 first_tx_pq_id[NUM_OF_TCS],
120 * @brief ecore_init_vport_rl Initializes the rate limit of the specified VPORT
123 * @param p_ptt - ptt window used for writing the registers
124 * @param vport_id - VPORT ID
125 * @param vport_rl - rate limit in Mb/sec units
127 * @return 0 on success, -1 on error.
129 int ecore_init_vport_rl(struct ecore_hwfn *p_hwfn,
130 struct ecore_ptt *p_ptt,
134 * @brief ecore_send_qm_stop_cmd Sends a stop command to the QM
137 * @param p_ptt - ptt window used for writing the registers
138 * @param is_release_cmd - true for release, false for stop.
139 * @param is_tx_pq - true for Tx PQs, false for Other PQs.
140 * @param start_pq - first PQ ID to stop
141 * @param num_pqs - Number of PQs to stop, starting from start_pq.
143 * @return bool, true if successful, false if timeout occurred while waiting
144 * for QM command done.
146 bool ecore_send_qm_stop_cmd(struct ecore_hwfn *p_hwfn,
147 struct ecore_ptt *p_ptt,
152 #ifndef UNUSED_HSI_FUNC
154 * @brief ecore_init_nig_ets - initializes the NIG ETS arbiter
156 * Based on weight/priority requirements per-TC.
158 * @param p_ptt - ptt window used for writing the registers.
159 * @param req - the NIG ETS initialization requirements.
160 * @param is_lb - if set, the loopback port arbiter is initialized, otherwise
161 * the physical port arbiter is initialized. The pure-LB TC
162 * requirements are ignored when is_lb is cleared.
164 void ecore_init_nig_ets(struct ecore_hwfn *p_hwfn,
165 struct ecore_ptt *p_ptt,
166 struct init_ets_req *req,
169 * @brief ecore_init_nig_lb_rl - initializes the NIG LB RLs
171 * Based on global and per-TC rate requirements
173 * @param p_ptt - ptt window used for writing the registers.
174 * @param req - the NIG LB RLs initialization requirements.
176 void ecore_init_nig_lb_rl(struct ecore_hwfn *p_hwfn,
177 struct ecore_ptt *p_ptt,
178 struct init_nig_lb_rl_req *req);
179 #endif /* UNUSED_HSI_FUNC */
181 * @brief ecore_init_nig_pri_tc_map - initializes the NIG priority to TC map.
183 * Assumes valid arguments.
185 * @param p_ptt - ptt window used for writing the registers.
186 * @param req - required mapping from prioirties to TCs.
188 void ecore_init_nig_pri_tc_map(struct ecore_hwfn *p_hwfn,
189 struct ecore_ptt *p_ptt,
190 struct init_nig_pri_tc_map_req *req);
191 #ifndef UNUSED_HSI_FUNC
193 * @brief ecore_init_prs_ets - initializes the PRS Rx ETS arbiter
195 * Based on weight/priority requirements per-TC.
197 * @param p_ptt - ptt window used for writing the registers.
198 * @param req - the PRS ETS initialization requirements.
200 void ecore_init_prs_ets(struct ecore_hwfn *p_hwfn,
201 struct ecore_ptt *p_ptt,
202 struct init_ets_req *req);
203 #endif /* UNUSED_HSI_FUNC */
204 #ifndef UNUSED_HSI_FUNC
206 * @brief ecore_init_brb_ram - initializes BRB RAM sizes per TC
208 * Based on weight/priority requirements per-TC.
210 * @param p_ptt - ptt window used for writing the registers.
211 * @param req - the BRB RAM initialization requirements.
213 void ecore_init_brb_ram(struct ecore_hwfn *p_hwfn,
214 struct ecore_ptt *p_ptt,
215 struct init_brb_ram_req *req);
216 #endif /* UNUSED_HSI_FUNC */
217 #ifndef UNUSED_HSI_FUNC
219 * @brief ecore_set_engine_mf_ovlan_eth_type - initializes Nig,Prs,Pbf and llh
220 * ethType Regs to input ethType
221 * should Be called once per engine
225 * @param p_ptt - ptt window used for writing the registers.
226 * @param ethType - etherType to configure
228 void ecore_set_engine_mf_ovlan_eth_type(struct ecore_hwfn *p_hwfn,
229 struct ecore_ptt *p_ptt, u32 ethType);
231 * @brief ecore_set_port_mf_ovlan_eth_type - initializes DORQ ethType Regs to
232 * input ethType should Be called
235 * @param p_ptt - ptt window used for writing the registers.
236 * @param ethType - etherType to configure
238 void ecore_set_port_mf_ovlan_eth_type(struct ecore_hwfn *p_hwfn,
239 struct ecore_ptt *p_ptt, u32 ethType);
240 #endif /* UNUSED_HSI_FUNC */
242 * @brief ecore_set_vxlan_dest_port - initializes vxlan tunnel destination udp
245 * @param p_ptt - ptt window used for writing the registers.
246 * @param dest_port - vxlan destination udp port.
248 void ecore_set_vxlan_dest_port(struct ecore_hwfn *p_hwfn,
249 struct ecore_ptt *p_ptt,
252 * @brief ecore_set_vxlan_enable - enable or disable VXLAN tunnel in HW
254 * @param p_ptt - ptt window used for writing the registers.
255 * @param vxlan_enable - vxlan enable flag.
257 void ecore_set_vxlan_enable(struct ecore_hwfn *p_hwfn,
258 struct ecore_ptt *p_ptt,
261 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
263 * @param p_ptt - ptt window used for writing the registers.
264 * @param eth_gre_enable - eth GRE enable enable flag.
265 * @param ip_gre_enable - IP GRE enable enable flag.
267 void ecore_set_gre_enable(struct ecore_hwfn *p_hwfn,
268 struct ecore_ptt *p_ptt,
272 * @brief ecore_set_geneve_dest_port - initializes geneve tunnel destination
275 * @param p_ptt - ptt window used for writing the registers.
276 * @param dest_port - geneve destination udp port.
278 void ecore_set_geneve_dest_port(struct ecore_hwfn *p_hwfn,
279 struct ecore_ptt *p_ptt,
282 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
284 * @param p_ptt - ptt window used for writing the registers.
285 * @param eth_geneve_enable - eth GENEVE enable enable flag.
286 * @param ip_geneve_enable - IP GENEVE enable enable flag.
288 void ecore_set_geneve_enable(struct ecore_hwfn *p_hwfn,
289 struct ecore_ptt *p_ptt,
290 bool eth_geneve_enable, bool ip_geneve_enable);