xref: /linux/drivers/net/ethernet/intel/i40e/i40e_prototype.h (revision 8be4d31cb8aaeea27bde4b7ddb26e28a89062ebf)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright(c) 2013 - 2021 Intel Corporation. */
3 
4 #ifndef _I40E_PROTOTYPE_H_
5 #define _I40E_PROTOTYPE_H_
6 
7 #include <linux/ethtool.h>
8 #include <linux/avf/virtchnl.h>
9 #include "i40e_debug.h"
10 #include "i40e_type.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 int i40e_init_adminq(struct i40e_hw *hw);
21 void i40e_shutdown_adminq(struct i40e_hw *hw);
22 int i40e_clean_arq_element(struct i40e_hw *hw,
23 			   struct i40e_arq_event_info *e,
24 			   u16 *events_pending);
25 int
26 i40e_asq_send_command(struct i40e_hw *hw, struct libie_aq_desc *desc,
27 		      void *buff, /* can be NULL */ u16  buff_size,
28 		      struct i40e_asq_cmd_details *cmd_details);
29 int
30 i40e_asq_send_command_atomic(struct i40e_hw *hw, struct libie_aq_desc *desc,
31 			     void *buff, /* can be NULL */ u16  buff_size,
32 			     struct i40e_asq_cmd_details *cmd_details,
33 			     bool is_atomic_context);
34 int
35 i40e_asq_send_command_atomic_v2(struct i40e_hw *hw,
36 				struct libie_aq_desc *desc,
37 				void *buff, /* can be NULL */
38 				u16  buff_size,
39 				struct i40e_asq_cmd_details *cmd_details,
40 				bool is_atomic_context,
41 				enum libie_aq_err *aq_status);
42 
43 /* debug function for adminq */
44 void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask,
45 		   void *desc, void *buffer, u16 buf_len);
46 
47 bool i40e_check_asq_alive(struct i40e_hw *hw);
48 int i40e_aq_queue_shutdown(struct i40e_hw *hw, bool unloading);
49 
50 int i40e_aq_get_rss_lut(struct i40e_hw *hw, u16 seid,
51 			bool pf_lut, u8 *lut, u16 lut_size);
52 int i40e_aq_set_rss_lut(struct i40e_hw *hw, u16 seid,
53 			bool pf_lut, u8 *lut, u16 lut_size);
54 int i40e_aq_get_rss_key(struct i40e_hw *hw,
55 			u16 seid,
56 			struct i40e_aqc_get_set_rss_key_data *key);
57 int i40e_aq_set_rss_key(struct i40e_hw *hw,
58 			u16 seid,
59 			struct i40e_aqc_get_set_rss_key_data *key);
60 
61 u32 i40e_led_get(struct i40e_hw *hw);
62 void i40e_led_set(struct i40e_hw *hw, u32 mode, bool blink);
63 int i40e_led_set_phy(struct i40e_hw *hw, bool on,
64 		     u16 led_addr, u32 mode);
65 int i40e_led_get_phy(struct i40e_hw *hw, u16 *led_addr,
66 		     u16 *val);
67 
68 /* admin send queue commands */
69 
70 int i40e_aq_get_firmware_version(struct i40e_hw *hw,
71 				 u16 *fw_major_version, u16 *fw_minor_version,
72 				 u32 *fw_build,
73 				 u16 *api_major_version, u16 *api_minor_version,
74 				 struct i40e_asq_cmd_details *cmd_details);
75 int i40e_aq_debug_write_register(struct i40e_hw *hw,
76 				 u32 reg_addr, u64 reg_val,
77 				 struct i40e_asq_cmd_details *cmd_details);
78 int i40e_aq_debug_read_register(struct i40e_hw *hw,
79 				u32  reg_addr, u64 *reg_val,
80 				struct i40e_asq_cmd_details *cmd_details);
81 int i40e_aq_set_phy_debug(struct i40e_hw *hw, u8 cmd_flags,
82 			  struct i40e_asq_cmd_details *cmd_details);
83 int i40e_aq_set_default_vsi(struct i40e_hw *hw, u16 vsi_id,
84 			    struct i40e_asq_cmd_details *cmd_details);
85 int i40e_aq_clear_default_vsi(struct i40e_hw *hw, u16 vsi_id,
86 			      struct i40e_asq_cmd_details *cmd_details);
87 int i40e_aq_get_phy_capabilities(struct i40e_hw *hw,
88 				 bool qualified_modules, bool report_init,
89 				 struct i40e_aq_get_phy_abilities_resp *abilities,
90 				 struct i40e_asq_cmd_details *cmd_details);
91 int i40e_aq_set_phy_config(struct i40e_hw *hw,
92 			   struct i40e_aq_set_phy_config *config,
93 			   struct i40e_asq_cmd_details *cmd_details);
94 int i40e_set_fc(struct i40e_hw *hw, u8 *aq_failures,
95 		bool atomic_reset);
96 int i40e_aq_set_mac_loopback(struct i40e_hw *hw,
97 			     bool ena_lpbk,
98 			     struct i40e_asq_cmd_details *cmd_details);
99 int i40e_aq_set_phy_int_mask(struct i40e_hw *hw, u16 mask,
100 			     struct i40e_asq_cmd_details *cmd_details);
101 int i40e_aq_clear_pxe_mode(struct i40e_hw *hw,
102 			   struct i40e_asq_cmd_details *cmd_details);
103 int i40e_aq_set_link_restart_an(struct i40e_hw *hw,
104 				bool enable_link,
105 				struct i40e_asq_cmd_details *cmd_details);
106 int i40e_aq_get_link_info(struct i40e_hw *hw,
107 			  bool enable_lse, struct i40e_link_status *link,
108 			  struct i40e_asq_cmd_details *cmd_details);
109 int i40e_aq_send_driver_version(struct i40e_hw *hw,
110 				struct i40e_driver_version *dv,
111 				struct i40e_asq_cmd_details *cmd_details);
112 int i40e_aq_add_vsi(struct i40e_hw *hw,
113 		    struct i40e_vsi_context *vsi_ctx,
114 		    struct i40e_asq_cmd_details *cmd_details);
115 int i40e_aq_set_vsi_broadcast(struct i40e_hw *hw,
116 			      u16 vsi_id, bool set_filter,
117 			      struct i40e_asq_cmd_details *cmd_details);
118 int i40e_aq_set_vsi_unicast_promiscuous(struct i40e_hw *hw, u16 vsi_id, bool set,
119 					struct i40e_asq_cmd_details *cmd_details,
120 					bool rx_only_promisc);
121 int i40e_aq_set_vsi_multicast_promiscuous(struct i40e_hw *hw, u16 vsi_id, bool set,
122 					  struct i40e_asq_cmd_details *cmd_details);
123 int i40e_aq_set_vsi_mc_promisc_on_vlan(struct i40e_hw *hw,
124 				       u16 seid, bool enable,
125 				       u16 vid,
126 				       struct i40e_asq_cmd_details *cmd_details);
127 int i40e_aq_set_vsi_uc_promisc_on_vlan(struct i40e_hw *hw,
128 				       u16 seid, bool enable,
129 				       u16 vid,
130 				       struct i40e_asq_cmd_details *cmd_details);
131 int i40e_aq_set_vsi_bc_promisc_on_vlan(struct i40e_hw *hw,
132 				       u16 seid, bool enable, u16 vid,
133 				       struct i40e_asq_cmd_details *cmd_details);
134 int i40e_aq_get_vsi_params(struct i40e_hw *hw,
135 			   struct i40e_vsi_context *vsi_ctx,
136 			   struct i40e_asq_cmd_details *cmd_details);
137 int i40e_aq_update_vsi_params(struct i40e_hw *hw,
138 			      struct i40e_vsi_context *vsi_ctx,
139 			      struct i40e_asq_cmd_details *cmd_details);
140 int i40e_aq_add_veb(struct i40e_hw *hw, u16 uplink_seid,
141 		    u16 downlink_seid, u8 enabled_tc,
142 		    bool default_port, u16 *pveb_seid,
143 		    bool enable_stats,
144 		    struct i40e_asq_cmd_details *cmd_details);
145 int i40e_aq_get_veb_parameters(struct i40e_hw *hw,
146 			       u16 veb_seid, u16 *switch_id, bool *floating,
147 			       u16 *statistic_index, u16 *vebs_used,
148 			       u16 *vebs_free,
149 			       struct i40e_asq_cmd_details *cmd_details);
150 int i40e_aq_add_macvlan(struct i40e_hw *hw, u16 vsi_id,
151 			struct i40e_aqc_add_macvlan_element_data *mv_list,
152 			u16 count, struct i40e_asq_cmd_details *cmd_details);
153 int
154 i40e_aq_add_macvlan_v2(struct i40e_hw *hw, u16 seid,
155 		       struct i40e_aqc_add_macvlan_element_data *mv_list,
156 		       u16 count, struct i40e_asq_cmd_details *cmd_details,
157 		       enum libie_aq_err *aq_status);
158 int i40e_aq_remove_macvlan(struct i40e_hw *hw, u16 vsi_id,
159 			   struct i40e_aqc_remove_macvlan_element_data *mv_list,
160 			   u16 count, struct i40e_asq_cmd_details *cmd_details);
161 int
162 i40e_aq_remove_macvlan_v2(struct i40e_hw *hw, u16 seid,
163 			  struct i40e_aqc_remove_macvlan_element_data *mv_list,
164 			  u16 count, struct i40e_asq_cmd_details *cmd_details,
165 			  enum libie_aq_err *aq_status);
166 
167 int i40e_aq_send_msg_to_vf(struct i40e_hw *hw, u16 vfid,
168 			   u32 v_opcode, u32 v_retval, u8 *msg, u16 msglen,
169 			   struct i40e_asq_cmd_details *cmd_details);
170 int i40e_aq_get_switch_config(struct i40e_hw *hw,
171 			      struct i40e_aqc_get_switch_config_resp *buf,
172 			      u16 buf_size, u16 *start_seid,
173 			      struct i40e_asq_cmd_details *cmd_details);
174 int i40e_aq_set_switch_config(struct i40e_hw *hw,
175 			      u16 flags,
176 			      u16 valid_flags, u8 mode,
177 			      struct i40e_asq_cmd_details *cmd_details);
178 int i40e_aq_request_resource(struct i40e_hw *hw,
179 			     enum i40e_aq_resources_ids resource,
180 			     enum i40e_aq_resource_access_type access,
181 			     u8 sdp_number, u64 *timeout,
182 			     struct i40e_asq_cmd_details *cmd_details);
183 int i40e_aq_release_resource(struct i40e_hw *hw,
184 			     enum i40e_aq_resources_ids resource,
185 			     u8 sdp_number,
186 			     struct i40e_asq_cmd_details *cmd_details);
187 int i40e_aq_read_nvm(struct i40e_hw *hw, u8 module_pointer,
188 		     u32 offset, u16 length, void *data,
189 		     bool last_command,
190 		     struct i40e_asq_cmd_details *cmd_details);
191 int i40e_aq_erase_nvm(struct i40e_hw *hw, u8 module_pointer,
192 		      u32 offset, u16 length, bool last_command,
193 		      struct i40e_asq_cmd_details *cmd_details);
194 int i40e_aq_discover_capabilities(struct i40e_hw *hw,
195 				  void *buff, u16 buff_size, u16 *data_size,
196 				  enum i40e_admin_queue_opc list_type_opc,
197 				  struct i40e_asq_cmd_details *cmd_details);
198 int i40e_aq_update_nvm(struct i40e_hw *hw, u8 module_pointer,
199 		       u32 offset, u16 length, void *data,
200 		       bool last_command, u8 preservation_flags,
201 		       struct i40e_asq_cmd_details *cmd_details);
202 int i40e_aq_get_lldp_mib(struct i40e_hw *hw, u8 bridge_type,
203 			 u8 mib_type, void *buff, u16 buff_size,
204 			 u16 *local_len, u16 *remote_len,
205 			 struct i40e_asq_cmd_details *cmd_details);
206 int
207 i40e_aq_set_lldp_mib(struct i40e_hw *hw,
208 		     u8 mib_type, void *buff, u16 buff_size,
209 		     struct i40e_asq_cmd_details *cmd_details);
210 int i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
211 				      bool enable_update,
212 				      struct i40e_asq_cmd_details *cmd_details);
213 int i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
214 		      bool persist,
215 		      struct i40e_asq_cmd_details *cmd_details);
216 int i40e_aq_set_dcb_parameters(struct i40e_hw *hw,
217 			       bool dcb_enable,
218 			       struct i40e_asq_cmd_details
219 			       *cmd_details);
220 int i40e_aq_start_lldp(struct i40e_hw *hw, bool persist,
221 		       struct i40e_asq_cmd_details *cmd_details);
222 int i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,
223 			       void *buff, u16 buff_size,
224 			       struct i40e_asq_cmd_details *cmd_details);
225 int i40e_aq_add_udp_tunnel(struct i40e_hw *hw,
226 			   u16 udp_port, u8 protocol_index,
227 			   u8 *filter_index,
228 			   struct i40e_asq_cmd_details *cmd_details);
229 int i40e_aq_del_udp_tunnel(struct i40e_hw *hw, u8 index,
230 			   struct i40e_asq_cmd_details *cmd_details);
231 int i40e_aq_delete_element(struct i40e_hw *hw, u16 seid,
232 			   struct i40e_asq_cmd_details *cmd_details);
233 int i40e_aq_mac_address_write(struct i40e_hw *hw,
234 			      u16 flags, u8 *mac_addr,
235 			      struct i40e_asq_cmd_details *cmd_details);
236 int i40e_aq_config_vsi_bw_limit(struct i40e_hw *hw,
237 				u16 seid, u16 credit, u8 max_credit,
238 				struct i40e_asq_cmd_details *cmd_details);
239 int i40e_aq_dcb_updated(struct i40e_hw *hw,
240 			struct i40e_asq_cmd_details *cmd_details);
241 int i40e_aq_config_vsi_tc_bw(struct i40e_hw *hw, u16 seid,
242 			     struct i40e_aqc_configure_vsi_tc_bw_data *bw_data,
243 			     struct i40e_asq_cmd_details *cmd_details);
244 int
245 i40e_aq_config_switch_comp_ets(struct i40e_hw *hw,
246 			       u16 seid,
247 			       struct i40e_aqc_configure_switching_comp_ets_data *ets_data,
248 			       enum i40e_admin_queue_opc opcode,
249 			       struct i40e_asq_cmd_details *cmd_details);
250 int i40e_aq_config_switch_comp_bw_config(struct i40e_hw *hw,
251 	u16 seid,
252 	struct i40e_aqc_configure_switching_comp_bw_config_data *bw_data,
253 	struct i40e_asq_cmd_details *cmd_details);
254 int i40e_aq_query_vsi_bw_config(struct i40e_hw *hw,
255 				u16 seid,
256 				struct i40e_aqc_query_vsi_bw_config_resp *bw_data,
257 				struct i40e_asq_cmd_details *cmd_details);
258 int
259 i40e_aq_query_vsi_ets_sla_config(struct i40e_hw *hw,
260 				 u16 seid,
261 				 struct i40e_aqc_query_vsi_ets_sla_config_resp *bw_data,
262 				 struct i40e_asq_cmd_details *cmd_details);
263 int
264 i40e_aq_query_switch_comp_ets_config(struct i40e_hw *hw,
265 				     u16 seid,
266 				     struct i40e_aqc_query_switching_comp_ets_config_resp *bw_data,
267 				     struct i40e_asq_cmd_details *cmd_details);
268 int
269 i40e_aq_query_port_ets_config(struct i40e_hw *hw,
270 			      u16 seid,
271 			      struct i40e_aqc_query_port_ets_config_resp *bw_data,
272 			      struct i40e_asq_cmd_details *cmd_details);
273 int
274 i40e_aq_query_switch_comp_bw_config(struct i40e_hw *hw,
275 				    u16 seid,
276 				    struct i40e_aqc_query_switching_comp_bw_config_resp *bw_data,
277 				    struct i40e_asq_cmd_details *cmd_details);
278 int i40e_aq_resume_port_tx(struct i40e_hw *hw,
279 			   struct i40e_asq_cmd_details *cmd_details);
280 int
281 i40e_aq_add_cloud_filters_bb(struct i40e_hw *hw, u16 seid,
282 			     struct i40e_aqc_cloud_filters_element_bb *filters,
283 			     u8 filter_count);
284 int
285 i40e_aq_add_cloud_filters(struct i40e_hw *hw, u16 vsi,
286 			  struct i40e_aqc_cloud_filters_element_data *filters,
287 			  u8 filter_count);
288 int
289 i40e_aq_rem_cloud_filters(struct i40e_hw *hw, u16 vsi,
290 			  struct i40e_aqc_cloud_filters_element_data *filters,
291 			  u8 filter_count);
292 int
293 i40e_aq_rem_cloud_filters_bb(struct i40e_hw *hw, u16 seid,
294 			     struct i40e_aqc_cloud_filters_element_bb *filters,
295 			     u8 filter_count);
296 int i40e_read_lldp_cfg(struct i40e_hw *hw,
297 		       struct i40e_lldp_variables *lldp_cfg);
298 int
299 i40e_aq_suspend_port_tx(struct i40e_hw *hw, u16 seid,
300 			struct i40e_asq_cmd_details *cmd_details);
301 /* i40e_common */
302 int i40e_init_shared_code(struct i40e_hw *hw);
303 int i40e_pf_reset(struct i40e_hw *hw);
304 void i40e_clear_hw(struct i40e_hw *hw);
305 void i40e_clear_pxe_mode(struct i40e_hw *hw);
306 int i40e_get_link_status(struct i40e_hw *hw, bool *link_up);
307 int i40e_update_link_info(struct i40e_hw *hw);
308 int i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
309 int i40e_read_bw_from_alt_ram(struct i40e_hw *hw,
310 			      u32 *max_bw, u32 *min_bw, bool *min_valid,
311 			      bool *max_valid);
312 int
313 i40e_aq_configure_partition_bw(struct i40e_hw *hw,
314 			       struct i40e_aqc_configure_partition_bw_data *bw_data,
315 			       struct i40e_asq_cmd_details *cmd_details);
316 int i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
317 void i40e_get_pba_string(struct i40e_hw *hw);
318 void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable);
319 /* prototype for functions used for NVM access */
320 int i40e_init_nvm(struct i40e_hw *hw);
321 int i40e_acquire_nvm(struct i40e_hw *hw,
322 		     enum i40e_aq_resource_access_type access);
323 void i40e_release_nvm(struct i40e_hw *hw);
324 int i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
325 		       u16 *data);
326 int i40e_read_nvm_module_data(struct i40e_hw *hw,
327 			      u8 module_ptr,
328 			      u16 module_offset,
329 			      u16 data_offset,
330 			      u16 words_data_size,
331 			      u16 *data_ptr);
332 int i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
333 			 u16 *words, u16 *data);
334 int i40e_update_nvm_checksum(struct i40e_hw *hw);
335 int i40e_validate_nvm_checksum(struct i40e_hw *hw,
336 			       u16 *checksum);
337 int i40e_nvmupd_command(struct i40e_hw *hw,
338 			struct i40e_nvm_access *cmd,
339 			u8 *bytes, int *errno);
340 void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode,
341 				  struct libie_aq_desc *desc);
342 void i40e_nvmupd_clear_wait_state(struct i40e_hw *hw);
343 void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
344 
345 int i40e_set_mac_type(struct i40e_hw *hw);
346 
347 /**
348  * i40e_virtchnl_link_speed - Convert AdminQ link_speed to virtchnl definition
349  * @link_speed: the speed to convert
350  *
351  * Returns the link_speed in terms of the virtchnl interface, for use in
352  * converting link_speed as reported by the AdminQ into the format used for
353  * talking to virtchnl devices. If we can't represent the link speed properly,
354  * report LINK_SPEED_UNKNOWN.
355  **/
356 static inline enum virtchnl_link_speed
i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)357 i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)
358 {
359 	switch (link_speed) {
360 	case I40E_LINK_SPEED_100MB:
361 		return VIRTCHNL_LINK_SPEED_100MB;
362 	case I40E_LINK_SPEED_1GB:
363 		return VIRTCHNL_LINK_SPEED_1GB;
364 	case I40E_LINK_SPEED_2_5GB:
365 		return VIRTCHNL_LINK_SPEED_2_5GB;
366 	case I40E_LINK_SPEED_5GB:
367 		return VIRTCHNL_LINK_SPEED_5GB;
368 	case I40E_LINK_SPEED_10GB:
369 		return VIRTCHNL_LINK_SPEED_10GB;
370 	case I40E_LINK_SPEED_40GB:
371 		return VIRTCHNL_LINK_SPEED_40GB;
372 	case I40E_LINK_SPEED_20GB:
373 		return VIRTCHNL_LINK_SPEED_20GB;
374 	case I40E_LINK_SPEED_25GB:
375 		return VIRTCHNL_LINK_SPEED_25GB;
376 	case I40E_LINK_SPEED_UNKNOWN:
377 	default:
378 		return VIRTCHNL_LINK_SPEED_UNKNOWN;
379 	}
380 }
381 
382 /* prototype for functions used for SW locks */
383 
384 /* i40e_common for VF drivers*/
385 int i40e_set_filter_control(struct i40e_hw *hw,
386 			    struct i40e_filter_control_settings *settings);
387 int i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
388 					  u8 *mac_addr, u16 ethtype, u16 flags,
389 					  u16 vsi_seid, u16 queue, bool is_add,
390 					  struct i40e_control_filter_stats *stats,
391 					  struct i40e_asq_cmd_details *cmd_details);
392 int i40e_aq_debug_dump(struct i40e_hw *hw, u8 cluster_id,
393 		       u8 table_id, u32 start_index, u16 buff_size,
394 		       void *buff, u16 *ret_buff_size,
395 		       u8 *ret_next_table, u32 *ret_next_index,
396 		       struct i40e_asq_cmd_details *cmd_details);
397 void i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
398 						    u16 vsi_seid);
399 int i40e_aq_rx_ctl_read_register(struct i40e_hw *hw,
400 				 u32 reg_addr, u32 *reg_val,
401 				 struct i40e_asq_cmd_details *cmd_details);
402 u32 i40e_read_rx_ctl(struct i40e_hw *hw, u32 reg_addr);
403 int i40e_aq_rx_ctl_write_register(struct i40e_hw *hw,
404 				  u32 reg_addr, u32 reg_val,
405 				  struct i40e_asq_cmd_details *cmd_details);
406 void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val);
407 int
408 i40e_aq_set_phy_register_ext(struct i40e_hw *hw,
409 			     u8 phy_select, u8 dev_addr, bool page_change,
410 			     bool set_mdio, u8 mdio_num,
411 			     u32 reg_addr, u32 reg_val,
412 			     struct i40e_asq_cmd_details *cmd_details);
413 int
414 i40e_aq_get_phy_register_ext(struct i40e_hw *hw,
415 			     u8 phy_select, u8 dev_addr, bool page_change,
416 			     bool set_mdio, u8 mdio_num,
417 			     u32 reg_addr, u32 *reg_val,
418 			     struct i40e_asq_cmd_details *cmd_details);
419 
420 /* Convenience wrappers for most common use case */
421 #define i40e_aq_set_phy_register(hw, ps, da, pc, ra, rv, cd)		\
422 	i40e_aq_set_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
423 #define i40e_aq_get_phy_register(hw, ps, da, pc, ra, rv, cd)		\
424 	i40e_aq_get_phy_register_ext(hw, ps, da, pc, false, 0, ra, rv, cd)
425 
426 int i40e_read_phy_register_clause22(struct i40e_hw *hw,
427 				    u16 reg, u8 phy_addr, u16 *value);
428 int i40e_write_phy_register_clause22(struct i40e_hw *hw,
429 				     u16 reg, u8 phy_addr, u16 value);
430 int i40e_read_phy_register_clause45(struct i40e_hw *hw,
431 				    u8 page, u16 reg, u8 phy_addr, u16 *value);
432 int i40e_write_phy_register_clause45(struct i40e_hw *hw,
433 				     u8 page, u16 reg, u8 phy_addr, u16 value);
434 u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num);
435 int i40e_aq_write_ddp(struct i40e_hw *hw, void *buff,
436 		      u16 buff_size, u32 track_id,
437 		      u32 *error_offset, u32 *error_info,
438 		      struct i40e_asq_cmd_details *
439 		      cmd_details);
440 int i40e_aq_get_ddp_list(struct i40e_hw *hw, void *buff,
441 			 u16 buff_size, u8 flags,
442 			 struct i40e_asq_cmd_details *
443 			 cmd_details);
444 struct i40e_generic_seg_header *
445 i40e_find_segment_in_package(u32 segment_type,
446 			     struct i40e_package_header *pkg_header);
447 int
448 i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *i40e_seg,
449 		   u32 track_id);
450 int
451 i40e_rollback_profile(struct i40e_hw *hw, struct i40e_profile_segment *i40e_seg,
452 		      u32 track_id);
453 /* i40e_ddp */
454 int i40e_ddp_flash(struct net_device *netdev, struct ethtool_flash *flash);
455 
456 /* Firmware and AdminQ version check helpers */
457 
458 /**
459  * i40e_is_aq_api_ver_ge
460  * @hw: pointer to i40e_hw structure
461  * @maj: API major value to compare
462  * @min: API minor value to compare
463  *
464  * Assert whether current HW API version is greater/equal than provided.
465  **/
i40e_is_aq_api_ver_ge(struct i40e_hw * hw,u16 maj,u16 min)466 static inline bool i40e_is_aq_api_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
467 {
468 	return (hw->aq.api_maj_ver > maj ||
469 		(hw->aq.api_maj_ver == maj && hw->aq.api_min_ver >= min));
470 }
471 
472 /**
473  * i40e_is_aq_api_ver_lt
474  * @hw: pointer to i40e_hw structure
475  * @maj: API major value to compare
476  * @min: API minor value to compare
477  *
478  * Assert whether current HW API version is less than provided.
479  **/
i40e_is_aq_api_ver_lt(struct i40e_hw * hw,u16 maj,u16 min)480 static inline bool i40e_is_aq_api_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
481 {
482 	return !i40e_is_aq_api_ver_ge(hw, maj, min);
483 }
484 
485 /**
486  * i40e_is_fw_ver_ge
487  * @hw: pointer to i40e_hw structure
488  * @maj: API major value to compare
489  * @min: API minor value to compare
490  *
491  * Assert whether current firmware version is greater/equal than provided.
492  **/
i40e_is_fw_ver_ge(struct i40e_hw * hw,u16 maj,u16 min)493 static inline bool i40e_is_fw_ver_ge(struct i40e_hw *hw, u16 maj, u16 min)
494 {
495 	return (hw->aq.fw_maj_ver > maj ||
496 		(hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver >= min));
497 }
498 
499 /**
500  * i40e_is_fw_ver_lt
501  * @hw: pointer to i40e_hw structure
502  * @maj: API major value to compare
503  * @min: API minor value to compare
504  *
505  * Assert whether current firmware version is less than provided.
506  **/
i40e_is_fw_ver_lt(struct i40e_hw * hw,u16 maj,u16 min)507 static inline bool i40e_is_fw_ver_lt(struct i40e_hw *hw, u16 maj, u16 min)
508 {
509 	return !i40e_is_fw_ver_ge(hw, maj, min);
510 }
511 
512 /**
513  * i40e_is_fw_ver_eq
514  * @hw: pointer to i40e_hw structure
515  * @maj: API major value to compare
516  * @min: API minor value to compare
517  *
518  * Assert whether current firmware version is equal to provided.
519  **/
i40e_is_fw_ver_eq(struct i40e_hw * hw,u16 maj,u16 min)520 static inline bool i40e_is_fw_ver_eq(struct i40e_hw *hw, u16 maj, u16 min)
521 {
522 	return (hw->aq.fw_maj_ver == maj && hw->aq.fw_min_ver == min);
523 }
524 
525 #endif /* _I40E_PROTOTYPE_H_ */
526