1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Intel Corporation
8 #include <ethdev_driver.h>
9 #include <rte_tm_driver.h>
11 #include <iavf_prototype.h>
12 #include <iavf_adminq_cmd.h>
13 #include <iavf_type.h>
15 #include "base/ice_type.h"
18 struct dcf_virtchnl_cmd {
19 TAILQ_ENTRY(dcf_virtchnl_cmd) next;
21 enum virtchnl_ops v_op;
22 enum iavf_status v_ret;
34 struct ice_dcf_tm_shaper_profile {
35 TAILQ_ENTRY(ice_dcf_tm_shaper_profile) node;
36 uint32_t shaper_profile_id;
37 uint32_t reference_count;
38 struct rte_tm_shaper_params profile;
41 TAILQ_HEAD(ice_dcf_shaper_profile_list, ice_dcf_tm_shaper_profile);
43 /* Struct to store Traffic Manager node configuration. */
44 struct ice_dcf_tm_node {
45 TAILQ_ENTRY(ice_dcf_tm_node) node;
50 uint32_t reference_count;
51 struct ice_dcf_tm_node *parent;
52 struct ice_dcf_tm_shaper_profile *shaper_profile;
53 struct rte_tm_node_params params;
56 TAILQ_HEAD(ice_dcf_tm_node_list, ice_dcf_tm_node);
58 /* node type of Traffic Manager */
59 enum ice_dcf_tm_node_type {
60 ICE_DCF_TM_NODE_TYPE_PORT,
61 ICE_DCF_TM_NODE_TYPE_TC,
62 ICE_DCF_TM_NODE_TYPE_VSI,
63 ICE_DCF_TM_NODE_TYPE_MAX,
66 /* Struct to store all the Traffic Manager configuration. */
67 struct ice_dcf_tm_conf {
68 struct ice_dcf_shaper_profile_list shaper_profile_list;
69 struct ice_dcf_tm_node *root; /* root node - port */
70 struct ice_dcf_tm_node_list tc_list; /* node list for all the TCs */
71 struct ice_dcf_tm_node_list vsi_list; /* node list for all the queues */
80 rte_spinlock_t vc_cmd_send_lock;
81 rte_spinlock_t vc_cmd_queue_lock;
82 TAILQ_HEAD(, dcf_virtchnl_cmd) vc_cmd_queue;
83 void (*vc_event_msg_cb)(struct ice_dcf_hw *dcf_hw,
84 uint8_t *msg, uint16_t msglen);
92 struct ice_dcf_tm_conf tm_conf;
93 struct virtchnl_dcf_bw_cfg_list **qos_bw_cfg;
94 struct ice_aqc_port_ets_elem *ets_config;
95 struct virtchnl_version_info virtchnl_version;
96 struct virtchnl_vf_resource *vf_res; /* VF resource */
97 struct virtchnl_vsi_resource *vsi_res; /* LAN VSI */
100 struct rte_eth_dev *eth_dev;
103 uint64_t supported_rxdid;
104 uint16_t num_queue_pairs;
108 uint16_t rxq_map[16];
109 struct virtchnl_eth_stats eth_stats_offset;
118 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
119 struct dcf_virtchnl_cmd *cmd);
120 int ice_dcf_send_aq_cmd(void *dcf_hw, struct ice_aq_desc *desc,
121 void *buf, uint16_t buf_size);
122 int ice_dcf_handle_vsi_update_event(struct ice_dcf_hw *hw);
123 int ice_dcf_init_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
124 void ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw);
125 int ice_dcf_init_rss(struct ice_dcf_hw *hw);
126 int ice_dcf_configure_queues(struct ice_dcf_hw *hw);
127 int ice_dcf_config_irq_map(struct ice_dcf_hw *hw);
128 int ice_dcf_switch_queue(struct ice_dcf_hw *hw, uint16_t qid, bool rx, bool on);
129 int ice_dcf_disable_queues(struct ice_dcf_hw *hw);
130 int ice_dcf_query_stats(struct ice_dcf_hw *hw,
131 struct virtchnl_eth_stats *pstats);
132 int ice_dcf_add_del_all_mac_addr(struct ice_dcf_hw *hw, bool add);
133 int ice_dcf_link_update(struct rte_eth_dev *dev,
134 __rte_unused int wait_to_complete);
135 void ice_dcf_tm_conf_init(struct rte_eth_dev *dev);
136 void ice_dcf_tm_conf_uninit(struct rte_eth_dev *dev);
137 int ice_dcf_replay_vf_bw(struct ice_dcf_hw *hw, uint16_t vf_id);
138 int ice_dcf_clear_bw(struct ice_dcf_hw *hw);
140 #endif /* _ICE_DCF_H_ */