3ea645c227e27f797c08ee4e2376c7005c640747
[dpdk.git] / drivers / net / iavf / base / iavf_prototype.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2019
3  */
4
5 #ifndef _IAVF_PROTOTYPE_H_
6 #define _IAVF_PROTOTYPE_H_
7
8 #include "iavf_type.h"
9 #include "iavf_alloc.h"
10 #include "virtchnl.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 enum iavf_status iavf_init_adminq(struct iavf_hw *hw);
21 enum iavf_status iavf_shutdown_adminq(struct iavf_hw *hw);
22 enum iavf_status iavf_init_asq(struct iavf_hw *hw);
23 enum iavf_status iavf_init_arq(struct iavf_hw *hw);
24 enum iavf_status iavf_alloc_adminq_asq_ring(struct iavf_hw *hw);
25 enum iavf_status iavf_alloc_adminq_arq_ring(struct iavf_hw *hw);
26 enum iavf_status iavf_shutdown_asq(struct iavf_hw *hw);
27 enum iavf_status 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 iavf_validate_mac_addr(u8 *mac_addr);
32 void iavf_adminq_init_ring_data(struct iavf_hw *hw);
33 enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw,
34                                         struct iavf_arq_event_info *e,
35                                         u16 *events_pending);
36 enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
37                                 struct iavf_aq_desc *desc,
38                                 void *buff, /* can be NULL */
39                                 u16  buff_size,
40                                 struct iavf_asq_cmd_details *cmd_details);
41 bool iavf_asq_done(struct iavf_hw *hw);
42
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);
46
47 void iavf_idle_aq(struct iavf_hw *hw);
48 bool iavf_check_asq_alive(struct iavf_hw *hw);
49 enum iavf_status iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading);
50
51 enum iavf_status iavf_aq_get_rss_lut(struct iavf_hw *hw, u16 seid,
52                                      bool pf_lut, u8 *lut, u16 lut_size);
53 enum iavf_status iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid,
54                                      bool pf_lut, u8 *lut, u16 lut_size);
55 enum iavf_status iavf_aq_get_rss_key(struct iavf_hw *hw,
56                                      u16 seid,
57                                      struct iavf_aqc_get_set_rss_key_data *key);
58 enum iavf_status iavf_aq_set_rss_key(struct iavf_hw *hw,
59                                      u16 seid,
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 stat_err);
63
64 enum iavf_status iavf_set_mac_type(struct iavf_hw *hw);
65
66 extern struct iavf_rx_ptype_decoded iavf_ptype_lookup[];
67
68 STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
69 {
70         return iavf_ptype_lookup[ptype];
71 }
72
73 /* prototype for functions used for SW spinlocks */
74 void iavf_init_spinlock(struct iavf_spinlock *sp);
75 void iavf_acquire_spinlock(struct iavf_spinlock *sp);
76 void iavf_release_spinlock(struct iavf_spinlock *sp);
77 void iavf_destroy_spinlock(struct iavf_spinlock *sp);
78
79 void iavf_vf_parse_hw_config(struct iavf_hw *hw,
80                              struct virtchnl_vf_resource *msg);
81 enum iavf_status iavf_vf_reset(struct iavf_hw *hw);
82 enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
83                                 enum virtchnl_ops v_opcode,
84                                 enum iavf_status v_retval,
85                                 u8 *msg, u16 msglen,
86                                 struct iavf_asq_cmd_details *cmd_details);
87 enum iavf_status iavf_aq_debug_dump(struct iavf_hw *hw, u8 cluster_id,
88                                     u8 table_id, u32 start_index, u16 buff_size,
89                                     void *buff, u16 *ret_buff_size,
90                                     u8 *ret_next_table, u32 *ret_next_index,
91                                     struct iavf_asq_cmd_details *cmd_details);
92 enum iavf_status iavf_aq_clear_all_wol_filters(struct iavf_hw *hw,
93                         struct iavf_asq_cmd_details *cmd_details);
94 #endif /* _IAVF_PROTOTYPE_H_ */