xref: /dpdk/drivers/common/iavf/iavf_prototype.h (revision b34fe66ea893c74f09322dc1109e80e81faa7d4f)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2001-2021 Intel Corporation
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 #include <rte_compat.h>
13 
14 /* Prototypes for shared code functions that are not in
15  * the standard function pointer structures.  These are
16  * mostly because they are needed even before the init
17  * has happened and will assist in the early SW and FW
18  * setup.
19  */
20 
21 /* adminq functions */
22 __rte_internal
23 enum iavf_status iavf_init_adminq(struct iavf_hw *hw);
24 __rte_internal
25 enum iavf_status iavf_shutdown_adminq(struct iavf_hw *hw);
26 enum iavf_status iavf_init_asq(struct iavf_hw *hw);
27 enum iavf_status iavf_init_arq(struct iavf_hw *hw);
28 enum iavf_status iavf_alloc_adminq_asq_ring(struct iavf_hw *hw);
29 enum iavf_status iavf_alloc_adminq_arq_ring(struct iavf_hw *hw);
30 enum iavf_status iavf_shutdown_asq(struct iavf_hw *hw);
31 enum iavf_status iavf_shutdown_arq(struct iavf_hw *hw);
32 u16 iavf_clean_asq(struct iavf_hw *hw);
33 void iavf_free_adminq_asq(struct iavf_hw *hw);
34 void iavf_free_adminq_arq(struct iavf_hw *hw);
35 enum iavf_status iavf_validate_mac_addr(u8 *mac_addr);
36 void iavf_adminq_init_ring_data(struct iavf_hw *hw);
37 __rte_internal
38 enum iavf_status iavf_clean_arq_element(struct iavf_hw *hw,
39 					struct iavf_arq_event_info *e,
40 					u16 *events_pending);
41 enum iavf_status iavf_asq_send_command(struct iavf_hw *hw,
42 				struct iavf_aq_desc *desc,
43 				void *buff, /* can be NULL */
44 				u16  buff_size,
45 				struct iavf_asq_cmd_details *cmd_details);
46 bool iavf_asq_done(struct iavf_hw *hw);
47 
48 /* debug function for adminq */
49 void iavf_debug_aq(struct iavf_hw *hw, enum iavf_debug_mask mask,
50 		   void *desc, void *buffer, u16 buf_len);
51 
52 void iavf_idle_aq(struct iavf_hw *hw);
53 bool iavf_check_asq_alive(struct iavf_hw *hw);
54 enum iavf_status iavf_aq_queue_shutdown(struct iavf_hw *hw, bool unloading);
55 
56 enum iavf_status iavf_aq_get_rss_lut(struct iavf_hw *hw, u16 seid,
57 				     bool pf_lut, u8 *lut, u16 lut_size);
58 enum iavf_status iavf_aq_set_rss_lut(struct iavf_hw *hw, u16 seid,
59 				     bool pf_lut, u8 *lut, u16 lut_size);
60 enum iavf_status iavf_aq_get_rss_key(struct iavf_hw *hw,
61 				     u16 seid,
62 				     struct iavf_aqc_get_set_rss_key_data *key);
63 enum iavf_status iavf_aq_set_rss_key(struct iavf_hw *hw,
64 				     u16 seid,
65 				     struct iavf_aqc_get_set_rss_key_data *key);
66 const char *iavf_aq_str(struct iavf_hw *hw, enum iavf_admin_queue_err aq_err);
67 const char *iavf_stat_str(struct iavf_hw *hw, enum iavf_status stat_err);
68 
69 __rte_internal
70 enum iavf_status iavf_set_mac_type(struct iavf_hw *hw);
71 
72 extern struct iavf_rx_ptype_decoded iavf_ptype_lookup[];
73 
74 STATIC INLINE struct iavf_rx_ptype_decoded decode_rx_desc_ptype(u8 ptype)
75 {
76 	return iavf_ptype_lookup[ptype];
77 }
78 
79 __rte_internal
80 void iavf_vf_parse_hw_config(struct iavf_hw *hw,
81 			     struct virtchnl_vf_resource *msg);
82 __rte_internal
83 enum iavf_status iavf_vf_reset(struct iavf_hw *hw);
84 __rte_internal
85 enum iavf_status iavf_aq_send_msg_to_pf(struct iavf_hw *hw,
86 				enum virtchnl_ops v_opcode,
87 				enum iavf_status v_retval,
88 				u8 *msg, u16 msglen,
89 				struct iavf_asq_cmd_details *cmd_details);
90 enum iavf_status iavf_aq_debug_dump(struct iavf_hw *hw, u8 cluster_id,
91 				    u8 table_id, u32 start_index, u16 buff_size,
92 				    void *buff, u16 *ret_buff_size,
93 				    u8 *ret_next_table, u32 *ret_next_index,
94 				    struct iavf_asq_cmd_details *cmd_details);
95 enum iavf_status iavf_aq_clear_all_wol_filters(struct iavf_hw *hw,
96 			struct iavf_asq_cmd_details *cmd_details);
97 #endif /* _IAVF_PROTOTYPE_H_ */
98