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 link_speed - link speed in Mbps.
81 * @param pq_params - array of size (num_pf_pqs+num_vf_pqs) with parameters for
82 * each Tx PQ associated with the specified PF.
83 * @param vport_params - array of size num_vports with parameters for each
86 * @return 0 on success, -1 on error.
88 int ecore_qm_pf_rt_init(struct ecore_hwfn *p_hwfn,
89 struct ecore_ptt *p_ptt,
92 u8 max_phys_tcs_per_port,
104 struct init_qm_pq_params *pq_params,
105 struct init_qm_vport_params *vport_params);
108 * @brief ecore_init_pf_wfq Initializes the WFQ weight of the specified PF
111 * @param p_ptt - ptt window used for writing the registers
112 * @param pf_id - PF ID
113 * @param pf_wfq - WFQ weight. Must be non-zero.
115 * @return 0 on success, -1 on error.
117 int ecore_init_pf_wfq(struct ecore_hwfn *p_hwfn,
118 struct ecore_ptt *p_ptt,
123 * @brief ecore_init_pf_rl - Initializes the rate limit of the specified PF
126 * @param p_ptt - ptt window used for writing the registers
127 * @param pf_id - PF ID
128 * @param pf_rl - rate limit in Mb/sec units
130 * @return 0 on success, -1 on error.
132 int ecore_init_pf_rl(struct ecore_hwfn *p_hwfn,
133 struct ecore_ptt *p_ptt,
138 * @brief ecore_init_vport_wfq Initializes the WFQ weight of specified VPORT
141 * @param p_ptt - ptt window used for writing the registers
142 * @param first_tx_pq_id- An array containing the first Tx PQ ID associated
143 * with the VPORT for each TC. This array is filled by
144 * ecore_qm_pf_rt_init
145 * @param vport_wfq - WFQ weight. Must be non-zero.
147 * @return 0 on success, -1 on error.
149 int ecore_init_vport_wfq(struct ecore_hwfn *p_hwfn,
150 struct ecore_ptt *p_ptt,
151 u16 first_tx_pq_id[NUM_OF_TCS],
155 * @brief ecore_init_vport_rl - Initializes the rate limit of the specified
158 * @param p_hwfn - HW device data
159 * @param p_ptt - ptt window used for writing the registers
160 * @param vport_id - VPORT ID
161 * @param vport_rl - rate limit in Mb/sec units
162 * @param link_speed - link speed in Mbps.
164 * @return 0 on success, -1 on error.
166 int ecore_init_vport_rl(struct ecore_hwfn *p_hwfn,
167 struct ecore_ptt *p_ptt,
173 * @brief ecore_send_qm_stop_cmd Sends a stop command to the QM
176 * @param p_ptt - ptt window used for writing the registers
177 * @param is_release_cmd - true for release, false for stop.
178 * @param is_tx_pq - true for Tx PQs, false for Other PQs.
179 * @param start_pq - first PQ ID to stop
180 * @param num_pqs - Number of PQs to stop, starting from start_pq.
182 * @return bool, true if successful, false if timeout occurred while waiting
183 * for QM command done.
185 bool ecore_send_qm_stop_cmd(struct ecore_hwfn *p_hwfn,
186 struct ecore_ptt *p_ptt,
191 #ifndef UNUSED_HSI_FUNC
194 * @brief ecore_init_nig_ets - initializes the NIG ETS arbiter
196 * Based on weight/priority requirements per-TC.
198 * @param p_ptt - ptt window used for writing the registers.
199 * @param req - the NIG ETS initialization requirements.
200 * @param is_lb - if set, the loopback port arbiter is initialized, otherwise
201 * the physical port arbiter is initialized. The pure-LB TC
202 * requirements are ignored when is_lb is cleared.
204 void ecore_init_nig_ets(struct ecore_hwfn *p_hwfn,
205 struct ecore_ptt *p_ptt,
206 struct init_ets_req *req,
210 * @brief ecore_init_nig_lb_rl - initializes the NIG LB RLs
212 * Based on global and per-TC rate requirements
214 * @param p_ptt - ptt window used for writing the registers.
215 * @param req - the NIG LB RLs initialization requirements.
217 void ecore_init_nig_lb_rl(struct ecore_hwfn *p_hwfn,
218 struct ecore_ptt *p_ptt,
219 struct init_nig_lb_rl_req *req);
220 #endif /* UNUSED_HSI_FUNC */
223 * @brief ecore_init_nig_pri_tc_map - initializes the NIG priority to TC map.
225 * Assumes valid arguments.
227 * @param p_ptt - ptt window used for writing the registers.
228 * @param req - required mapping from prioirties to TCs.
230 void ecore_init_nig_pri_tc_map(struct ecore_hwfn *p_hwfn,
231 struct ecore_ptt *p_ptt,
232 struct init_nig_pri_tc_map_req *req);
234 #ifndef UNUSED_HSI_FUNC
236 * @brief ecore_init_prs_ets - initializes the PRS Rx ETS arbiter
238 * Based on weight/priority requirements per-TC.
240 * @param p_ptt - ptt window used for writing the registers.
241 * @param req - the PRS ETS initialization requirements.
243 void ecore_init_prs_ets(struct ecore_hwfn *p_hwfn,
244 struct ecore_ptt *p_ptt,
245 struct init_ets_req *req);
246 #endif /* UNUSED_HSI_FUNC */
248 #ifndef UNUSED_HSI_FUNC
250 * @brief ecore_init_brb_ram - initializes BRB RAM sizes per TC
252 * Based on weight/priority requirements per-TC.
254 * @param p_ptt - ptt window used for writing the registers.
255 * @param req - the BRB RAM initialization requirements.
257 void ecore_init_brb_ram(struct ecore_hwfn *p_hwfn,
258 struct ecore_ptt *p_ptt,
259 struct init_brb_ram_req *req);
260 #endif /* UNUSED_HSI_FUNC */
262 #ifndef UNUSED_HSI_FUNC
264 * @brief ecore_set_port_mf_ovlan_eth_type - initializes DORQ ethType Regs to
265 * input ethType should Be called
268 * @param p_hwfn - HW device data
269 * @param ethType - etherType to configure
271 void ecore_set_port_mf_ovlan_eth_type(struct ecore_hwfn *p_hwfn,
273 #endif /* UNUSED_HSI_FUNC */
276 * @brief ecore_set_vxlan_dest_port - initializes vxlan tunnel destination udp
279 * @param p_ptt - ptt window used for writing the registers.
280 * @param dest_port - vxlan destination udp port.
282 void ecore_set_vxlan_dest_port(struct ecore_hwfn *p_hwfn,
283 struct ecore_ptt *p_ptt,
287 * @brief ecore_set_vxlan_enable - enable or disable VXLAN tunnel in HW
289 * @param p_ptt - ptt window used for writing the registers.
290 * @param vxlan_enable - vxlan enable flag.
292 void ecore_set_vxlan_enable(struct ecore_hwfn *p_hwfn,
293 struct ecore_ptt *p_ptt,
297 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
299 * @param p_ptt - ptt window used for writing the registers.
300 * @param eth_gre_enable - eth GRE enable enable flag.
301 * @param ip_gre_enable - IP GRE enable enable flag.
303 void ecore_set_gre_enable(struct ecore_hwfn *p_hwfn,
304 struct ecore_ptt *p_ptt,
309 * @brief ecore_set_geneve_dest_port - initializes geneve tunnel destination
312 * @param p_ptt - ptt window used for writing the registers.
313 * @param dest_port - geneve destination udp port.
315 void ecore_set_geneve_dest_port(struct ecore_hwfn *p_hwfn,
316 struct ecore_ptt *p_ptt,
320 * @brief ecore_set_gre_enable - enable or disable GRE tunnel in HW
322 * @param p_ptt - ptt window used for writing the registers.
323 * @param eth_geneve_enable - eth GENEVE enable enable flag.
324 * @param ip_geneve_enable - IP GENEVE enable enable flag.
326 void ecore_set_geneve_enable(struct ecore_hwfn *p_hwfn,
327 struct ecore_ptt *p_ptt,
328 bool eth_geneve_enable,
329 bool ip_geneve_enable);
330 #ifndef UNUSED_HSI_FUNC
333 * @brief ecore_set_gft_event_id_cm_hdr - configure GFT event id and cm header
335 * @param p_ptt - ptt window used for writing the registers.
337 void ecore_set_gft_event_id_cm_hdr(struct ecore_hwfn *p_hwfn,
338 struct ecore_ptt *p_ptt);
341 * @brief ecore_gft_disable - Disable and GFT
343 * @param p_hwfn - HW device data
344 * @param p_ptt - ptt window used for writing the registers.
345 * @param pf_id - pf on which to disable GFT.
347 void ecore_gft_disable(struct ecore_hwfn *p_hwfn,
348 struct ecore_ptt *p_ptt,
352 * @brief ecore_gft_config - Enable and configure HW for GFT
354 * @param p_ptt - ptt window used for writing the registers.
355 * @param pf_id - pf on which to enable GFT.
356 * @param tcp - set profile tcp packets.
357 * @param udp - set profile udp packet.
358 * @param ipv4 - set profile ipv4 packet.
359 * @param ipv6 - set profile ipv6 packet.
360 * @param profile_type - define packet same fields. Use enum gft_profile_type.
362 void ecore_gft_config(struct ecore_hwfn *p_hwfn,
363 struct ecore_ptt *p_ptt,
369 enum gft_profile_type profile_type);
370 #endif /* UNUSED_HSI_FUNC */
373 * @brief ecore_config_vf_zone_size_mode - Configure VF zone size mode. Must be
374 * used before first ETH queue started.
377 * @param p_ptt - ptt window used for writing the registers. Don't care
378 * if runtime_init used
379 * @param mode - VF zone size mode. Use enum vf_zone_size_mode.
380 * @param runtime_init - Set 1 to init runtime registers in engine phase. Set 0
381 * if VF zone size mode configured after engine phase.
383 void ecore_config_vf_zone_size_mode(struct ecore_hwfn *p_hwfn, struct ecore_ptt
384 *p_ptt, u16 mode, bool runtime_init);
387 * @brief ecore_get_mstorm_queue_stat_offset - Get mstorm statistics offset by
390 * @param stat_cnt_id - statistic counter id
391 * @param vf_zone_size_mode - VF zone size mode. Use enum vf_zone_size_mode.
393 u32 ecore_get_mstorm_queue_stat_offset(struct ecore_hwfn *p_hwfn,
394 u16 stat_cnt_id, u16 vf_zone_size_mode);
397 * @brief ecore_get_mstorm_eth_vf_prods_offset - VF producer offset by VF zone
400 * @param vf_id - vf id.
401 * @param vf_queue_id - per VF rx queue id.
402 * @param vf_zone_size_mode - vf zone size mode. Use enum vf_zone_size_mode.
404 u32 ecore_get_mstorm_eth_vf_prods_offset(struct ecore_hwfn *p_hwfn, u8 vf_id, u8
405 vf_queue_id, u16 vf_zone_size_mode);
407 * @brief ecore_enable_context_validation - Enable and configure context
410 * @param p_ptt - ptt window used for writing the registers.
412 void ecore_enable_context_validation(struct ecore_hwfn *p_hwfn,
413 struct ecore_ptt *p_ptt);
415 * @brief ecore_calc_session_ctx_validation - Calcualte validation byte for
418 * @param p_ctx_mem - pointer to context memory.
419 * @param ctx_size - context size.
420 * @param ctx_type - context type.
421 * @param cid - context cid.
423 void ecore_calc_session_ctx_validation(void *p_ctx_mem,
429 * @brief ecore_calc_task_ctx_validation - Calcualte validation byte for task
432 * @param p_ctx_mem - pointer to context memory.
433 * @param ctx_size - context size.
434 * @param ctx_type - context type.
435 * @param tid - context tid.
437 void ecore_calc_task_ctx_validation(void *p_ctx_mem,
443 * @brief ecore_memset_session_ctx - Memset session context to 0 while
444 * preserving validation bytes.
446 * @param p_hwfn - HW device data
447 * @param p_ctx_mem - pointer to context memory.
448 * @param ctx_size - size to initialzie.
449 * @param ctx_type - context type.
451 void ecore_memset_session_ctx(void *p_ctx_mem,
455 * @brief ecore_memset_task_ctx - Memset task context to 0 while preserving
458 * @param p_ctx_mem - pointer to context memory.
459 * @param ctx_size - size to initialzie.
460 * @param ctx_type - context type.
462 void ecore_memset_task_ctx(void *p_ctx_mem,