net/i40e: support adding TM node
[dpdk.git] / drivers / net / i40e / i40e_ethdev.h
index 2e900ff..38a86f6 100644 (file)
@@ -652,6 +652,67 @@ struct rte_flow {
 
 TAILQ_HEAD(i40e_flow_list, rte_flow);
 
+/* Struct to store Traffic Manager shaper profile. */
+struct i40e_tm_shaper_profile {
+       TAILQ_ENTRY(i40e_tm_shaper_profile) node;
+       uint32_t shaper_profile_id;
+       uint32_t reference_count;
+       struct rte_tm_shaper_params profile;
+};
+
+TAILQ_HEAD(i40e_shaper_profile_list, i40e_tm_shaper_profile);
+
+/* node type of Traffic Manager */
+enum i40e_tm_node_type {
+       I40E_TM_NODE_TYPE_PORT,
+       I40E_TM_NODE_TYPE_TC,
+       I40E_TM_NODE_TYPE_QUEUE,
+       I40E_TM_NODE_TYPE_MAX,
+};
+
+/* Struct to store Traffic Manager node configuration. */
+struct i40e_tm_node {
+       TAILQ_ENTRY(i40e_tm_node) node;
+       uint32_t id;
+       uint32_t priority;
+       uint32_t weight;
+       uint32_t reference_count;
+       struct i40e_tm_node *parent;
+       struct i40e_tm_shaper_profile *shaper_profile;
+       struct rte_tm_node_params params;
+};
+
+TAILQ_HEAD(i40e_tm_node_list, i40e_tm_node);
+
+/* Struct to store all the Traffic Manager configuration. */
+struct i40e_tm_conf {
+       struct i40e_shaper_profile_list shaper_profile_list;
+       struct i40e_tm_node *root; /* root node - port */
+       struct i40e_tm_node_list tc_list; /* node list for all the TCs */
+       struct i40e_tm_node_list queue_list; /* node list for all the queues */
+       /**
+        * The number of added TC nodes.
+        * It should be no more than the TC number of this port.
+        */
+       uint32_t nb_tc_node;
+       /**
+        * The number of added queue nodes.
+        * It should be no more than the queue number of this port.
+        */
+       uint32_t nb_queue_node;
+       /**
+        * This flag is used to check if APP can change the TM node
+        * configuration.
+        * When it's true, means the configuration is applied to HW,
+        * APP should not change the configuration.
+        * As we don't support on-the-fly configuration, when starting
+        * the port, APP should call the hierarchy_commit API to set this
+        * flag to true. When stopping the port, this flag should be set
+        * to false.
+        */
+       bool committed;
+};
+
 /*
  * Structure to store private data specific for PF instance.
  */
@@ -715,6 +776,7 @@ struct i40e_pf {
        struct i40e_flow_list flow_list;
        bool mpls_replace_flag;  /* 1 - MPLS filter replace is done */
        bool qinq_replace_flag;  /* QINQ filter replace is done */
+       struct i40e_tm_conf tm_conf;
 };
 
 enum pending_msg {
@@ -930,6 +992,8 @@ uint64_t i40e_translate_input_set_reg(enum i40e_mac_type type, uint64_t input);
 void i40e_check_write_reg(struct i40e_hw *hw, uint32_t addr, uint32_t val);
 
 int i40e_tm_ops_get(struct rte_eth_dev *dev, void *ops);
+void i40e_tm_conf_init(struct rte_eth_dev *dev);
+void i40e_tm_conf_uninit(struct rte_eth_dev *dev);
 
 #define I40E_DEV_TO_PCI(eth_dev) \
        RTE_DEV_TO_PCI((eth_dev)->device)