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,
35 * @brief ecore_qm_common_rt_init - Prepare QM runtime init values for engine
39 * @param max_ports_per_engine - max number of ports per engine in HW
40 * @param max_phys_tcs_per_port - max number of physical TCs per port in HW
41 * @param pf_rl_en - enable per-PF rate limiters
42 * @param pf_wfq_en - enable per-PF WFQ
43 * @param vport_rl_en - enable per-VPORT rate limiters
44 * @param vport_wfq_en - enable per-VPORT WFQ
45 * @param port_params - array of size MAX_NUM_PORTS with params for each port
47 * @return 0 on success, -1 on error.
49 int ecore_qm_common_rt_init(struct ecore_hwfn *p_hwfn,
50 u8 max_ports_per_engine,
51 u8 max_phys_tcs_per_port,
56 struct init_qm_port_params port_params[MAX_NUM_PORTS]);
58 * @brief ecore_qm_pf_rt_init Prepare QM runtime init values for the PF phase
61 * @param p_ptt - ptt window used for writing the registers
62 * @param port_id - port ID
63 * @param pf_id - PF ID
64 * @param max_phys_tcs_per_port - max number of physical TCs per port in HW
65 * @param is_first_pf - 1 = first PF in engine, 0 = othwerwise
66 * @param num_pf_cids - number of connections used by this PF
67 * @param num_vf_cids - number of connections used by VFs of this PF
68 * @param num_tids - number of tasks used by this PF
69 * @param start_pq - first Tx PQ ID associated with this PF
70 * @param num_pf_pqs - number of Tx PQs associated with this PF (non-VF)
71 * @param num_vf_pqs - number of Tx PQs associated with a VF
72 * @param start_vport - first VPORT ID associated with this PF
73 * @param num_vports - number of VPORTs associated with this PF
74 * @param pf_wfq - WFQ weight. if PF WFQ is globally disabled, the weight must
75 * be 0. otherwise, the weight must be non-zero.
76 * @param pf_rl - rate limit in Mb/sec units. a value of 0 means don't
77 * configure. ignored if PF RL is globally disabled.
78 * @param pq_params - array of size (num_pf_pqs+num_vf_pqs) with parameters for
79 * each Tx PQ associated with the specified PF.
80 * @param vport_params - array of size num_vports with parameters for each
83 * @return 0 on success, -1 on error.
85 int ecore_qm_pf_rt_init(struct ecore_hwfn *p_hwfn,
86 struct ecore_ptt *p_ptt,
89 u8 max_phys_tcs_per_port,
101 struct init_qm_pq_params *pq_params,
102 struct init_qm_vport_params *vport_params);
104 * @brief ecore_init_pf_wfq Initializes the WFQ weight of the specified PF
107 * @param p_ptt - ptt window used for writing the registers
108 * @param pf_id - PF ID
109 * @param pf_wfq - WFQ weight. Must be non-zero.
111 * @return 0 on success, -1 on error.
113 int ecore_init_pf_wfq(struct ecore_hwfn *p_hwfn,
114 struct ecore_ptt *p_ptt,
118 * @brief ecore_init_pf_rl Initializes the rate limit of the specified PF
121 * @param p_ptt - ptt window used for writing the registers
122 * @param pf_id - PF ID
123 * @param pf_rl - rate limit in Mb/sec units
125 * @return 0 on success, -1 on error.
127 int ecore_init_pf_rl(struct ecore_hwfn *p_hwfn,
128 struct ecore_ptt *p_ptt,
132 * @brief ecore_init_vport_wfq Initializes the WFQ weight of specified VPORT
135 * @param p_ptt - ptt window used for writing the registers
136 * @param first_tx_pq_id- An array containing the first Tx PQ ID associated
137 * with the VPORT for each TC. This array is filled by
138 * ecore_qm_pf_rt_init
139 * @param vport_wfq - WFQ weight. Must be non-zero.
141 * @return 0 on success, -1 on error.
143 int ecore_init_vport_wfq(struct ecore_hwfn *p_hwfn,
144 struct ecore_ptt *p_ptt,
145 u16 first_tx_pq_id[NUM_OF_TCS],
148 * @brief ecore_init_vport_rl Initializes the rate limit of the specified VPORT
151 * @param p_ptt - ptt window used for writing the registers
152 * @param vport_id - VPORT ID
153 * @param vport_rl - rate limit in Mb/sec units
155 * @return 0 on success, -1 on error.
157 int ecore_init_vport_rl(struct ecore_hwfn *p_hwfn,
158 struct ecore_ptt *p_ptt,
162 * @brief ecore_send_qm_stop_cmd Sends a stop command to the QM
165 * @param p_ptt - ptt window used for writing the registers
166 * @param is_release_cmd - true for release, false for stop.
167 * @param is_tx_pq - true for Tx PQs, false for Other PQs.
168 * @param start_pq - first PQ ID to stop
169 * @param num_pqs - Number of PQs to stop, starting from start_pq.
171 * @return bool, true if successful, false if timeout occurred while waiting
172 * for QM command done.
174 bool ecore_send_qm_stop_cmd(struct ecore_hwfn *p_hwfn,
175 struct ecore_ptt *p_ptt,
180 #ifndef UNUSED_HSI_FUNC
182 * @brief ecore_init_nig_ets - initializes the NIG ETS arbiter
184 * Based on weight/priority requirements per-TC.
186 * @param p_ptt - ptt window used for writing the registers.
187 * @param req - the NIG ETS initialization requirements.
188 * @param is_lb - if set, the loopback port arbiter is initialized, otherwise
189 * the physical port arbiter is initialized. The pure-LB TC
190 * requirements are ignored when is_lb is cleared.
192 void ecore_init_nig_ets(struct ecore_hwfn *p_hwfn,
193 struct ecore_ptt *p_ptt,
194 struct init_ets_req *req,
197 * @brief ecore_init_nig_lb_rl - initializes the NIG LB RLs
199 * Based on global and per-TC rate requirements
201 * @param p_ptt - ptt window used for writing the registers.
202 * @param req - the NIG LB RLs initialization requirements.
204 void ecore_init_nig_lb_rl(struct ecore_hwfn *p_hwfn,
205 struct ecore_ptt *p_ptt,
206 struct init_nig_lb_rl_req *req);
207 #endif /* UNUSED_HSI_FUNC */
209 * @brief ecore_init_nig_pri_tc_map - initializes the NIG priority to TC map.
211 * Assumes valid arguments.
213 * @param p_ptt - ptt window used for writing the registers.
214 * @param req - required mapping from prioirties to TCs.
216 void ecore_init_nig_pri_tc_map(struct ecore_hwfn *p_hwfn,
217 struct ecore_ptt *p_ptt,
218 struct init_nig_pri_tc_map_req *req);
219 #ifndef UNUSED_HSI_FUNC
221 * @brief ecore_init_prs_ets - initializes the PRS Rx ETS arbiter
223 * Based on weight/priority requirements per-TC.
225 * @param p_ptt - ptt window used for writing the registers.
226 * @param req - the PRS ETS initialization requirements.
228 void ecore_init_prs_ets(struct ecore_hwfn *p_hwfn,
229 struct ecore_ptt *p_ptt,
230 struct init_ets_req *req);
231 #endif /* UNUSED_HSI_FUNC */
232 #ifndef UNUSED_HSI_FUNC
234 * @brief ecore_init_brb_ram - initializes BRB RAM sizes per TC
236 * Based on weight/priority requirements per-TC.
238 * @param p_ptt - ptt window used for writing the registers.
239 * @param req - the BRB RAM initialization requirements.
241 void ecore_init_brb_ram(struct ecore_hwfn *p_hwfn,
242 struct ecore_ptt *p_ptt,
243 struct init_brb_ram_req *req);
244 #endif /* UNUSED_HSI_FUNC */
245 #ifndef UNUSED_HSI_FUNC
247 * @brief ecore_set_engine_mf_ovlan_eth_type - initializes Nig,Prs,Pbf and llh
248 * ethType Regs to input ethType
249 * should Be called once per engine
253 * @param p_ptt - ptt window used for writing the registers.
254 * @param ethType - etherType to configure
256 void ecore_set_engine_mf_ovlan_eth_type(struct ecore_hwfn *p_hwfn,
257 struct ecore_ptt *p_ptt, u32 ethType);
259 * @brief ecore_set_port_mf_ovlan_eth_type - initializes DORQ ethType Regs to
260 * input ethType should Be called
263 * @param p_ptt - ptt window used for writing the registers.
264 * @param ethType - etherType to configure
266 void ecore_set_port_mf_ovlan_eth_type(struct ecore_hwfn *p_hwfn,
267 struct ecore_ptt *p_ptt, u32 ethType);
268 #endif /* UNUSED_HSI_FUNC */
270 * @brief ecore_set_vxlan_dest_port - initializes vxlan tunnel destination udp
273 * @param p_ptt - ptt window used for writing the registers.
274 * @param dest_port - vxlan destination udp port.
276 void ecore_set_vxlan_dest_port(struct ecore_hwfn *p_hwfn,
277 struct ecore_ptt *p_ptt,
280 * @brief ecore_set_vxlan_enable - enable or disable VXLAN tunnel in HW
282 * @param p_ptt - ptt window used for writing the registers.
283 * @param vxlan_enable - vxlan enable flag.
285 void ecore_set_vxlan_enable(struct ecore_hwfn *p_hwfn,
286 struct ecore_ptt *p_ptt,
289 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
291 * @param p_ptt - ptt window used for writing the registers.
292 * @param eth_gre_enable - eth GRE enable enable flag.
293 * @param ip_gre_enable - IP GRE enable enable flag.
295 void ecore_set_gre_enable(struct ecore_hwfn *p_hwfn,
296 struct ecore_ptt *p_ptt,
300 * @brief ecore_set_geneve_dest_port - initializes geneve tunnel destination
303 * @param p_ptt - ptt window used for writing the registers.
304 * @param dest_port - geneve destination udp port.
306 void ecore_set_geneve_dest_port(struct ecore_hwfn *p_hwfn,
307 struct ecore_ptt *p_ptt,
310 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
312 * @param p_ptt - ptt window used for writing the registers.
313 * @param eth_geneve_enable - eth GENEVE enable enable flag.
314 * @param ip_geneve_enable - IP GENEVE enable enable flag.
316 void ecore_set_geneve_enable(struct ecore_hwfn *p_hwfn,
317 struct ecore_ptt *p_ptt,
318 bool eth_geneve_enable,
319 bool ip_geneve_enable);
320 #ifndef UNUSED_HSI_FUNC
322 * @brief ecore_set_gft_event_id_cm_hdr - configure GFT event id and cm header
324 * @param p_ptt - ptt window used for writing the registers.
326 void ecore_set_gft_event_id_cm_hdr(struct ecore_hwfn *p_hwfn,
327 struct ecore_ptt *p_ptt);
329 * @brief ecore_set_rfs_mode_enable - enable and configure HW for RFS
332 * @param p_ptt - ptt window used for writing the registers.
333 * @param pf_id - pf on which to enable RFS.
334 * @param tcp - set profile tcp packets.
335 * @param udp - set profile udp packet.
336 * @param ipv4 - set profile ipv4 packet.
337 * @param ipv6 - set profile ipv6 packet.
339 void ecore_set_rfs_mode_enable(struct ecore_hwfn *p_hwfn,
340 struct ecore_ptt *p_ptt,
346 #endif /* UNUSED_HSI_FUNC */
348 * @brief ecore_config_vf_zone_size_mode - Configure VF zone size mode. Must be
349 * used before first ETH queue started.
352 * @param p_ptt - ptt window used for writing the registers. Don't care
353 * if runtime_init used
354 * @param mode - VF zone size mode. Use enum vf_zone_size_mode.
355 * @param runtime_init - Set 1 to init runtime registers in engine phase. Set 0
356 * if VF zone size mode configured after engine phase.
358 void ecore_config_vf_zone_size_mode(struct ecore_hwfn *p_hwfn, struct ecore_ptt
359 *p_ptt, u16 mode, bool runtime_init);
361 * @brief ecore_get_mstorm_queue_stat_offset - get mstorm statistics offset by VF
364 * @param stat_cnt_id - statistic counter id
365 * @param vf_zone_size_mode - VF zone size mode. Use enum vf_zone_size_mode.
367 u32 ecore_get_mstorm_queue_stat_offset(struct ecore_hwfn *p_hwfn,
368 u16 stat_cnt_id, u16 vf_zone_size_mode);
370 * @brief ecore_get_mstorm_eth_vf_prods_offset - VF producer offset by VF zone
373 * @param vf_id - vf id.
374 * @param vf_queue_id - per VF rx queue id.
375 * @param vf_zone_size_mode - vf zone size mode. Use enum vf_zone_size_mode.
377 u32 ecore_get_mstorm_eth_vf_prods_offset(struct ecore_hwfn *p_hwfn, u8 vf_id, u8
378 vf_queue_id, u16 vf_zone_size_mode);