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 (RTE_MBUF_F_TX_IP_CKSUM | \
17 RTE_MBUF_F_TX_TCP_CKSUM | \
18 RTE_MBUF_F_TX_UDP_CKSUM | \
19 RTE_MBUF_F_TX_SCTP_CKSUM | \
20 RTE_MBUF_F_TX_OUTER_IP_CKSUM | \
21 RTE_MBUF_F_TX_TCP_SEG)
28 struct hinic_tx_offload_info {
48 struct hinic_wqe_info {
57 struct hinic_sq_ctrl {
62 struct hinic_sq_task {
71 struct hinic_sq_bufdesc {
77 /* sq wqe control section */
78 struct hinic_sq_ctrl ctrl;
80 /* sq task control section */
81 struct hinic_sq_task task;
83 /* sq sge section start address, 1~127 sges */
84 struct hinic_sq_bufdesc buf_descs[0];
87 struct hinic_txq_stats {
99 struct hinic_tx_info {
100 struct rte_mbuf *mbuf;
102 struct rte_mbuf *cpy_mbuf;
107 struct hinic_nic_dev *nic_dev;
110 volatile u16 *cons_idx_addr;
111 struct hinic_tx_info *tx_info;
121 struct hinic_txq_stats txq_stats;
126 int hinic_setup_tx_resources(struct hinic_txq *txq);
128 void hinic_free_all_tx_resources(struct rte_eth_dev *eth_dev);
130 void hinic_free_all_tx_mbuf(struct rte_eth_dev *eth_dev);
132 void hinic_free_tx_resources(struct hinic_txq *txq);
134 u16 hinic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts);
136 void hinic_free_all_tx_mbufs(struct hinic_txq *txq);
138 void hinic_txq_get_stats(struct hinic_txq *txq, struct hinic_txq_stats *stats);
140 void hinic_txq_stats_reset(struct hinic_txq *txq);
142 int hinic_create_sq(struct hinic_hwdev *hwdev, u16 q_id,
143 u16 sq_depth, unsigned int socket_id);
145 void hinic_destroy_sq(struct hinic_hwdev *hwdev, u16 q_id);
147 #endif /* _HINIC_PMD_TX_H_ */