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 */
13 struct init_qm_pq_params;
16 * @brief ecore_qm_pf_mem_size - Prepare QM ILT sizes
18 * Returns the required host memory size in 4KB units.
19 * Must be called before all QM init HSI functions.
21 * @param num_pf_cids - number of connections used by this PF
22 * @param num_vf_cids - number of connections used by VFs of this PF
23 * @param num_tids - number of tasks used by this PF
24 * @param num_pf_pqs - number of PQs used by this PF
25 * @param num_vf_pqs - number of PQs used by VFs of this PF
27 * @return The required host memory size in 4KB units.
29 u32 ecore_qm_pf_mem_size(u32 num_pf_cids,
36 * @brief ecore_qm_common_rt_init - Prepare QM runtime init values for engine
40 * @param max_ports_per_engine - max number of ports per engine in HW
41 * @param max_phys_tcs_per_port - max number of physical TCs per port in HW
42 * @param pf_rl_en - enable per-PF rate limiters
43 * @param pf_wfq_en - enable per-PF WFQ
44 * @param vport_rl_en - enable per-VPORT rate limiters
45 * @param vport_wfq_en - enable per-VPORT WFQ
46 * @param port_params - array of size MAX_NUM_PORTS with params for each port
48 * @return 0 on success, -1 on error.
50 int ecore_qm_common_rt_init(struct ecore_hwfn *p_hwfn,
51 u8 max_ports_per_engine,
52 u8 max_phys_tcs_per_port,
57 struct init_qm_port_params port_params[MAX_NUM_PORTS]);
60 * @brief ecore_qm_pf_rt_init Prepare QM runtime init values for the PF phase
63 * @param p_ptt - ptt window used for writing the registers
64 * @param port_id - port ID
65 * @param pf_id - PF ID
66 * @param max_phys_tcs_per_port - max number of physical TCs per port in HW
67 * @param num_pf_cids - number of connections used by this PF
68 * @param num_vf_cids - number of connections used by VFs of this PF
69 * @param num_tids - number of tasks used by this PF
70 * @param start_pq - first Tx PQ ID associated with this PF
71 * @param num_pf_pqs - number of Tx PQs associated with this PF
73 * @param num_vf_pqs - number of Tx PQs associated with a VF
74 * @param start_vport - first VPORT ID associated with this PF
75 * @param num_vports - number of VPORTs associated with this PF
76 * @param pf_wfq - WFQ weight. if PF WFQ is globally disabled, the weight must
77 * be 0. otherwise, the weight must be non-zero.
78 * @param pf_rl - rate limit in Mb/sec units. a value of 0 means don't
79 * configure. ignored if PF RL is globally disabled.
80 * @param pq_params - array of size (num_pf_pqs+num_vf_pqs) with parameters for
81 * each Tx PQ associated with the specified PF.
82 * @param vport_params - array of size num_vports with parameters for each
85 * @return 0 on success, -1 on error.
87 int ecore_qm_pf_rt_init(struct ecore_hwfn *p_hwfn,
88 struct ecore_ptt *p_ptt,
91 u8 max_phys_tcs_per_port,
102 struct init_qm_pq_params *pq_params,
103 struct init_qm_vport_params *vport_params);
106 * @brief ecore_init_pf_wfq Initializes the WFQ weight of the specified PF
109 * @param p_ptt - ptt window used for writing the registers
110 * @param pf_id - PF ID
111 * @param pf_wfq - WFQ weight. Must be non-zero.
113 * @return 0 on success, -1 on error.
115 int ecore_init_pf_wfq(struct ecore_hwfn *p_hwfn,
116 struct ecore_ptt *p_ptt,
121 * @brief ecore_init_pf_rl - Initializes the rate limit of the specified PF
124 * @param p_ptt - ptt window used for writing the registers
125 * @param pf_id - PF ID
126 * @param pf_rl - rate limit in Mb/sec units
128 * @return 0 on success, -1 on error.
130 int ecore_init_pf_rl(struct ecore_hwfn *p_hwfn,
131 struct ecore_ptt *p_ptt,
136 * @brief ecore_init_vport_wfq Initializes the WFQ weight of specified VPORT
139 * @param p_ptt - ptt window used for writing the registers
140 * @param first_tx_pq_id- An array containing the first Tx PQ ID associated
141 * with the VPORT for each TC. This array is filled by
142 * ecore_qm_pf_rt_init
143 * @param vport_wfq - WFQ weight. Must be non-zero.
145 * @return 0 on success, -1 on error.
147 int ecore_init_vport_wfq(struct ecore_hwfn *p_hwfn,
148 struct ecore_ptt *p_ptt,
149 u16 first_tx_pq_id[NUM_OF_TCS],
153 * @brief ecore_init_vport_rl - Initializes the rate limit of the specified
156 * @param p_hwfn - HW device data
157 * @param p_ptt - ptt window used for writing the registers
158 * @param vport_id - VPORT ID
159 * @param vport_rl - rate limit in Mb/sec units
161 * @return 0 on success, -1 on error.
163 int ecore_init_vport_rl(struct ecore_hwfn *p_hwfn,
164 struct ecore_ptt *p_ptt,
169 * @brief ecore_send_qm_stop_cmd Sends a stop command to the QM
172 * @param p_ptt - ptt window used for writing the registers
173 * @param is_release_cmd - true for release, false for stop.
174 * @param is_tx_pq - true for Tx PQs, false for Other PQs.
175 * @param start_pq - first PQ ID to stop
176 * @param num_pqs - Number of PQs to stop, starting from start_pq.
178 * @return bool, true if successful, false if timeout occurred while waiting
179 * for QM command done.
181 bool ecore_send_qm_stop_cmd(struct ecore_hwfn *p_hwfn,
182 struct ecore_ptt *p_ptt,
187 #ifndef UNUSED_HSI_FUNC
190 * @brief ecore_init_nig_ets - initializes the NIG ETS arbiter
192 * Based on weight/priority requirements per-TC.
194 * @param p_ptt - ptt window used for writing the registers.
195 * @param req - the NIG ETS initialization requirements.
196 * @param is_lb - if set, the loopback port arbiter is initialized, otherwise
197 * the physical port arbiter is initialized. The pure-LB TC
198 * requirements are ignored when is_lb is cleared.
200 void ecore_init_nig_ets(struct ecore_hwfn *p_hwfn,
201 struct ecore_ptt *p_ptt,
202 struct init_ets_req *req,
206 * @brief ecore_init_nig_lb_rl - initializes the NIG LB RLs
208 * Based on global and per-TC rate requirements
210 * @param p_ptt - ptt window used for writing the registers.
211 * @param req - the NIG LB RLs initialization requirements.
213 void ecore_init_nig_lb_rl(struct ecore_hwfn *p_hwfn,
214 struct ecore_ptt *p_ptt,
215 struct init_nig_lb_rl_req *req);
216 #endif /* UNUSED_HSI_FUNC */
219 * @brief ecore_init_nig_pri_tc_map - initializes the NIG priority to TC map.
221 * Assumes valid arguments.
223 * @param p_ptt - ptt window used for writing the registers.
224 * @param req - required mapping from prioirties to TCs.
226 void ecore_init_nig_pri_tc_map(struct ecore_hwfn *p_hwfn,
227 struct ecore_ptt *p_ptt,
228 struct init_nig_pri_tc_map_req *req);
230 #ifndef UNUSED_HSI_FUNC
232 * @brief ecore_init_prs_ets - initializes the PRS Rx ETS arbiter
234 * Based on weight/priority requirements per-TC.
236 * @param p_ptt - ptt window used for writing the registers.
237 * @param req - the PRS ETS initialization requirements.
239 void ecore_init_prs_ets(struct ecore_hwfn *p_hwfn,
240 struct ecore_ptt *p_ptt,
241 struct init_ets_req *req);
242 #endif /* UNUSED_HSI_FUNC */
244 #ifndef UNUSED_HSI_FUNC
246 * @brief ecore_init_brb_ram - initializes BRB RAM sizes per TC
248 * Based on weight/priority requirements per-TC.
250 * @param p_ptt - ptt window used for writing the registers.
251 * @param req - the BRB RAM initialization requirements.
253 void ecore_init_brb_ram(struct ecore_hwfn *p_hwfn,
254 struct ecore_ptt *p_ptt,
255 struct init_brb_ram_req *req);
256 #endif /* UNUSED_HSI_FUNC */
258 #ifndef UNUSED_HSI_FUNC
260 * @brief ecore_set_port_mf_ovlan_eth_type - initializes DORQ ethType Regs to
261 * input ethType should Be called
264 * @param p_hwfn - HW device data
265 * @param ethType - etherType to configure
267 void ecore_set_port_mf_ovlan_eth_type(struct ecore_hwfn *p_hwfn, u32 ethType);
268 #endif /* UNUSED_HSI_FUNC */
271 * @brief ecore_set_vxlan_dest_port - initializes vxlan tunnel destination udp
274 * @param p_ptt - ptt window used for writing the registers.
275 * @param dest_port - vxlan destination udp port.
277 void ecore_set_vxlan_dest_port(struct ecore_hwfn *p_hwfn,
278 struct ecore_ptt *p_ptt,
282 * @brief ecore_set_vxlan_enable - enable or disable VXLAN tunnel in HW
284 * @param p_ptt - ptt window used for writing the registers.
285 * @param vxlan_enable - vxlan enable flag.
287 void ecore_set_vxlan_enable(struct ecore_hwfn *p_hwfn,
288 struct ecore_ptt *p_ptt,
292 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
294 * @param p_ptt - ptt window used for writing the registers.
295 * @param eth_gre_enable - eth GRE enable enable flag.
296 * @param ip_gre_enable - IP GRE enable enable flag.
298 void ecore_set_gre_enable(struct ecore_hwfn *p_hwfn,
299 struct ecore_ptt *p_ptt,
304 * @brief ecore_set_geneve_dest_port - initializes geneve tunnel destination
307 * @param p_ptt - ptt window used for writing the registers.
308 * @param dest_port - geneve destination udp port.
310 void ecore_set_geneve_dest_port(struct ecore_hwfn *p_hwfn,
311 struct ecore_ptt *p_ptt,
315 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
317 * @param p_ptt - ptt window used for writing the registers.
318 * @param eth_geneve_enable - eth GENEVE enable enable flag.
319 * @param ip_geneve_enable - IP GENEVE enable enable flag.
321 void ecore_set_geneve_enable(struct ecore_hwfn *p_hwfn,
322 struct ecore_ptt *p_ptt,
323 bool eth_geneve_enable,
324 bool ip_geneve_enable);
325 #ifndef UNUSED_HSI_FUNC
328 * @brief ecore_set_gft_event_id_cm_hdr - configure GFT event id and cm header
330 * @param p_ptt - ptt window used for writing the registers.
332 void ecore_set_gft_event_id_cm_hdr(struct ecore_hwfn *p_hwfn,
333 struct ecore_ptt *p_ptt);
336 * @brief ecore_set_rfs_mode_disable - Disable and configure HW for RFS
338 * @param p_hwfn - HW device data
339 * @param p_ptt - ptt window used for writing the registers.
340 * @param pf_id - pf on which to disable RFS.
342 void ecore_set_rfs_mode_disable(struct ecore_hwfn *p_hwfn,
343 struct ecore_ptt *p_ptt,
347 * @brief ecore_set_rfs_mode_enable - enable and configure HW for RFS
349 * @param p_ptt - ptt window used for writing the registers.
350 * @param pf_id - pf on which to enable RFS.
351 * @param tcp - set profile tcp packets.
352 * @param udp - set profile udp packet.
353 * @param ipv4 - set profile ipv4 packet.
354 * @param ipv6 - set profile ipv6 packet.
356 void ecore_set_rfs_mode_enable(struct ecore_hwfn *p_hwfn,
357 struct ecore_ptt *p_ptt,
363 #endif /* UNUSED_HSI_FUNC */
366 * @brief ecore_config_vf_zone_size_mode - Configure VF zone size mode. Must be
367 * used before first ETH queue started.
370 * @param p_ptt - ptt window used for writing the registers. Don't care
371 * if runtime_init used
372 * @param mode - VF zone size mode. Use enum vf_zone_size_mode.
373 * @param runtime_init - Set 1 to init runtime registers in engine phase. Set 0
374 * if VF zone size mode configured after engine phase.
376 void ecore_config_vf_zone_size_mode(struct ecore_hwfn *p_hwfn, struct ecore_ptt
377 *p_ptt, u16 mode, bool runtime_init);
380 * @brief ecore_get_mstorm_queue_stat_offset - Get mstorm statistics offset by
383 * @param stat_cnt_id - statistic counter id
384 * @param vf_zone_size_mode - VF zone size mode. Use enum vf_zone_size_mode.
386 u32 ecore_get_mstorm_queue_stat_offset(struct ecore_hwfn *p_hwfn,
387 u16 stat_cnt_id, u16 vf_zone_size_mode);
390 * @brief ecore_get_mstorm_eth_vf_prods_offset - VF producer offset by VF zone
393 * @param vf_id - vf id.
394 * @param vf_queue_id - per VF rx queue id.
395 * @param vf_zone_size_mode - vf zone size mode. Use enum vf_zone_size_mode.
397 u32 ecore_get_mstorm_eth_vf_prods_offset(struct ecore_hwfn *p_hwfn, u8 vf_id, u8
398 vf_queue_id, u16 vf_zone_size_mode);
400 * @brief ecore_enable_context_validation - Enable and configure context
403 * @param p_ptt - ptt window used for writing the registers.
405 void ecore_enable_context_validation(struct ecore_hwfn *p_hwfn,
406 struct ecore_ptt *p_ptt);
408 * @brief ecore_calc_session_ctx_validation - Calcualte validation byte for
411 * @param p_ctx_mem - pointer to context memory.
412 * @param ctx_size - context size.
413 * @param ctx_type - context type.
414 * @param cid - context cid.
416 void ecore_calc_session_ctx_validation(void *p_ctx_mem, u16 ctx_size,
417 u8 ctx_type, u32 cid);
420 * @brief ecore_calc_task_ctx_validation - Calcualte validation byte for task
423 * @param p_ctx_mem - pointer to context memory.
424 * @param ctx_size - context size.
425 * @param ctx_type - context type.
426 * @param tid - context tid.
428 void ecore_calc_task_ctx_validation(void *p_ctx_mem, u16 ctx_size, u8 ctx_type,
431 * @brief ecore_memset_session_ctx - Memset session context to 0 while
432 * preserving validation bytes.
434 * @param p_hwfn - HW device data
435 * @param p_ctx_mem - pointer to context memory.
436 * @param ctx_size - size to initialzie.
437 * @param ctx_type - context type.
439 void ecore_memset_session_ctx(void *p_ctx_mem,
443 * @brief ecore_memset_task_ctx - Memset task context to 0 while preserving
446 * @param p_ctx_mem - pointer to context memory.
447 * @param ctx_size - size to initialzie.
448 * @param ctx_type - context type.
450 void ecore_memset_task_ctx(void *p_ctx_mem,