1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2024 Intel Corporation */
3 
4 #ifndef _IDPF_VIRTCHNL_H_
5 #define _IDPF_VIRTCHNL_H_
6 
7 struct idpf_adapter;
8 struct idpf_netdev_priv;
9 struct idpf_vec_regs;
10 struct idpf_vport;
11 struct idpf_vport_max_q;
12 struct idpf_vport_user_config_data;
13 
14 int idpf_init_dflt_mbx(struct idpf_adapter *adapter);
15 void idpf_deinit_dflt_mbx(struct idpf_adapter *adapter);
16 int idpf_vc_core_init(struct idpf_adapter *adapter);
17 void idpf_vc_core_deinit(struct idpf_adapter *adapter);
18 
19 int idpf_get_reg_intr_vecs(struct idpf_vport *vport,
20 			   struct idpf_vec_regs *reg_vals);
21 int idpf_queue_reg_init(struct idpf_vport *vport);
22 int idpf_vport_queue_ids_init(struct idpf_vport *vport);
23 
24 int idpf_recv_mb_msg(struct idpf_adapter *adapter);
25 int idpf_send_mb_msg(struct idpf_adapter *adapter, u32 op,
26 		     u16 msg_size, u8 *msg, u16 cookie);
27 
28 void idpf_vport_init(struct idpf_vport *vport, struct idpf_vport_max_q *max_q);
29 u32 idpf_get_vport_id(struct idpf_vport *vport);
30 int idpf_send_create_vport_msg(struct idpf_adapter *adapter,
31 			       struct idpf_vport_max_q *max_q);
32 int idpf_send_destroy_vport_msg(struct idpf_vport *vport);
33 int idpf_send_enable_vport_msg(struct idpf_vport *vport);
34 int idpf_send_disable_vport_msg(struct idpf_vport *vport);
35 
36 int idpf_vport_adjust_qs(struct idpf_vport *vport);
37 int idpf_vport_alloc_max_qs(struct idpf_adapter *adapter,
38 			    struct idpf_vport_max_q *max_q);
39 void idpf_vport_dealloc_max_qs(struct idpf_adapter *adapter,
40 			       struct idpf_vport_max_q *max_q);
41 int idpf_send_add_queues_msg(const struct idpf_vport *vport, u16 num_tx_q,
42 			     u16 num_complq, u16 num_rx_q, u16 num_rx_bufq);
43 int idpf_send_delete_queues_msg(struct idpf_vport *vport);
44 int idpf_send_enable_queues_msg(struct idpf_vport *vport);
45 int idpf_send_disable_queues_msg(struct idpf_vport *vport);
46 int idpf_send_config_queues_msg(struct idpf_vport *vport);
47 
48 int idpf_vport_alloc_vec_indexes(struct idpf_vport *vport);
49 int idpf_get_vec_ids(struct idpf_adapter *adapter,
50 		     u16 *vecids, int num_vecids,
51 		     struct virtchnl2_vector_chunks *chunks);
52 int idpf_send_alloc_vectors_msg(struct idpf_adapter *adapter, u16 num_vectors);
53 int idpf_send_dealloc_vectors_msg(struct idpf_adapter *adapter);
54 int idpf_send_map_unmap_queue_vector_msg(struct idpf_vport *vport, bool map);
55 
56 int idpf_add_del_mac_filters(struct idpf_vport *vport,
57 			     struct idpf_netdev_priv *np,
58 			     bool add, bool async);
59 int idpf_set_promiscuous(struct idpf_adapter *adapter,
60 			 struct idpf_vport_user_config_data *config_data,
61 			 u32 vport_id);
62 int idpf_check_supported_desc_ids(struct idpf_vport *vport);
63 int idpf_send_get_rx_ptype_msg(struct idpf_vport *vport);
64 int idpf_send_ena_dis_loopback_msg(struct idpf_vport *vport);
65 int idpf_send_get_stats_msg(struct idpf_vport *vport);
66 int idpf_send_set_sriov_vfs_msg(struct idpf_adapter *adapter, u16 num_vfs);
67 int idpf_send_get_set_rss_key_msg(struct idpf_vport *vport, bool get);
68 int idpf_send_get_set_rss_lut_msg(struct idpf_vport *vport, bool get);
69 
70 #endif /* _IDPF_VIRTCHNL_H_ */
71