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_set_mac_config(struct i40e_hw *hw, u16 max_frame_size,
102 struct i40e_asq_cmd_details *cmd_details);
103 int i40e_aq_clear_pxe_mode(struct i40e_hw *hw,
104 struct i40e_asq_cmd_details *cmd_details);
105 int i40e_aq_set_link_restart_an(struct i40e_hw *hw,
106 bool enable_link,
107 struct i40e_asq_cmd_details *cmd_details);
108 int 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);
111 int i40e_aq_send_driver_version(struct i40e_hw *hw,
112 struct i40e_driver_version *dv,
113 struct i40e_asq_cmd_details *cmd_details);
114 int i40e_aq_add_vsi(struct i40e_hw *hw,
115 struct i40e_vsi_context *vsi_ctx,
116 struct i40e_asq_cmd_details *cmd_details);
117 int i40e_aq_set_vsi_broadcast(struct i40e_hw *hw,
118 u16 vsi_id, bool set_filter,
119 struct i40e_asq_cmd_details *cmd_details);
120 int 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);
123 int i40e_aq_set_vsi_multicast_promiscuous(struct i40e_hw *hw, u16 vsi_id, bool set,
124 struct i40e_asq_cmd_details *cmd_details);
125 int 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);
129 int 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);
133 int 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);
136 int i40e_aq_get_vsi_params(struct i40e_hw *hw,
137 struct i40e_vsi_context *vsi_ctx,
138 struct i40e_asq_cmd_details *cmd_details);
139 int i40e_aq_update_vsi_params(struct i40e_hw *hw,
140 struct i40e_vsi_context *vsi_ctx,
141 struct i40e_asq_cmd_details *cmd_details);
142 int 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);
147 int 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);
152 int 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);
155 int
156 i40e_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);
160 int 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);
163 int
164 i40e_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
169 int 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);
172 int 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);
176 int 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);
180 int 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);
185 int 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);
189 int 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);
193 int 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);
196 int 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);
200 int 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);
204 int 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);
208 int
209 i40e_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);
212 int i40e_aq_cfg_lldp_mib_change_event(struct i40e_hw *hw,
213 bool enable_update,
214 struct i40e_asq_cmd_details *cmd_details);
215 int i40e_aq_stop_lldp(struct i40e_hw *hw, bool shutdown_agent,
216 bool persist,
217 struct i40e_asq_cmd_details *cmd_details);
218 int i40e_aq_set_dcb_parameters(struct i40e_hw *hw,
219 bool dcb_enable,
220 struct i40e_asq_cmd_details
221 *cmd_details);
222 int i40e_aq_start_lldp(struct i40e_hw *hw, bool persist,
223 struct i40e_asq_cmd_details *cmd_details);
224 int i40e_aq_get_cee_dcb_config(struct i40e_hw *hw,
225 void *buff, u16 buff_size,
226 struct i40e_asq_cmd_details *cmd_details);
227 int 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);
231 int i40e_aq_del_udp_tunnel(struct i40e_hw *hw, u8 index,
232 struct i40e_asq_cmd_details *cmd_details);
233 int i40e_aq_delete_element(struct i40e_hw *hw, u16 seid,
234 struct i40e_asq_cmd_details *cmd_details);
235 int i40e_aq_mac_address_write(struct i40e_hw *hw,
236 u16 flags, u8 *mac_addr,
237 struct i40e_asq_cmd_details *cmd_details);
238 int 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);
241 int i40e_aq_dcb_updated(struct i40e_hw *hw,
242 struct i40e_asq_cmd_details *cmd_details);
243 int 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);
246 int
247 i40e_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);
252 int 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);
256 int 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);
260 int
261 i40e_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);
265 int
266 i40e_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);
270 int
271 i40e_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);
275 int
276 i40e_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);
280 int i40e_aq_resume_port_tx(struct i40e_hw *hw,
281 struct i40e_asq_cmd_details *cmd_details);
282 int
283 i40e_aq_add_cloud_filters_bb(struct i40e_hw *hw, u16 seid,
284 struct i40e_aqc_cloud_filters_element_bb *filters,
285 u8 filter_count);
286 int
287 i40e_aq_add_cloud_filters(struct i40e_hw *hw, u16 vsi,
288 struct i40e_aqc_cloud_filters_element_data *filters,
289 u8 filter_count);
290 int
291 i40e_aq_rem_cloud_filters(struct i40e_hw *hw, u16 vsi,
292 struct i40e_aqc_cloud_filters_element_data *filters,
293 u8 filter_count);
294 int
295 i40e_aq_rem_cloud_filters_bb(struct i40e_hw *hw, u16 seid,
296 struct i40e_aqc_cloud_filters_element_bb *filters,
297 u8 filter_count);
298 int i40e_read_lldp_cfg(struct i40e_hw *hw,
299 struct i40e_lldp_variables *lldp_cfg);
300 int
301 i40e_aq_suspend_port_tx(struct i40e_hw *hw, u16 seid,
302 struct i40e_asq_cmd_details *cmd_details);
303 /* i40e_common */
304 int i40e_init_shared_code(struct i40e_hw *hw);
305 int i40e_pf_reset(struct i40e_hw *hw);
306 void i40e_clear_hw(struct i40e_hw *hw);
307 void i40e_clear_pxe_mode(struct i40e_hw *hw);
308 int i40e_get_link_status(struct i40e_hw *hw, bool *link_up);
309 int i40e_update_link_info(struct i40e_hw *hw);
310 int i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
311 int i40e_read_bw_from_alt_ram(struct i40e_hw *hw,
312 u32 *max_bw, u32 *min_bw, bool *min_valid,
313 bool *max_valid);
314 int
315 i40e_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);
318 int i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr);
319 void i40e_get_pba_string(struct i40e_hw *hw);
320 void i40e_pre_tx_queue_cfg(struct i40e_hw *hw, u32 queue, bool enable);
321 /* prototype for functions used for NVM access */
322 int i40e_init_nvm(struct i40e_hw *hw);
323 int i40e_acquire_nvm(struct i40e_hw *hw,
324 enum i40e_aq_resource_access_type access);
325 void i40e_release_nvm(struct i40e_hw *hw);
326 int i40e_read_nvm_word(struct i40e_hw *hw, u16 offset,
327 u16 *data);
328 int 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);
334 int i40e_read_nvm_buffer(struct i40e_hw *hw, u16 offset,
335 u16 *words, u16 *data);
336 int i40e_update_nvm_checksum(struct i40e_hw *hw);
337 int i40e_validate_nvm_checksum(struct i40e_hw *hw,
338 u16 *checksum);
339 int i40e_nvmupd_command(struct i40e_hw *hw,
340 struct i40e_nvm_access *cmd,
341 u8 *bytes, int *errno);
342 void i40e_nvmupd_check_wait_event(struct i40e_hw *hw, u16 opcode,
343 struct libie_aq_desc *desc);
344 void i40e_nvmupd_clear_wait_state(struct i40e_hw *hw);
345 void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status);
346
347 int 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 **/
358 static inline enum virtchnl_link_speed
i40e_virtchnl_link_speed(enum i40e_aq_link_speed link_speed)359 i40e_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*/
387 int i40e_set_filter_control(struct i40e_hw *hw,
388 struct i40e_filter_control_settings *settings);
389 int 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);
394 int 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);
399 void i40e_add_filter_to_drop_tx_flow_control_frames(struct i40e_hw *hw,
400 u16 vsi_seid);
401 int 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);
404 u32 i40e_read_rx_ctl(struct i40e_hw *hw, u32 reg_addr);
405 int 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);
408 void i40e_write_rx_ctl(struct i40e_hw *hw, u32 reg_addr, u32 reg_val);
409 int
410 i40e_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);
415 int
416 i40e_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
428 int i40e_read_phy_register_clause22(struct i40e_hw *hw,
429 u16 reg, u8 phy_addr, u16 *value);
430 int i40e_write_phy_register_clause22(struct i40e_hw *hw,
431 u16 reg, u8 phy_addr, u16 value);
432 int i40e_read_phy_register_clause45(struct i40e_hw *hw,
433 u8 page, u16 reg, u8 phy_addr, u16 *value);
434 int i40e_write_phy_register_clause45(struct i40e_hw *hw,
435 u8 page, u16 reg, u8 phy_addr, u16 value);
436 u8 i40e_get_phy_address(struct i40e_hw *hw, u8 dev_num);
437 int 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);
442 int 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);
446 struct i40e_generic_seg_header *
447 i40e_find_segment_in_package(u32 segment_type,
448 struct i40e_package_header *pkg_header);
449 int
450 i40e_write_profile(struct i40e_hw *hw, struct i40e_profile_segment *i40e_seg,
451 u32 track_id);
452 int
453 i40e_rollback_profile(struct i40e_hw *hw, struct i40e_profile_segment *i40e_seg,
454 u32 track_id);
455 /* i40e_ddp */
456 int 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 **/
i40e_is_aq_api_ver_ge(struct i40e_hw * hw,u16 maj,u16 min)468 static 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 **/
i40e_is_aq_api_ver_lt(struct i40e_hw * hw,u16 maj,u16 min)482 static 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 **/
i40e_is_fw_ver_ge(struct i40e_hw * hw,u16 maj,u16 min)495 static 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 **/
i40e_is_fw_ver_lt(struct i40e_hw * hw,u16 maj,u16 min)509 static 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 **/
i40e_is_fw_ver_eq(struct i40e_hw * hw,u16 maj,u16 min)522 static 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_ */
528