net/mlx5: add flow translation of eCPRI header
[dpdk.git] / drivers / net / mlx5 / mlx5.h
index 0b73b2a..9b29e3c 100644 (file)
@@ -216,6 +216,7 @@ struct mlx5_dev_config {
        unsigned int devx:1; /* Whether devx interface is available or not. */
        unsigned int dest_tir:1; /* Whether advanced DR API is available. */
        unsigned int reclaim_mode:2; /* Memory reclaim mode. */
+       unsigned int rt_timestamp:1; /* realtime timestamp format. */
        struct {
                unsigned int enabled:1; /* Whether MPRQ is enabled. */
                unsigned int stride_num_n; /* Number of strides. */
@@ -555,6 +556,12 @@ struct mlx5_txpp_wq {
        volatile uint32_t *sq_dbrec;
 };
 
+/* Tx packet pacing internal timestamp. */
+struct mlx5_txpp_ts {
+       rte_atomic64_t ci_ts;
+       rte_atomic64_t ts;
+};
+
 /* Tx packet pacing structure. */
 struct mlx5_dev_txpp {
        pthread_mutex_t mutex; /* Pacing create/destroy mutex. */
@@ -567,6 +574,34 @@ struct mlx5_dev_txpp {
        struct rte_intr_handle intr_handle; /* Periodic interrupt. */
        struct mlx5dv_devx_event_channel *echan; /* Event Channel. */
        struct mlx5_txpp_wq clock_queue; /* Clock Queue. */
+       struct mlx5_txpp_wq rearm_queue; /* Clock Queue. */
+       struct mlx5dv_pp *pp; /* Packet pacing context. */
+       uint16_t pp_id; /* Packet pacing context index. */
+       uint16_t ts_n; /* Number of captured timestamps. */
+       uint16_t ts_p; /* Pointer to statisticks timestamp. */
+       struct mlx5_txpp_ts *tsa; /* Timestamps sliding window stats. */
+       struct mlx5_txpp_ts ts; /* Cached completion id/timestamp. */
+       uint32_t sync_lost:1; /* ci/timestamp synchronization lost. */
+       /* Statistics counters. */
+       rte_atomic32_t err_miss_int; /* Missed service interrupt. */
+       rte_atomic32_t err_rearm_queue; /* Rearm Queue errors. */
+       rte_atomic32_t err_clock_queue; /* Clock Queue errors. */
+       rte_atomic32_t err_ts_past; /* Timestamp in the past. */
+       rte_atomic32_t err_ts_future; /* Timestamp in the distant future. */
+};
+
+/* Supported flex parser profile ID. */
+enum mlx5_flex_parser_profile_id {
+       MLX5_FLEX_PARSER_ECPRI_0 = 0,
+       MLX5_FLEX_PARSER_MAX = 8,
+};
+
+/* Sample ID information of flex parser structure. */
+struct mlx5_flex_parser_profiles {
+       uint32_t num;           /* Actual number of samples. */
+       uint32_t ids[8];        /* Sample IDs for this profile. */
+       uint8_t offset[8];      /* Bytes offset of each parser. */
+       void *obj;              /* Flex parser node object. */
 };
 
 /*
@@ -628,6 +663,8 @@ struct mlx5_dev_ctx_shared {
        struct mlx5_devx_obj *td; /* Transport domain. */
        struct mlx5_flow_id_pool *flow_id_pool; /* Flow ID pool. */
        struct mlx5dv_devx_uar *tx_uar; /* Tx/packer pacing shared UAR. */
+       struct mlx5_flex_parser_profiles fp[MLX5_FLEX_PARSER_MAX];
+       /* Flex parser profiles information. */
        struct mlx5_dev_shared_port port[]; /* per device port data array. */
 };
 
@@ -763,6 +800,8 @@ int mlx5_fw_version_get(struct rte_eth_dev *dev, char *fw_ver, size_t fw_size);
 int mlx5_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu);
 int mlx5_hairpin_cap_get(struct rte_eth_dev *dev,
                         struct rte_eth_hairpin_cap *cap);
+bool mlx5_flex_parser_ecpri_exist(struct rte_eth_dev *dev);
+int mlx5_flex_parser_ecpri_alloc(struct rte_eth_dev *dev);
 
 /* mlx5_ethdev.c */
 
@@ -990,5 +1029,14 @@ void mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb,
 
 int mlx5_txpp_start(struct rte_eth_dev *dev);
 void mlx5_txpp_stop(struct rte_eth_dev *dev);
+int mlx5_txpp_read_clock(struct rte_eth_dev *dev, uint64_t *timestamp);
+int mlx5_txpp_xstats_get(struct rte_eth_dev *dev,
+                        struct rte_eth_xstat *stats,
+                        unsigned int n, unsigned int n_used);
+int mlx5_txpp_xstats_reset(struct rte_eth_dev *dev);
+int mlx5_txpp_xstats_get_names(struct rte_eth_dev *dev,
+                              struct rte_eth_xstat_name *xstats_names,
+                              unsigned int n, unsigned int n_used);
+void mlx5_txpp_interrupt_handler(void *cb_arg);
 
 #endif /* RTE_PMD_MLX5_H_ */