1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2001-2020 Intel Corporation
3 */
4
5 #ifndef _IAVF_PROTOTYPE_H_
6 #define _IAVF_PROTOTYPE_H_
7
8 #include "iavf_type.h"
9 #include "iavf_alloc.h"
10 #include "virtchnl.h"
11
12 /* Prototypes for shared code functions that are not in
13 * the standard function pointer structures. These are
14 * mostly because they are needed even before the init
15 * has happened and will assist in the early SW and FW
16 * setup.
17 */
18
19 /* adminq functions */
20 __rte_internal
21 enum iavf_status iavf_init_adminq(struct iavf_hw *hw);
22 __rte_internal
23 enum iavf_status iavf_shutdown_adminq(struct iavf_hw *hw);
24 enum iavf_status iavf_init_asq(struct iavf_hw *hw);
25 enum iavf_status iavf_init_arq(struct iavf_hw *hw);
26 enum iavf_status iavf_alloc_adminq_asq_ring(struct iavf_hw *hw);
27 enum iavf_status iavf_alloc_adminq_arq_ring(struct iavf_hw *hw);
28 enum iavf_status iavf_shutdown_asq(struct iavf_hw *hw);
29 enum iavf_status iavf_shutdown_arq(struct iavf_hw *hw);
30 u16 iavf_clean_asq(struct iavf_hw *hw);
31 void iavf_free_adminq_asq(struct iavf_hw *hw);
32 void iavf_free_adminq_arq(struct iavf_hw *hw);
33 enum iavf_status iavf_validate_mac_addr(u8 *mac_addr);
34 void iavf_adminq_init_ring_data(struct iavf_hw *hw);
35 __rte_internal
36 enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw,
37 struct iavf_arq_event_info *e,
38 u16 *events_pending);
39 enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
40 struct iavf_aq_desc *desc,
41 void *buff, /* can be NULL */
42 u16 buff_size,
43 struct iavf_asq_cmd_details *cmd_details);
44 bool iavf_asq_done(struct iavf_hw *hw);
45
46 /* debug function for adminq */
47 void iavf_debug_aq(struct iavf_hw *hw, enum iavf_debug_mask mask,
48 void *desc, void *buffer, u16 buf_len);
49
50 void iavf_idle_aq(struct iavf_hw *hw);
51 bool iavf_check_asq_alive(struct iavf_hw *hw);
52 enum iavf_status iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading);
53
54 enum iavf_status iavf_aq_get_rss_lut(struct iavf_hw *hw, u16 seid,
55 bool pf_lut, u8 *lut, u16 lut_size);
56 enum iavf_status iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid,
57 bool pf_lut, u8 *lut, u16 lut_size);
58 enum iavf_status iavf_aq_get_rss_key(struct iavf_hw *hw,
59 u16 seid,
60 struct iavf_aqc_get_set_rss_key_data *key);
61 enum iavf_status iavf_aq_set_rss_key(struct iavf_hw *hw,
62 u16 seid,
63 struct iavf_aqc_get_set_rss_key_data *key);
64 const char *iavf_aq_str(struct iavf_hw *hw, enum iavf_admin_queue_err aq_err);
65 const char *iavf_stat_str(struct iavf_hw *hw, enum iavf_status stat_err);
66
67 __rte_internal
68 enum iavf_status iavf_set_mac_type(struct iavf_hw *hw);
69
70 extern struct iavf_rx_ptype_decoded iavf_ptype_lookup[];
71
decode_rx_desc_ptype(u8 ptype)72 STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
73 {
74 return iavf_ptype_lookup[ptype];
75 }
76
77 /* prototype for functions used for SW spinlocks */
78 void iavf_init_spinlock(struct iavf_spinlock *sp);
79 void iavf_acquire_spinlock(struct iavf_spinlock *sp);
80 void iavf_release_spinlock(struct iavf_spinlock *sp);
81 void iavf_destroy_spinlock(struct iavf_spinlock *sp);
82
83 __rte_internal
84 void iavf_vf_parse_hw_config(struct iavf_hw *hw,
85 struct virtchnl_vf_resource *msg);
86 enum iavf_status iavf_vf_reset(struct iavf_hw *hw);
87 __rte_internal
88 enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
89 enum virtchnl_ops v_opcode,
90 enum iavf_status v_retval,
91 u8 *msg, u16 msglen,
92 struct iavf_asq_cmd_details *cmd_details);
93 enum iavf_status iavf_aq_debug_dump(struct iavf_hw *hw, u8 cluster_id,
94 u8 table_id, u32 start_index, u16 buff_size,
95 void *buff, u16 *ret_buff_size,
96 u8 *ret_next_table, u32 *ret_next_index,
97 struct iavf_asq_cmd_details *cmd_details);
98 enum iavf_status iavf_aq_clear_all_wol_filters(struct iavf_hw *hw,
99 struct iavf_asq_cmd_details *cmd_details);
100 #endif /* _IAVF_PROTOTYPE_H_ */
101