2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
9 #ifndef __ECORE_DEV_API_H__
10 #define __ECORE_DEV_API_H__
12 #include "ecore_status.h"
13 #include "ecore_chain.h"
14 #include "ecore_int_api.h"
16 struct ecore_tunn_start_params;
19 * @brief ecore_init_dp - initialize the debug level
26 void ecore_init_dp(struct ecore_dev *p_dev,
32 * @brief ecore_init_struct - initialize the device structure to
37 void ecore_init_struct(struct ecore_dev *p_dev);
40 * @brief ecore_resc_free -
44 void ecore_resc_free(struct ecore_dev *p_dev);
47 * @brief ecore_resc_alloc -
51 * @return enum _ecore_status_t
53 enum _ecore_status_t ecore_resc_alloc(struct ecore_dev *p_dev);
56 * @brief ecore_resc_setup -
60 void ecore_resc_setup(struct ecore_dev *p_dev);
63 * @brief ecore_hw_init -
66 * @param p_tunn - tunneling parameters
68 * @param int_mode - interrupt mode [msix, inta, etc.] to use.
69 * @param allow_npar_tx_switch - npar tx switching to be used
70 * for vports configured for tx-switching.
71 * @param bin_fw_data - binary fw data pointer in binary fw file.
72 * Pass NULL if not using binary fw file.
74 * @return enum _ecore_status_t
76 enum _ecore_status_t ecore_hw_init(struct ecore_dev *p_dev,
77 struct ecore_tunn_start_params *p_tunn,
79 enum ecore_int_mode int_mode,
80 bool allow_npar_tx_switch,
81 const u8 *bin_fw_data);
84 * @brief ecore_hw_timers_stop_all -
90 void ecore_hw_timers_stop_all(struct ecore_dev *p_dev);
93 * @brief ecore_hw_stop -
97 * @return enum _ecore_status_t
99 enum _ecore_status_t ecore_hw_stop(struct ecore_dev *p_dev);
102 * @brief ecore_hw_stop_fastpath -should be called incase
103 * slowpath is still required for the device, but
109 void ecore_hw_stop_fastpath(struct ecore_dev *p_dev);
112 * @brief ecore_prepare_hibernate -should be called when
113 * the system is going into the hibernate state
118 void ecore_prepare_hibernate(struct ecore_dev *p_dev);
121 * @brief ecore_hw_start_fastpath -restart fastpath traffic,
122 * only if hw_stop_fastpath was called
127 void ecore_hw_start_fastpath(struct ecore_hwfn *p_hwfn);
130 * @brief ecore_hw_reset -
134 * @return enum _ecore_status_t
136 enum _ecore_status_t ecore_hw_reset(struct ecore_dev *p_dev);
139 * @brief ecore_hw_prepare -
142 * @param personality - personality to initialize
144 * @return enum _ecore_status_t
146 enum _ecore_status_t ecore_hw_prepare(struct ecore_dev *p_dev, int personality);
149 * @brief ecore_hw_remove -
153 void ecore_hw_remove(struct ecore_dev *p_dev);
156 * @brief ecore_ptt_acquire - Allocate a PTT window
158 * Should be called at the entry point to the driver (at the beginning of an
163 * @return struct ecore_ptt
165 struct ecore_ptt *ecore_ptt_acquire(struct ecore_hwfn *p_hwfn);
168 * @brief ecore_ptt_release - Release PTT Window
170 * Should be called at the end of a flow - at the end of the function that
177 void ecore_ptt_release(struct ecore_hwfn *p_hwfn,
178 struct ecore_ptt *p_ptt);
180 #ifndef __EXTRACT__LINUX__
181 struct ecore_eth_stats {
182 u64 no_buff_discards;
183 u64 packet_too_big_discard;
191 u64 mftag_filter_discards;
192 u64 mac_filter_discards;
199 u64 tx_err_drop_pkts;
200 u64 tpa_coalesced_pkts;
201 u64 tpa_coalesced_events;
203 u64 tpa_not_coalesced_pkts;
204 u64 tpa_coalesced_bytes;
207 u64 rx_64_byte_packets;
208 u64 rx_65_to_127_byte_packets;
209 u64 rx_128_to_255_byte_packets;
210 u64 rx_256_to_511_byte_packets;
211 u64 rx_512_to_1023_byte_packets;
212 u64 rx_1024_to_1518_byte_packets;
213 u64 rx_1519_to_1522_byte_packets;
214 u64 rx_1519_to_2047_byte_packets;
215 u64 rx_2048_to_4095_byte_packets;
216 u64 rx_4096_to_9216_byte_packets;
217 u64 rx_9217_to_16383_byte_packets;
219 u64 rx_mac_crtl_frames;
223 u64 rx_carrier_errors;
224 u64 rx_oversize_packets;
226 u64 rx_undersize_packets;
228 u64 tx_64_byte_packets;
229 u64 tx_65_to_127_byte_packets;
230 u64 tx_128_to_255_byte_packets;
231 u64 tx_256_to_511_byte_packets;
232 u64 tx_512_to_1023_byte_packets;
233 u64 tx_1024_to_1518_byte_packets;
234 u64 tx_1519_to_2047_byte_packets;
235 u64 tx_2048_to_4095_byte_packets;
236 u64 tx_4096_to_9216_byte_packets;
237 u64 tx_9217_to_16383_byte_packets;
240 u64 tx_lpi_entry_count;
241 u64 tx_total_collisions;
245 u64 rx_mac_uc_packets;
246 u64 rx_mac_mc_packets;
247 u64 rx_mac_bc_packets;
248 u64 rx_mac_frames_ok;
250 u64 tx_mac_uc_packets;
251 u64 tx_mac_mc_packets;
252 u64 tx_mac_bc_packets;
253 u64 tx_mac_ctrl_frames;
257 enum ecore_dmae_address_type_t {
258 ECORE_DMAE_ADDRESS_HOST_VIRT,
259 ECORE_DMAE_ADDRESS_HOST_PHYS,
260 ECORE_DMAE_ADDRESS_GRC
263 /* value of flags If ECORE_DMAE_FLAG_RW_REPL_SRC flag is set and the
264 * source is a block of length DMAE_MAX_RW_SIZE and the
265 * destination is larger, the source block will be duplicated as
266 * many times as required to fill the destination block. This is
267 * used mostly to write a zeroed buffer to destination address
270 #define ECORE_DMAE_FLAG_RW_REPL_SRC 0x00000001
271 #define ECORE_DMAE_FLAG_VF_SRC 0x00000002
272 #define ECORE_DMAE_FLAG_VF_DST 0x00000004
273 #define ECORE_DMAE_FLAG_COMPLETION_DST 0x00000008
275 struct ecore_dmae_params {
276 u32 flags; /* consists of ECORE_DMAE_FLAG_* values */
282 * @brief ecore_dmae_host2grc - copy data from source addr to
283 * dmae registers using the given ptt
288 * @param grc_addr (dmae_data_offset)
289 * @param size_in_dwords
290 * @param flags (one of the flags defined above)
293 ecore_dmae_host2grc(struct ecore_hwfn *p_hwfn,
294 struct ecore_ptt *p_ptt,
301 * @brief ecore_dmae_grc2host - Read data from dmae data offset
302 * to source address using the given ptt
305 * @param grc_addr (dmae_data_offset)
307 * @param size_in_dwords
308 * @param flags - one of the flags defined above
311 ecore_dmae_grc2host(struct ecore_hwfn *p_hwfn,
312 struct ecore_ptt *p_ptt,
314 dma_addr_t dest_addr,
319 * @brief ecore_dmae_host2host - copy data from to source address
320 * to a destination address (for SRIOV) using the given ptt
326 * @param size_in_dwords
330 ecore_dmae_host2host(struct ecore_hwfn *p_hwfn,
331 struct ecore_ptt *p_ptt,
332 dma_addr_t source_addr,
333 dma_addr_t dest_addr,
335 struct ecore_dmae_params *p_params);
338 * @brief ecore_chain_alloc - Allocate and initialize a chain
341 * @param intended_use
347 * @return enum _ecore_status_t
350 ecore_chain_alloc(struct ecore_dev *p_dev,
351 enum ecore_chain_use_mode intended_use,
352 enum ecore_chain_mode mode,
353 enum ecore_chain_cnt_type cnt_type,
355 osal_size_t elem_size,
356 struct ecore_chain *p_chain);
359 * @brief ecore_chain_free - Free chain DMA memory
364 void ecore_chain_free(struct ecore_dev *p_dev,
365 struct ecore_chain *p_chain);
368 * @@brief ecore_fw_l2_queue - Get absolute L2 queue ID
371 * @param src_id - relative to p_hwfn
372 * @param dst_id - absolute per engine
374 * @return enum _ecore_status_t
376 enum _ecore_status_t ecore_fw_l2_queue(struct ecore_hwfn *p_hwfn,
381 * @@brief ecore_fw_vport - Get absolute vport ID
384 * @param src_id - relative to p_hwfn
385 * @param dst_id - absolute per engine
387 * @return enum _ecore_status_t
389 enum _ecore_status_t ecore_fw_vport(struct ecore_hwfn *p_hwfn,
394 * @@brief ecore_fw_rss_eng - Get absolute RSS engine ID
397 * @param src_id - relative to p_hwfn
398 * @param dst_id - absolute per engine
400 * @return enum _ecore_status_t
402 enum _ecore_status_t ecore_fw_rss_eng(struct ecore_hwfn *p_hwfn,
407 * @brief ecore_llh_add_mac_filter - configures a MAC filter in llh
411 * @param p_filter - MAC to add
413 enum _ecore_status_t ecore_llh_add_mac_filter(struct ecore_hwfn *p_hwfn,
414 struct ecore_ptt *p_ptt,
418 * @brief ecore_llh_remove_mac_filter - removes a MAC filtre from llh
422 * @param p_filter - MAC to remove
424 void ecore_llh_remove_mac_filter(struct ecore_hwfn *p_hwfn,
425 struct ecore_ptt *p_ptt, u8 *p_filter);
428 * @brief ecore_llh_add_ethertype_filter - configures a ethertype filter in llh
432 * @param filter - ethertype to add
434 enum _ecore_status_t ecore_llh_add_ethertype_filter(struct ecore_hwfn *p_hwfn,
435 struct ecore_ptt *p_ptt,
439 * @brief ecore_llh_remove_ethertype_filter - removes a ethertype llh filter
443 * @param filter - ethertype to remove
445 void ecore_llh_remove_ethertype_filter(struct ecore_hwfn *p_hwfn,
446 struct ecore_ptt *p_ptt, u16 filter);
449 * @brief ecore_llh_clear_all_filters - removes all MAC filters from llh
454 void ecore_llh_clear_all_filters(struct ecore_hwfn *p_hwfn,
455 struct ecore_ptt *p_ptt);
458 *@brief Cleanup of previous driver remains prior to load
462 * @param id - For PF, engine-relative. For VF, PF-relative.
463 * @param is_vf - true iff cleanup is made for a VF.
465 * @return enum _ecore_status_t
467 enum _ecore_status_t ecore_final_cleanup(struct ecore_hwfn *p_hwfn,
468 struct ecore_ptt *p_ptt,
472 * @brief ecore_test_registers - Perform register tests
477 * @return enum _ecore_status_t
479 enum _ecore_status_t ecore_test_registers(struct ecore_hwfn *p_hwfn,
480 struct ecore_ptt *p_ptt);
483 * @brief ecore_set_rxq_coalesce - Configure coalesce parameters for an Rx queue
487 * @param coalesce - Coalesce value in micro seconds.
488 * @param qid - Queue index.
490 * @return enum _ecore_status_t
492 enum _ecore_status_t ecore_set_rxq_coalesce(struct ecore_hwfn *p_hwfn,
493 struct ecore_ptt *p_ptt,
494 u8 coalesce, u8 qid);
497 * @brief ecore_set_txq_coalesce - Configure coalesce parameters for a Tx queue
501 * @param coalesce - Coalesce value in micro seconds.
502 * @param qid - Queue index.
504 * @return enum _ecore_status_t
506 enum _ecore_status_t ecore_set_txq_coalesce(struct ecore_hwfn *p_hwfn,
507 struct ecore_ptt *p_ptt,
508 u8 coalesce, u8 qid);