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 : : uint8_t dpi; /* Doorbell page index for multi-doorbell support */ 30 : : }; 31 : : 32 : : static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq) 33 : : { 34 : 0 : return ((txq->tx_ring->tx_raw_prod - txq->tx_ring->tx_raw_cons) & 35 [ # # ]: 0 : txq->tx_ring->tx_ring_struct->ring_mask); 36 : : } 37 : : 38 : : static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq) 39 : : { 40 : : /* Tell compiler to fetch tx indices from memory. */ 41 : 0 : rte_compiler_barrier(); 42 : : 43 : 0 : return ((txq->tx_ring->tx_ring_struct->ring_size - 44 [ # # ]: 0 : bnxt_tx_bds_in_hw(txq)) - 1); 45 : : } 46 : : 47 : : void bnxt_free_tx_rings(struct bnxt *bp); 48 : : int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq); 49 : : int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id); 50 : : uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 51 : : uint16_t nb_pkts); 52 : : uint16_t _bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, 53 : : uint16_t nb_pkts); 54 : : #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64) 55 : : uint16_t bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts, 56 : : uint16_t nb_pkts); 57 : : #endif 58 : : #if defined(RTE_ARCH_X86) 59 : : uint16_t bnxt_xmit_pkts_vec_avx2(void *tx_queue, struct rte_mbuf **tx_pkts, 60 : : uint16_t nb_pkts); 61 : : #endif 62 : : 63 : : int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); 64 : : int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); 65 : : int bnxt_flush_tx_cmp(struct bnxt_cp_ring_info *cpr); 66 : : 67 : : #define PKT_TX_OIP_IIP_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | \ 68 : : RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_OUTER_IP_CKSUM) 69 : : #define PKT_TX_OIP_IIP_UDP_CKSUM (RTE_MBUF_F_TX_UDP_CKSUM | \ 70 : : RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_OUTER_IP_CKSUM) 71 : : #define PKT_TX_OIP_IIP_TCP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | \ 72 : : RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_OUTER_IP_CKSUM) 73 : : #define PKT_TX_IIP_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | \ 74 : : RTE_MBUF_F_TX_IP_CKSUM) 75 : : #define PKT_TX_IIP_TCP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM) 76 : : #define PKT_TX_IIP_UDP_CKSUM (RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM) 77 : : #define PKT_TX_OIP_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | \ 78 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 79 : : #define PKT_TX_OIP_UDP_CKSUM (RTE_MBUF_F_TX_UDP_CKSUM | \ 80 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 81 : : #define PKT_TX_OIP_TCP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | \ 82 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 83 : : #define PKT_TX_OIP_IIP_CKSUM (RTE_MBUF_F_TX_IP_CKSUM | \ 84 : : RTE_MBUF_F_TX_OUTER_IP_CKSUM) 85 : : #define PKT_TX_TCP_UDP_CKSUM (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM) 86 : : 87 : : 88 : : #define TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \ 89 : : TX_BD_LONG_LFLAGS_T_IP_CHKSUM | \ 90 : : TX_BD_LONG_LFLAGS_IP_CHKSUM) 91 : : #define TX_BD_FLG_IP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \ 92 : : TX_BD_LONG_LFLAGS_IP_CHKSUM) 93 : : #define TX_BD_FLG_TIP_IP_CHKSUM (TX_BD_LONG_LFLAGS_T_IP_CHKSUM | \ 94 : : TX_BD_LONG_LFLAGS_IP_CHKSUM) 95 : : #define TX_BD_FLG_TIP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \ 96 : : TX_BD_LONG_LFLAGS_T_IP_CHKSUM) 97 : : #endif