-/* TX queue send local data. */
-__extension__
-struct mlx5_txq_local {
- struct mlx5_wqe *wqe_last; /* last sent WQE pointer. */
- struct rte_mbuf *mbuf; /* first mbuf to process. */
- uint16_t pkts_copy; /* packets copied to elts. */
- uint16_t pkts_sent; /* packets sent. */
- uint16_t pkts_loop; /* packets sent on loop entry. */
- uint16_t elts_free; /* available elts remain. */
- uint16_t wqe_free; /* available wqe remain. */
- uint16_t mbuf_off; /* data offset in current mbuf. */
- uint16_t mbuf_nseg; /* number of remaining mbuf. */
- uint16_t mbuf_free; /* number of inline mbufs to free. */
-};
-
-/* TX queue descriptor. */
-__extension__
-struct mlx5_txq_data {
- uint16_t elts_head; /* Current counter in (*elts)[]. */
- uint16_t elts_tail; /* Counter of first element awaiting completion. */
- uint16_t elts_comp; /* elts index since last completion request. */
- uint16_t elts_s; /* Number of mbuf elements. */
- uint16_t elts_m; /* Mask for mbuf elements indices. */
- /* Fields related to elts mbuf storage. */
- uint16_t wqe_ci; /* Consumer index for work queue. */
- uint16_t wqe_pi; /* Producer index for work queue. */
- uint16_t wqe_s; /* Number of WQ elements. */
- uint16_t wqe_m; /* Mask Number for WQ elements. */
- uint16_t wqe_comp; /* WQE index since last completion request. */
- uint16_t wqe_thres; /* WQE threshold to request completion in CQ. */
- /* WQ related fields. */
- uint16_t cq_ci; /* Consumer index for completion queue. */
- uint16_t cq_pi; /* Production index for completion queue. */
- uint16_t cqe_s; /* Number of CQ elements. */
- uint16_t cqe_m; /* Mask for CQ indices. */
- /* CQ related fields. */
- uint16_t elts_n:4; /* elts[] length (in log2). */
- uint16_t cqe_n:4; /* Number of CQ elements (in log2). */
- uint16_t wqe_n:4; /* Number of WQ elements (in log2). */
- uint16_t tso_en:1; /* When set hardware TSO is enabled. */
- uint16_t tunnel_en:1;
- /* When set TX offload for tunneled packets are supported. */
- uint16_t swp_en:1; /* Whether SW parser is enabled. */
- uint16_t vlan_en:1; /* VLAN insertion in WQE is supported. */
- uint16_t db_nc:1; /* Doorbell mapped to non-cached region. */
- uint16_t db_heu:1; /* Doorbell heuristic write barrier. */
- uint16_t fast_free:1; /* mbuf fast free on Tx is enabled. */
- uint16_t inlen_send; /* Ordinary send data inline size. */
- uint16_t inlen_empw; /* eMPW max packet size to inline. */
- uint16_t inlen_mode; /* Minimal data length to inline. */
- uint32_t qp_num_8s; /* QP number shifted by 8. */
- uint64_t offloads; /* Offloads for Tx Queue. */
- struct mlx5_mr_ctrl mr_ctrl; /* MR control descriptor. */
- struct mlx5_wqe *wqes; /* Work queue. */
- struct mlx5_wqe *wqes_end; /* Work queue array limit. */
-#ifdef RTE_LIBRTE_MLX5_DEBUG
- uint32_t *fcqs; /* Free completion queue (debug extended). */
-#else
- uint16_t *fcqs; /* Free completion queue. */
-#endif
- volatile struct mlx5_cqe *cqes; /* Completion queue. */
- volatile uint32_t *qp_db; /* Work queue doorbell. */
- volatile uint32_t *cq_db; /* Completion queue doorbell. */
- uint16_t port_id; /* Port ID of device. */
- uint16_t idx; /* Queue index. */
- uint64_t ts_mask; /* Timestamp flag dynamic mask. */
- int32_t ts_offset; /* Timestamp field dynamic offset. */
- struct mlx5_dev_ctx_shared *sh; /* Shared context. */
- struct mlx5_txq_stats stats; /* TX queue counters. */
-#ifndef RTE_ARCH_64
- rte_spinlock_t *uar_lock;
- /* UAR access lock required for 32bit implementations */
-#endif
- struct rte_mbuf *elts[0];
- /* Storage for queued packets, must be the last field. */
-} __rte_cache_aligned;
-
-enum mlx5_txq_type {
- MLX5_TXQ_TYPE_STANDARD, /* Standard Tx queue. */
- MLX5_TXQ_TYPE_HAIRPIN, /* Hairpin Rx queue. */
-};
-
-/* TX queue control descriptor. */
-struct mlx5_txq_ctrl {
- LIST_ENTRY(mlx5_txq_ctrl) next; /* Pointer to the next element. */
- uint32_t refcnt; /* Reference counter. */
- unsigned int socket; /* CPU socket ID for allocations. */
- enum mlx5_txq_type type; /* The txq ctrl type. */
- unsigned int max_inline_data; /* Max inline data. */
- unsigned int max_tso_header; /* Max TSO header size. */
- struct mlx5_txq_obj *obj; /* Verbs/DevX queue object. */
- struct mlx5_priv *priv; /* Back pointer to private data. */
- off_t uar_mmap_offset; /* UAR mmap offset for non-primary process. */
- void *bf_reg; /* BlueFlame register from Verbs. */
- uint16_t dump_file_n; /* Number of dump files. */
- struct rte_eth_hairpin_conf hairpin_conf; /* Hairpin configuration. */
- uint32_t hairpin_status; /* Hairpin binding status. */
- struct mlx5_txq_data txq; /* Data path structure. */
- /* Must be the last field in the structure, contains elts[]. */
-};
-
-#define MLX5_TX_BFREG(txq) \
- (MLX5_PROC_PRIV((txq)->port_id)->uar_table[(txq)->idx])
-
-/* mlx5_txq.c */
-
-int mlx5_tx_queue_start(struct rte_eth_dev *dev, uint16_t queue_id);
-int mlx5_tx_queue_stop(struct rte_eth_dev *dev, uint16_t queue_id);
-int mlx5_tx_queue_start_primary(struct rte_eth_dev *dev, uint16_t queue_id);
-int mlx5_tx_queue_stop_primary(struct rte_eth_dev *dev, uint16_t queue_id);
-int mlx5_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
- unsigned int socket, const struct rte_eth_txconf *conf);
-int mlx5_tx_hairpin_queue_setup
- (struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
- const struct rte_eth_hairpin_conf *hairpin_conf);
-void mlx5_tx_queue_release(void *dpdk_txq);
-void txq_uar_init(struct mlx5_txq_ctrl *txq_ctrl);
-int mlx5_tx_uar_init_secondary(struct rte_eth_dev *dev, int fd);
-void mlx5_tx_uar_uninit_secondary(struct rte_eth_dev *dev);
-int mlx5_txq_obj_verify(struct rte_eth_dev *dev);
-struct mlx5_txq_ctrl *mlx5_txq_new(struct rte_eth_dev *dev, uint16_t idx,
- uint16_t desc, unsigned int socket,
- const struct rte_eth_txconf *conf);
-struct mlx5_txq_ctrl *mlx5_txq_hairpin_new
- (struct rte_eth_dev *dev, uint16_t idx, uint16_t desc,
- const struct rte_eth_hairpin_conf *hairpin_conf);
-struct mlx5_txq_ctrl *mlx5_txq_get(struct rte_eth_dev *dev, uint16_t idx);
-int mlx5_txq_release(struct rte_eth_dev *dev, uint16_t idx);
-int mlx5_txq_releasable(struct rte_eth_dev *dev, uint16_t idx);
-int mlx5_txq_verify(struct rte_eth_dev *dev);
-void txq_alloc_elts(struct mlx5_txq_ctrl *txq_ctrl);
-void txq_free_elts(struct mlx5_txq_ctrl *txq_ctrl);
-uint64_t mlx5_get_tx_port_offloads(struct rte_eth_dev *dev);
-void mlx5_txq_dynf_timestamp_set(struct rte_eth_dev *dev);
-