File Index
Files and directories
Sign in
FILE

i40e_prototype.h

File preview with syntax highlighting.

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