1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2017 Huawei Technologies Co., Ltd
5 #ifndef _HINIC_PMD_TX_H_
6 #define _HINIC_PMD_TX_H_
8 #define HINIC_DEFAULT_TX_FREE_THRESH 32
9 #define HINIC_MAX_TX_FREE_BULK 64
11 #define HINIC_GET_WQ_HEAD(txq) ((txq)->wq->queue_buf_vaddr)
13 #define HINIC_GET_WQ_TAIL(txq) \
14 ((txq)->wq->queue_buf_vaddr + (txq)->wq->wq_buf_size)
16 #define HINIC_TX_CKSUM_OFFLOAD_MASK ( \
21 PKT_TX_OUTER_IP_CKSUM | \
29 struct hinic_tx_offload_info {
49 struct hinic_wqe_info {
58 struct hinic_sq_ctrl {
63 struct hinic_sq_task {
72 struct hinic_sq_bufdesc {
78 /* sq wqe control section */
79 struct hinic_sq_ctrl ctrl;
81 /* sq task control section */
82 struct hinic_sq_task task;
84 /* sq sge section start address, 1~127 sges */
85 struct hinic_sq_bufdesc buf_descs[0];
88 struct hinic_txq_stats {
98 struct hinic_tx_info {
99 struct rte_mbuf *mbuf;
101 struct rte_mbuf *cpy_mbuf;
106 struct hinic_nic_dev *nic_dev;
109 volatile u16 *cons_idx_addr;
110 struct hinic_tx_info *tx_info;
119 struct hinic_txq_stats txq_stats;
124 int hinic_setup_tx_resources(struct hinic_txq *txq);
126 void hinic_free_all_tx_resources(struct rte_eth_dev *eth_dev);
128 void hinic_free_all_tx_mbuf(struct rte_eth_dev *eth_dev);
130 void hinic_free_tx_resources(struct hinic_txq *txq);
132 u16 hinic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts);
134 void hinic_free_all_tx_mbufs(struct hinic_txq *txq);
136 void hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats);
138 void hinic_txq_stats_reset(struct hinic_txq *txq);
140 int hinic_create_sq(struct hinic_hwdev *hwdev, u16 q_id, u16 sq_depth);
142 void hinic_destroy_sq(struct hinic_hwdev *hwdev, u16 q_id);
144 #endif /* _HINIC_PMD_TX_H_ */