net/mlx5: refactor Linux MAC operations
[dpdk.git] / drivers / net / mlx5 / mlx5.h
index e8a7b10..88cfed8 100644 (file)
@@ -216,6 +216,9 @@ 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. */
+       unsigned int sys_mem_en:1; /* The default memory allocator. */
+       unsigned int decap_en:1; /* Whether decap will be used or not. */
        struct {
                unsigned int enabled:1; /* Whether MPRQ is enabled. */
                unsigned int stride_num_n; /* Number of strides. */
@@ -555,6 +558,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. */
@@ -570,6 +579,31 @@ struct mlx5_dev_txpp {
        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. */
 };
 
 /*
@@ -631,6 +665,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. */
 };
 
@@ -766,6 +802,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 */
 
@@ -823,7 +861,6 @@ int mlx5_dev_configure_rss_reta(struct rte_eth_dev *dev);
 
 /* mlx5_mac.c */
 
-int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]);
 void mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
 int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
                      uint32_t index, uint32_t vmdq);
@@ -889,7 +926,6 @@ int mlx5_traffic_restart(struct rte_eth_dev *dev);
 
 int mlx5_flow_discover_mreg_c(struct rte_eth_dev *eth_dev);
 bool mlx5_flow_ext_mreg_supported(struct rte_eth_dev *dev);
-int mlx5_flow_discover_priorities(struct rte_eth_dev *dev);
 void mlx5_flow_print(struct rte_flow *flow);
 int mlx5_flow_validate(struct rte_eth_dev *dev,
                       const struct rte_flow_attr *attr,
@@ -989,9 +1025,25 @@ int mlx5_os_get_stats_n(struct rte_eth_dev *dev);
 void mlx5_os_stats_init(struct rte_eth_dev *dev);
 void mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb,
                           mlx5_dereg_mr_t *dereg_mr_cb);
+void mlx5_os_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index);
+int mlx5_os_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac,
+                        uint32_t index);
+int mlx5_os_vf_mac_addr_modify(struct mlx5_priv *priv, unsigned int iface_idx,
+                              struct rte_ether_addr *mac_addr,
+                              int vf_index);
+
 /* mlx5_txpp.c */
 
 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_ */