ecd6303a06808e3de481aeaed27b5ab242f74252
[dpdk.git] / drivers / net / ice / ice_dcf.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2020 Intel Corporation
3  */
4
5 #ifndef _ICE_DCF_H_
6 #define _ICE_DCF_H_
7
8 #include <rte_ethdev_driver.h>
9
10 #include <iavf_prototype.h>
11 #include <iavf_adminq_cmd.h>
12 #include <iavf_type.h>
13
14 #include "base/ice_type.h"
15 #include "ice_logs.h"
16
17 struct dcf_virtchnl_cmd {
18         TAILQ_ENTRY(dcf_virtchnl_cmd) next;
19
20         enum virtchnl_ops v_op;
21         enum iavf_status v_ret;
22
23         uint16_t req_msglen;
24         uint8_t *req_msg;
25
26         uint16_t rsp_msglen;
27         uint16_t rsp_buflen;
28         uint8_t *rsp_msgbuf;
29
30         volatile int pending;
31 };
32
33 struct ice_dcf_hw {
34         struct iavf_hw avf;
35
36         rte_spinlock_t vc_cmd_send_lock;
37         rte_spinlock_t vc_cmd_queue_lock;
38         TAILQ_HEAD(, dcf_virtchnl_cmd) vc_cmd_queue;
39         void (*vc_event_msg_cb)(struct ice_dcf_hw *dcf_hw,
40                                 uint8_t *msg, uint16_t msglen);
41
42         uint8_t *arq_buf;
43
44         struct virtchnl_version_info virtchnl_version;
45         struct virtchnl_vf_resource *vf_res; /* VF resource */
46         struct virtchnl_vsi_resource *vsi_res; /* LAN VSI */
47         uint16_t vsi_id;
48 };
49
50 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
51                                  struct dcf_virtchnl_cmd *cmd);
52 int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
53                         void *buf, uint16_t buf_size);
54 int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
55 void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
56
57 #endif /* _ICE_DCF_H_ */