net/i40e: support adding TM shaper profile
[dpdk.git] / drivers / net / i40e / i40e_ethdev.h
index 183dc17..af035cb 100644 (file)
@@ -39,6 +39,7 @@
 #include <rte_kvargs.h>
 #include <rte_hash.h>
 #include <rte_flow_driver.h>
+#include <rte_tm_driver.h>
 
 #define I40E_VLAN_TAG_SIZE        4
 
 
 /* Linux PF host with virtchnl version 1.1 */
 #define PF_IS_V11(vf) \
-       (((vf)->version_major == I40E_VIRTCHNL_VERSION_MAJOR) && \
+       (((vf)->version_major == VIRTCHNL_VERSION_MAJOR) && \
        ((vf)->version_minor == 1))
 
 /* index flex payload per layer */
@@ -448,6 +449,7 @@ struct i40e_vmdq_info {
                        I40E_PRTQF_FLX_PIT_DEST_OFF_MASK))
 #define I40E_WORD(hi, lo) (uint16_t)((((hi) << 8) & 0xFF00) | ((lo) & 0xFF))
 #define I40E_FLEX_WORD_MASK(off) (0x80 >> (off))
+#define I40E_FDIR_IPv6_TC_OFFSET       20
 
 /*
  * Structure to store flex pit for flow diretor.
@@ -650,6 +652,21 @@ 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);
+
+/* Struct to store all the Traffic Manager configuration. */
+struct i40e_tm_conf {
+       struct i40e_shaper_profile_list shaper_profile_list;
+};
+
 /*
  * Structure to store private data specific for PF instance.
  */
@@ -664,11 +681,9 @@ struct i40e_pf {
 
        struct i40e_hw_port_stats stats_offset;
        struct i40e_hw_port_stats stats;
-       /* internal packet byte count, it should be excluded from the total */
-       uint64_t internal_rx_bytes;
-       uint64_t internal_tx_bytes;
-       uint64_t internal_rx_bytes_offset;
-       uint64_t internal_tx_bytes_offset;
+       /* internal packet statistics, it should be excluded from the total */
+       struct i40e_eth_stats internal_stats_offset;
+       struct i40e_eth_stats internal_stats;
        bool offset_loaded;
 
        struct rte_eth_dev_data *dev_data; /* Pointer to the device data */
@@ -715,6 +730,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 {
@@ -767,7 +783,7 @@ struct i40e_vf {
        /* Event from pf */
        bool dev_closed;
        bool link_up;
-       enum i40e_aq_link_speed link_speed;
+       enum virtchnl_link_speed link_speed;
        bool vf_reset;
        volatile uint32_t pend_cmd; /* pending command not finished yet */
        int32_t cmd_retval; /* return value of the cmd response from PF */
@@ -775,8 +791,8 @@ struct i40e_vf {
        uint8_t *aq_resp; /* buffer to store the adminq response from PF */
 
        /* VSI info */
-       struct i40e_virtchnl_vf_resource *vf_res; /* All VSIs */
-       struct i40e_virtchnl_vsi_resource *vsi_res; /* LAN VSI */
+       struct virtchnl_vf_resource *vf_res; /* All VSIs */
+       struct virtchnl_vsi_resource *vsi_res; /* LAN VSI */
        struct i40e_vsi vsi;
        uint64_t flags;
 };
@@ -921,6 +937,7 @@ int i40e_add_macvlan_filters(struct i40e_vsi *vsi,
                             struct i40e_macvlan_filter *filter,
                             int total);
 bool is_i40e_supported(struct rte_eth_dev *dev);
+
 int i40e_validate_input_set(enum i40e_filter_pctype pctype,
                            enum rte_filter_type filter, uint64_t inset);
 int i40e_generate_inset_mask_reg(uint64_t inset, uint32_t *mask,
@@ -928,6 +945,13 @@ int i40e_generate_inset_mask_reg(uint64_t inset, uint32_t *mask,
 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)
+
 /* I40E_DEV_PRIVATE_TO */
 #define I40E_DEV_PRIVATE_TO_PF(adapter) \
        (&((struct i40e_adapter *)adapter)->pf)