xref: /dpdk/drivers/net/bnxt/bnxt_txq.h (revision 6cc5dfa69a0335849fc0903d3ada943acb33c7ce)
1fd710bb1SScott Branden /* SPDX-License-Identifier: BSD-3-Clause
2e6e8f03eSRandy Schacher  * Copyright(c) 2014-2023 Broadcom
351c87ebaSAjit Khaparde  * All rights reserved.
451c87ebaSAjit Khaparde  */
551c87ebaSAjit Khaparde 
651c87ebaSAjit Khaparde #ifndef _BNXT_TXQ_H_
751c87ebaSAjit Khaparde #define _BNXT_TXQ_H_
851c87ebaSAjit Khaparde 
9cec43bbfSLance Richardson /* Maximum transmit burst for vector mode.  */
10aade665aSLance Richardson #define RTE_BNXT_MAX_TX_BURST		64U
11cec43bbfSLance Richardson 
1251c87ebaSAjit Khaparde struct bnxt_tx_ring_info;
1351c87ebaSAjit Khaparde struct bnxt_cp_ring_info;
1451c87ebaSAjit Khaparde struct bnxt_tx_queue {
1551c87ebaSAjit Khaparde 	uint16_t		nb_tx_desc;    /* number of TX descriptors */
1651c87ebaSAjit Khaparde 	uint16_t		tx_free_thresh;/* minimum TX before freeing */
1751c87ebaSAjit Khaparde 	uint16_t		queue_id; /* TX queue index */
18f8244c63SZhiyong Yang 	uint16_t		port_id; /* Device port identifier */
1951c87ebaSAjit Khaparde 	uint8_t			pthresh; /* Prefetch threshold register */
2051c87ebaSAjit Khaparde 	uint8_t			hthresh; /* Host threshold register */
2151c87ebaSAjit Khaparde 	uint8_t			wthresh; /* Write-back threshold reg */
2251c87ebaSAjit Khaparde 	uint8_t			tx_deferred_start; /* not in global dev start */
232171e66fSKalesh AP 	uint8_t			tx_started; /* TX queue is started */
2451c87ebaSAjit Khaparde 
2551c87ebaSAjit Khaparde 	struct bnxt		*bp;
2651c87ebaSAjit Khaparde 	int			index;
2751c87ebaSAjit Khaparde 	int			tx_wake_thresh;
281e18ec58SSomnath Kotur 	uint32_t		vfr_tx_cfa_action;
29d46406c7SAjit Khaparde 	pthread_mutex_t		txq_lock;
3051c87ebaSAjit Khaparde 	struct bnxt_tx_ring_info	*tx_ring;
3151c87ebaSAjit Khaparde 
3251c87ebaSAjit Khaparde 	unsigned int		cp_nr_rings;
3351c87ebaSAjit Khaparde 	struct bnxt_cp_ring_info	*cp_ring;
3423460b4cSAjit Khaparde 	const struct rte_memzone *mz;
355ef3592cSAjit Khaparde 	struct rte_mbuf **free;
36369f6077SLance Richardson 	uint64_t offloads;
37*6cc5dfa6SAjit Khaparde 	RTE_ATOMIC(uint64_t)	tx_mbuf_drop;
3851c87ebaSAjit Khaparde };
3951c87ebaSAjit Khaparde 
4051c87ebaSAjit Khaparde void bnxt_free_txq_stats(struct bnxt_tx_queue *txq);
4151c87ebaSAjit Khaparde void bnxt_free_tx_mbufs(struct bnxt *bp);
427483341aSXueming Li void bnxt_tx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx);
4351c87ebaSAjit Khaparde int bnxt_tx_queue_setup_op(struct rte_eth_dev *eth_dev,
4451c87ebaSAjit Khaparde 			       uint16_t queue_idx,
4551c87ebaSAjit Khaparde 			       uint16_t nb_desc,
4651c87ebaSAjit Khaparde 			       unsigned int socket_id,
4751c87ebaSAjit Khaparde 			       const struct rte_eth_txconf *tx_conf);
4847a956a8SKalesh AP uint64_t bnxt_get_tx_port_offloads(struct bnxt *bp);
4951c87ebaSAjit Khaparde #endif
50