1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2013 - 2015 Intel Corporation
5 #ifndef _IAVF_PROTOTYPE_H_
6 #define _IAVF_PROTOTYPE_H_
9 #include "iavf_alloc.h"
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
19 /* adminq functions */
20 enum iavf_status_code iavf_init_adminq(struct iavf_hw *hw);
21 enum iavf_status_code iavf_shutdown_adminq(struct iavf_hw *hw);
22 enum iavf_status_code iavf_init_asq(struct iavf_hw *hw);
23 enum iavf_status_code iavf_init_arq(struct iavf_hw *hw);
24 enum iavf_status_code iavf_alloc_adminq_asq_ring(struct iavf_hw *hw);
25 enum iavf_status_code iavf_alloc_adminq_arq_ring(struct iavf_hw *hw);
26 enum iavf_status_code iavf_shutdown_asq(struct iavf_hw *hw);
27 enum iavf_status_code iavf_shutdown_arq(struct iavf_hw *hw);
28 u16 iavf_clean_asq(struct iavf_hw *hw);
29 void iavf_free_adminq_asq(struct iavf_hw *hw);
30 void iavf_free_adminq_arq(struct iavf_hw *hw);
31 enum iavf_status_code iavf_validate_mac_addr(u8 *mac_addr);
32 void iavf_adminq_init_ring_data(struct iavf_hw *hw);
33 enum iavf_status_code iavf_clean_arq_element(struct iavf_hw *hw,
34 struct iavf_arq_event_info *e,
36 enum iavf_status_code iavf_asq_send_command(struct iavf_hw *hw,
37 struct iavf_aq_desc *desc,
38 void *buff, /* can be NULL */
40 struct iavf_asq_cmd_details *cmd_details);
41 bool iavf_asq_done(struct iavf_hw *hw);
43 /* debug function for adminq */
44 void iavf_debug_aq(struct iavf_hw *hw, enum iavf_debug_mask mask,
45 void *desc, void *buffer, u16 buf_len);
47 void iavf_idle_aq(struct iavf_hw *hw);
48 bool iavf_check_asq_alive(struct iavf_hw *hw);
49 enum iavf_status_code iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading);
51 enum iavf_status_code iavf_aq_get_rss_lut(struct iavf_hw *hw, u16 seid,
52 bool pf_lut, u8 *lut, u16 lut_size);
53 enum iavf_status_code iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid,
54 bool pf_lut, u8 *lut, u16 lut_size);
55 enum iavf_status_code iavf_aq_get_rss_key(struct iavf_hw *hw,
57 struct iavf_aqc_get_set_rss_key_data *key);
58 enum iavf_status_code iavf_aq_set_rss_key(struct iavf_hw *hw,
60 struct iavf_aqc_get_set_rss_key_data *key);
61 const char *iavf_aq_str(struct iavf_hw *hw, enum iavf_admin_queue_err aq_err);
62 const char *iavf_stat_str(struct iavf_hw *hw, enum iavf_status_code stat_err);
65 enum iavf_status_code iavf_set_mac_type(struct iavf_hw *hw);
67 extern struct iavf_rx_ptype_decoded iavf_ptype_lookup[];
69 STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
71 return iavf_ptype_lookup[ptype];
74 /* prototype for functions used for SW spinlocks */
75 void iavf_init_spinlock(struct iavf_spinlock *sp);
76 void iavf_acquire_spinlock(struct iavf_spinlock *sp);
77 void iavf_release_spinlock(struct iavf_spinlock *sp);
78 void iavf_destroy_spinlock(struct iavf_spinlock *sp);
80 /* iavf_common for VF drivers*/
81 void iavf_parse_hw_config(struct iavf_hw *hw,
82 struct virtchnl_vf_resource *msg);
83 enum iavf_status_code iavf_reset(struct iavf_hw *hw);
84 enum iavf_status_code iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
85 enum virtchnl_ops v_opcode,
86 enum iavf_status_code v_retval,
88 struct iavf_asq_cmd_details *cmd_details);
89 enum iavf_status_code iavf_set_filter_control(struct iavf_hw *hw,
90 struct iavf_filter_control_settings *settings);
91 enum iavf_status_code iavf_aq_add_rem_control_packet_filter(struct iavf_hw *hw,
92 u8 *mac_addr, u16 ethtype, u16 flags,
93 u16 vsi_seid, u16 queue, bool is_add,
94 struct iavf_control_filter_stats *stats,
95 struct iavf_asq_cmd_details *cmd_details);
96 enum iavf_status_code iavf_aq_debug_dump(struct iavf_hw *hw, u8 cluster_id,
97 u8 table_id, u32 start_index, u16 buff_size,
98 void *buff, u16 *ret_buff_size,
99 u8 *ret_next_table, u32 *ret_next_index,
100 struct iavf_asq_cmd_details *cmd_details);
101 void iavf_add_filter_to_drop_tx_flow_control_frames(struct iavf_hw *hw,
103 enum iavf_status_code iavf_aq_rx_ctl_read_register(struct iavf_hw *hw,
104 u32 reg_addr, u32 *reg_val,
105 struct iavf_asq_cmd_details *cmd_details);
106 u32 iavf_read_rx_ctl(struct iavf_hw *hw, u32 reg_addr);
107 enum iavf_status_code iavf_aq_rx_ctl_write_register(struct iavf_hw *hw,
108 u32 reg_addr, u32 reg_val,
109 struct iavf_asq_cmd_details *cmd_details);
110 void iavf_write_rx_ctl(struct iavf_hw *hw, u32 reg_addr, u32 reg_val);
111 enum iavf_status_code iavf_aq_set_phy_register(struct iavf_hw *hw,
112 u8 phy_select, u8 dev_addr,
113 u32 reg_addr, u32 reg_val,
114 struct iavf_asq_cmd_details *cmd_details);
115 enum iavf_status_code iavf_aq_get_phy_register(struct iavf_hw *hw,
116 u8 phy_select, u8 dev_addr,
117 u32 reg_addr, u32 *reg_val,
118 struct iavf_asq_cmd_details *cmd_details);
120 enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw,
121 struct iavf_aqc_arp_proxy_data *proxy_config,
122 struct iavf_asq_cmd_details *cmd_details);
123 enum iavf_status_code iavf_aq_set_ns_proxy_table_entry(struct iavf_hw *hw,
124 struct iavf_aqc_ns_proxy_data *ns_proxy_table_entry,
125 struct iavf_asq_cmd_details *cmd_details);
126 enum iavf_status_code iavf_aq_set_clear_wol_filter(struct iavf_hw *hw,
128 struct iavf_aqc_set_wol_filter_data *filter,
129 bool set_filter, bool no_wol_tco,
130 bool filter_valid, bool no_wol_tco_valid,
131 struct iavf_asq_cmd_details *cmd_details);
132 enum iavf_status_code iavf_aq_get_wake_event_reason(struct iavf_hw *hw,
134 struct iavf_asq_cmd_details *cmd_details);
135 enum iavf_status_code iavf_aq_clear_all_wol_filters(struct iavf_hw *hw,
136 struct iavf_asq_cmd_details *cmd_details);
137 enum iavf_status_code iavf_read_phy_register_clause22(struct iavf_hw *hw,
138 u16 reg, u8 phy_addr, u16 *value);
139 enum iavf_status_code iavf_write_phy_register_clause22(struct iavf_hw *hw,
140 u16 reg, u8 phy_addr, u16 value);
141 enum iavf_status_code iavf_read_phy_register_clause45(struct iavf_hw *hw,
142 u8 page, u16 reg, u8 phy_addr, u16 *value);
143 enum iavf_status_code iavf_write_phy_register_clause45(struct iavf_hw *hw,
144 u8 page, u16 reg, u8 phy_addr, u16 value);
145 enum iavf_status_code iavf_read_phy_register(struct iavf_hw *hw,
146 u8 page, u16 reg, u8 phy_addr, u16 *value);
147 enum iavf_status_code iavf_write_phy_register(struct iavf_hw *hw,
148 u8 page, u16 reg, u8 phy_addr, u16 value);
149 u8 iavf_get_phy_address(struct iavf_hw *hw, u8 dev_num);
150 enum iavf_status_code iavf_blink_phy_link_led(struct iavf_hw *hw,
151 u32 time, u32 interval);
152 enum iavf_status_code iavf_aq_write_ddp(struct iavf_hw *hw, void *buff,
153 u16 buff_size, u32 track_id,
154 u32 *error_offset, u32 *error_info,
155 struct iavf_asq_cmd_details *
157 enum iavf_status_code iavf_aq_get_ddp_list(struct iavf_hw *hw, void *buff,
158 u16 buff_size, u8 flags,
159 struct iavf_asq_cmd_details *
161 struct iavf_generic_seg_header *
162 iavf_find_segment_in_package(u32 segment_type,
163 struct iavf_package_header *pkg_header);
164 struct iavf_profile_section_header *
165 iavf_find_section_in_profile(u32 section_type,
166 struct iavf_profile_segment *profile);
167 enum iavf_status_code
168 iavf_write_profile(struct iavf_hw *hw, struct iavf_profile_segment *iavf_seg,
170 enum iavf_status_code
171 iavf_rollback_profile(struct iavf_hw *hw, struct iavf_profile_segment *iavf_seg,
173 enum iavf_status_code
174 iavf_add_pinfo_to_list(struct iavf_hw *hw,
175 struct iavf_profile_segment *profile,
176 u8 *profile_info_sec, u32 track_id);
177 #endif /* _IAVF_PROTOTYPE_H_ */