Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause 2 : : * Copyright(c) 2014-2023 Broadcom 3 : : * All rights reserved. 4 : : */ 5 : : 6 : : #ifndef _BNXT_TXR_H_ 7 : : #define _BNXT_TXR_H_ 8 : : 9 : : #include <rte_io.h> 10 : : 11 : : #define BNXT_MAX_TSO_SEGS 32 12 : : #define BNXT_MIN_PKT_SIZE 52 13 : : 14 : : /* Number of transmit descriptors processed per inner loop in vector mode. */ 15 : : #define BNXT_TX_DESCS_PER_LOOP 4U 16 : : 17 : : struct bnxt_tx_ring_info { 18 : : uint16_t tx_raw_prod; 19 : : uint16_t tx_raw_cons; 20 : : struct bnxt_db_info tx_db; 21 : : 22 : : struct tx_bd_long *tx_desc_ring; 23 : : struct rte_mbuf **tx_buf_ring; 24 : : 25 : : rte_iova_t tx_desc_mapping; 26 : : 27 : : unsigned short *nr_bds; 28 : : struct bnxt_ring *tx_ring_struct; 29 : : }; 30 : : 31 : : static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq) 32 : : { 33 : 0 : return ((txq->tx_ring->tx_raw_prod - txq->tx_ring->tx_raw_cons) & 34 [ # # ]: 0 : txq->tx_ring->tx_ring_struct->ring_mask); 35 : : } 36 : : 37 : : static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq) 38 : : { 39 : : /* Tell compiler to fetch tx indices from memory. */ 40 : 0 : rte_compiler_barrier(); 41 : : 42 : 0 : return ((txq->tx_ring->tx_ring_struct->ring_size - 43 [ # # ]: 0 : bnxt_tx_bds_in_hw(txq)) - 1); 44 : : } 45 : : 46 : : void bnxt_free_tx_rings(struct bnxt *bp); 47 : : int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq); 48 : : int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id); 49 : : uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 50 : : uint16_t nb_pkts); 51 : : uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 52 : : uint16_t nb_pkts); 53 : : #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64) 54 : : uint16_t bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, 55 : : uint16_t nb_pkts); 56 : : #endif 57 : : #if defined(RTE_ARCH_X86) 58 : : uint16_t bnxt_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, 59 : : uint16_t nb_pkts); 60 : : #endif 61 : : 62 : : int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); 63 : : int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); 64 : : int bnxt_flush_tx_cmp(struct bnxt_cp_ring_info *cpr); 65 : : 66 : : #define PKT_TX_OIP_IIP_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | \ 67 : : RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_OUTER_IP_CKSUM) 68 : : #define PKT_TX_OIP_IIP_UDP_CKSUM (RTE_MBUF_F_TX_UDP_CKSUM | \ 69 : : RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_OUTER_IP_CKSUM) 70 : : #define PKT_TX_OIP_IIP_TCP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | \ 71 : : RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_OUTER_IP_CKSUM) 72 : : #define PKT_TX_IIP_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | \ 73 : : RTE_MBUF_F_TX_IP_CKSUM) 74 : : #define PKT_TX_IIP_TCP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM) 75 : : #define PKT_TX_IIP_UDP_CKSUM (RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM) 76 : : #define PKT_TX_OIP_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | \ 77 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 78 : : #define PKT_TX_OIP_UDP_CKSUM (RTE_MBUF_F_TX_UDP_CKSUM | \ 79 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 80 : : #define PKT_TX_OIP_TCP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | \ 81 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 82 : : #define PKT_TX_OIP_IIP_CKSUM (RTE_MBUF_F_TX_IP_CKSUM | \ 83 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 84 : : #define PKT_TX_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM) 85 : : 86 : : 87 : : #define TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \ 88 : : TX_BD_LONG_LFLAGS_T_IP_CHKSUM | \ 89 : : TX_BD_LONG_LFLAGS_IP_CHKSUM) 90 : : #define TX_BD_FLG_IP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \ 91 : : TX_BD_LONG_LFLAGS_IP_CHKSUM) 92 : : #define TX_BD_FLG_TIP_IP_CHKSUM (TX_BD_LONG_LFLAGS_T_IP_CHKSUM | \ 93 : : TX_BD_LONG_LFLAGS_IP_CHKSUM) 94 : : #define TX_BD_FLG_TIP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \ 95 : : TX_BD_LONG_LFLAGS_T_IP_CHKSUM) 96 : : #endif