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 {
100 struct hinic_tx_info {
101 struct rte_mbuf *mbuf;
103 struct rte_mbuf *cpy_mbuf;
108 struct hinic_nic_dev *nic_dev;
111 volatile u16 *cons_idx_addr;
112 struct hinic_tx_info *tx_info;
122 struct hinic_txq_stats txq_stats;
127 int hinic_setup_tx_resources(struct hinic_txq *txq);
129 void hinic_free_all_tx_resources(struct rte_eth_dev *eth_dev);
131 void hinic_free_all_tx_mbuf(struct rte_eth_dev *eth_dev);
133 void hinic_free_tx_resources(struct hinic_txq *txq);
135 u16 hinic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts);
137 void hinic_free_all_tx_mbufs(struct hinic_txq *txq);
139 void hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats);
141 void hinic_txq_stats_reset(struct hinic_txq *txq);
143 int hinic_create_sq(struct hinic_hwdev *hwdev, u16 q_id,
144 u16 sq_depth, unsigned int socket_id);
146 void hinic_destroy_sq(struct hinic_hwdev *hwdev, u16 q_id);
148 #endif /* _HINIC_PMD_TX_H_ */