net/iavf: rename remaining avf strings
[dpdk.git] / drivers / net / iavf / base / iavf_prototype.h
1 /*******************************************************************************
2
3 Copyright (c) 2013 - 2015, Intel Corporation
4 All rights reserved.
5
6 Redistribution and use in source and binary forms, with or without
7 modification, are permitted provided that the following conditions are met:
8
9  1. Redistributions of source code must retain the above copyright notice,
10     this list of conditions and the following disclaimer.
11
12  2. Redistributions in binary form must reproduce the above copyright
13     notice, this list of conditions and the following disclaimer in the
14     documentation and/or other materials provided with the distribution.
15
16  3. Neither the name of the Intel Corporation nor the names of its
17     contributors may be used to endorse or promote products derived from
18     this software without specific prior written permission.
19
20 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
24 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 POSSIBILITY OF SUCH DAMAGE.
31
32 ***************************************************************************/
33
34 #ifndef _IAVF_PROTOTYPE_H_
35 #define _IAVF_PROTOTYPE_H_
36
37 #include "iavf_type.h"
38 #include "iavf_alloc.h"
39 #include "virtchnl.h"
40
41 /* Prototypes for shared code functions that are not in
42  * the standard function pointer structures.  These are
43  * mostly because they are needed even before the init
44  * has happened and will assist in the early SW and FW
45  * setup.
46  */
47
48 /* adminq functions */
49 enum iavf_status_code iavf_init_adminq(struct iavf_hw *hw);
50 enum iavf_status_code iavf_shutdown_adminq(struct iavf_hw *hw);
51 enum iavf_status_code iavf_init_asq(struct iavf_hw *hw);
52 enum iavf_status_code iavf_init_arq(struct iavf_hw *hw);
53 enum iavf_status_code iavf_alloc_adminq_asq_ring(struct iavf_hw *hw);
54 enum iavf_status_code iavf_alloc_adminq_arq_ring(struct iavf_hw *hw);
55 enum iavf_status_code iavf_shutdown_asq(struct iavf_hw *hw);
56 enum iavf_status_code iavf_shutdown_arq(struct iavf_hw *hw);
57 u16 iavf_clean_asq(struct iavf_hw *hw);
58 void iavf_free_adminq_asq(struct iavf_hw *hw);
59 void iavf_free_adminq_arq(struct iavf_hw *hw);
60 enum iavf_status_code iavf_validate_mac_addr(u8 *mac_addr);
61 void iavf_adminq_init_ring_data(struct iavf_hw *hw);
62 enum iavf_status_code iavf_clean_arq_element(struct iavf_hw *hw,
63                                              struct iavf_arq_event_info *e,
64                                              u16 *events_pending);
65 enum iavf_status_code iavf_asq_send_command(struct iavf_hw *hw,
66                                 struct iavf_aq_desc *desc,
67                                 void *buff, /* can be NULL */
68                                 u16  buff_size,
69                                 struct iavf_asq_cmd_details *cmd_details);
70 bool iavf_asq_done(struct iavf_hw *hw);
71
72 /* debug function for adminq */
73 void iavf_debug_aq(struct iavf_hw *hw, enum iavf_debug_mask mask,
74                    void *desc, void *buffer, u16 buf_len);
75
76 void iavf_idle_aq(struct iavf_hw *hw);
77 bool iavf_check_asq_alive(struct iavf_hw *hw);
78 enum iavf_status_code iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading);
79
80 enum iavf_status_code iavf_aq_get_rss_lut(struct iavf_hw *hw, u16 seid,
81                                           bool pf_lut, u8 *lut, u16 lut_size);
82 enum iavf_status_code iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid,
83                                           bool pf_lut, u8 *lut, u16 lut_size);
84 enum iavf_status_code iavf_aq_get_rss_key(struct iavf_hw *hw,
85                                      u16 seid,
86                                      struct iavf_aqc_get_set_rss_key_data *key);
87 enum iavf_status_code iavf_aq_set_rss_key(struct iavf_hw *hw,
88                                      u16 seid,
89                                      struct iavf_aqc_get_set_rss_key_data *key);
90 const char *iavf_aq_str(struct iavf_hw *hw, enum iavf_admin_queue_err aq_err);
91 const char *iavf_stat_str(struct iavf_hw *hw, enum iavf_status_code stat_err);
92
93
94 enum iavf_status_code iavf_set_mac_type(struct iavf_hw *hw);
95
96 extern struct iavf_rx_ptype_decoded iavf_ptype_lookup[];
97
98 STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
99 {
100         return iavf_ptype_lookup[ptype];
101 }
102
103 /* prototype for functions used for SW spinlocks */
104 void iavf_init_spinlock(struct iavf_spinlock *sp);
105 void iavf_acquire_spinlock(struct iavf_spinlock *sp);
106 void iavf_release_spinlock(struct iavf_spinlock *sp);
107 void iavf_destroy_spinlock(struct iavf_spinlock *sp);
108
109 /* iavf_common for VF drivers*/
110 void iavf_parse_hw_config(struct iavf_hw *hw,
111                              struct virtchnl_vf_resource *msg);
112 enum iavf_status_code iavf_reset(struct iavf_hw *hw);
113 enum iavf_status_code iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
114                                 enum virtchnl_ops v_opcode,
115                                 enum iavf_status_code v_retval,
116                                 u8 *msg, u16 msglen,
117                                 struct iavf_asq_cmd_details *cmd_details);
118 enum iavf_status_code iavf_set_filter_control(struct iavf_hw *hw,
119                                 struct iavf_filter_control_settings *settings);
120 enum iavf_status_code iavf_aq_add_rem_control_packet_filter(struct iavf_hw *hw,
121                                 u8 *mac_addr, u16 ethtype, u16 flags,
122                                 u16 vsi_seid, u16 queue, bool is_add,
123                                 struct iavf_control_filter_stats *stats,
124                                 struct iavf_asq_cmd_details *cmd_details);
125 enum iavf_status_code iavf_aq_debug_dump(struct iavf_hw *hw, u8 cluster_id,
126                                 u8 table_id, u32 start_index, u16 buff_size,
127                                 void *buff, u16 *ret_buff_size,
128                                 u8 *ret_next_table, u32 *ret_next_index,
129                                 struct iavf_asq_cmd_details *cmd_details);
130 void iavf_add_filter_to_drop_tx_flow_control_frames(struct iavf_hw *hw,
131                                                     u16 vsi_seid);
132 enum iavf_status_code iavf_aq_rx_ctl_read_register(struct iavf_hw *hw,
133                                 u32 reg_addr, u32 *reg_val,
134                                 struct iavf_asq_cmd_details *cmd_details);
135 u32 iavf_read_rx_ctl(struct iavf_hw *hw, u32 reg_addr);
136 enum iavf_status_code iavf_aq_rx_ctl_write_register(struct iavf_hw *hw,
137                                 u32 reg_addr, u32 reg_val,
138                                 struct iavf_asq_cmd_details *cmd_details);
139 void iavf_write_rx_ctl(struct iavf_hw *hw, u32 reg_addr, u32 reg_val);
140 enum iavf_status_code iavf_aq_set_phy_register(struct iavf_hw *hw,
141                                 u8 phy_select, u8 dev_addr,
142                                 u32 reg_addr, u32 reg_val,
143                                 struct iavf_asq_cmd_details *cmd_details);
144 enum iavf_status_code iavf_aq_get_phy_register(struct iavf_hw *hw,
145                                 u8 phy_select, u8 dev_addr,
146                                 u32 reg_addr, u32 *reg_val,
147                                 struct iavf_asq_cmd_details *cmd_details);
148
149 enum iavf_status_code iavf_aq_set_arp_proxy_config(struct iavf_hw *hw,
150                         struct iavf_aqc_arp_proxy_data *proxy_config,
151                         struct iavf_asq_cmd_details *cmd_details);
152 enum iavf_status_code iavf_aq_set_ns_proxy_table_entry(struct iavf_hw *hw,
153                         struct iavf_aqc_ns_proxy_data *ns_proxy_table_entry,
154                         struct iavf_asq_cmd_details *cmd_details);
155 enum iavf_status_code iavf_aq_set_clear_wol_filter(struct iavf_hw *hw,
156                         u8 filter_index,
157                         struct iavf_aqc_set_wol_filter_data *filter,
158                         bool set_filter, bool no_wol_tco,
159                         bool filter_valid, bool no_wol_tco_valid,
160                         struct iavf_asq_cmd_details *cmd_details);
161 enum iavf_status_code iavf_aq_get_wake_event_reason(struct iavf_hw *hw,
162                         u16 *wake_reason,
163                         struct iavf_asq_cmd_details *cmd_details);
164 enum iavf_status_code iavf_aq_clear_all_wol_filters(struct iavf_hw *hw,
165                         struct iavf_asq_cmd_details *cmd_details);
166 enum iavf_status_code iavf_read_phy_register_clause22(struct iavf_hw *hw,
167                                         u16 reg, u8 phy_addr, u16 *value);
168 enum iavf_status_code iavf_write_phy_register_clause22(struct iavf_hw *hw,
169                                         u16 reg, u8 phy_addr, u16 value);
170 enum iavf_status_code iavf_read_phy_register_clause45(struct iavf_hw *hw,
171                                 u8 page, u16 reg, u8 phy_addr, u16 *value);
172 enum iavf_status_code iavf_write_phy_register_clause45(struct iavf_hw *hw,
173                                 u8 page, u16 reg, u8 phy_addr, u16 value);
174 enum iavf_status_code iavf_read_phy_register(struct iavf_hw *hw,
175                                 u8 page, u16 reg, u8 phy_addr, u16 *value);
176 enum iavf_status_code iavf_write_phy_register(struct iavf_hw *hw,
177                                 u8 page, u16 reg, u8 phy_addr, u16 value);
178 u8 iavf_get_phy_address(struct iavf_hw *hw, u8 dev_num);
179 enum iavf_status_code iavf_blink_phy_link_led(struct iavf_hw *hw,
180                                               u32 time, u32 interval);
181 enum iavf_status_code iavf_aq_write_ddp(struct iavf_hw *hw, void *buff,
182                                         u16 buff_size, u32 track_id,
183                                         u32 *error_offset, u32 *error_info,
184                                         struct iavf_asq_cmd_details *
185                                         cmd_details);
186 enum iavf_status_code iavf_aq_get_ddp_list(struct iavf_hw *hw, void *buff,
187                                            u16 buff_size, u8 flags,
188                                            struct iavf_asq_cmd_details *
189                                            cmd_details);
190 struct iavf_generic_seg_header *
191 iavf_find_segment_in_package(u32 segment_type,
192                              struct iavf_package_header *pkg_header);
193 struct iavf_profile_section_header *
194 iavf_find_section_in_profile(u32 section_type,
195                              struct iavf_profile_segment *profile);
196 enum iavf_status_code
197 iavf_write_profile(struct iavf_hw *hw, struct iavf_profile_segment *iavf_seg,
198                    u32 track_id);
199 enum iavf_status_code
200 iavf_rollback_profile(struct iavf_hw *hw, struct iavf_profile_segment *iavf_seg,
201                       u32 track_id);
202 enum iavf_status_code
203 iavf_add_pinfo_to_list(struct iavf_hw *hw,
204                        struct iavf_profile_segment *profile,
205                        u8 *profile_info_sec, u32 track_id);
206 #endif /* _IAVF_PROTOTYPE_H_ */