2018-04-02 22:34:32 +00:00
|
|
|
/* SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
* Copyright(c) 2014-2018 Broadcom
|
|
|
|
* All rights reserved.
|
2016-06-15 21:23:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BNXT_TXR_H_
|
|
|
|
#define _BNXT_TXR_H_
|
|
|
|
|
2017-01-18 01:21:29 +00:00
|
|
|
#include <rte_io.h>
|
|
|
|
|
2016-06-15 21:23:13 +00:00
|
|
|
#define MAX_TX_RINGS 16
|
|
|
|
#define BNXT_TX_PUSH_THRESH 92
|
2019-05-15 18:08:14 +00:00
|
|
|
#define BNXT_MAX_TSO_SEGS 32
|
|
|
|
#define BNXT_MIN_PKT_SIZE 52
|
2016-06-15 21:23:13 +00:00
|
|
|
|
2017-01-18 01:21:29 +00:00
|
|
|
#define B_TX_DB(db, prod) rte_write32((DB_KEY_TX | (prod)), db)
|
2016-06-15 21:23:13 +00:00
|
|
|
|
|
|
|
struct bnxt_tx_ring_info {
|
|
|
|
uint16_t tx_prod;
|
|
|
|
uint16_t tx_cons;
|
2019-06-02 17:42:42 +00:00
|
|
|
struct bnxt_db_info tx_db;
|
2016-06-15 21:23:13 +00:00
|
|
|
|
|
|
|
struct tx_bd_long *tx_desc_ring;
|
|
|
|
struct bnxt_sw_tx_bd *tx_buf_ring;
|
|
|
|
|
2017-10-20 12:31:31 +00:00
|
|
|
rte_iova_t tx_desc_mapping;
|
2016-06-15 21:23:13 +00:00
|
|
|
|
|
|
|
#define BNXT_DEV_STATE_CLOSING 0x1
|
|
|
|
uint32_t dev_state;
|
|
|
|
|
|
|
|
struct bnxt_ring *tx_ring_struct;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct bnxt_sw_tx_bd {
|
|
|
|
struct rte_mbuf *mbuf; /* mbuf associated with TX descriptor */
|
|
|
|
uint8_t is_gso;
|
|
|
|
unsigned short nr_bds;
|
|
|
|
};
|
|
|
|
|
2019-05-29 21:02:21 +00:00
|
|
|
static inline uint32_t bnxt_tx_bds_in_hw(struct bnxt_tx_queue *txq)
|
|
|
|
{
|
|
|
|
return ((txq->tx_ring->tx_prod - txq->tx_ring->tx_cons) &
|
|
|
|
txq->tx_ring->tx_ring_struct->ring_mask);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t bnxt_tx_avail(struct bnxt_tx_queue *txq)
|
|
|
|
{
|
|
|
|
/* Tell compiler to fetch tx indices from memory. */
|
|
|
|
rte_compiler_barrier();
|
|
|
|
|
|
|
|
return ((txq->tx_ring->tx_ring_struct->ring_size -
|
|
|
|
bnxt_tx_bds_in_hw(txq)) - 1);
|
|
|
|
}
|
|
|
|
|
2016-06-15 21:23:13 +00:00
|
|
|
void bnxt_free_tx_rings(struct bnxt *bp);
|
|
|
|
int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq);
|
2016-06-15 21:23:15 +00:00
|
|
|
int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id);
|
2016-06-15 21:23:13 +00:00
|
|
|
uint16_t bnxt_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
|
|
|
|
uint16_t nb_pkts);
|
2019-10-02 01:23:22 +00:00
|
|
|
uint16_t bnxt_dummy_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
|
|
|
|
uint16_t nb_pkts);
|
2020-07-07 22:22:25 +00:00
|
|
|
#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
|
2019-05-29 21:02:23 +00:00
|
|
|
uint16_t bnxt_xmit_pkts_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
|
|
|
|
uint16_t nb_pkts);
|
|
|
|
#endif
|
|
|
|
|
2018-01-26 17:31:58 +00:00
|
|
|
int bnxt_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id);
|
|
|
|
int bnxt_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id);
|
2016-06-15 21:23:13 +00:00
|
|
|
|
2017-09-28 21:43:30 +00:00
|
|
|
#define PKT_TX_OIP_IIP_TCP_UDP_CKSUM (PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
|
|
|
|
PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
|
2018-06-28 20:15:33 +00:00
|
|
|
#define PKT_TX_OIP_IIP_UDP_CKSUM (PKT_TX_UDP_CKSUM | \
|
|
|
|
PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
|
|
|
|
#define PKT_TX_OIP_IIP_TCP_CKSUM (PKT_TX_TCP_CKSUM | \
|
|
|
|
PKT_TX_IP_CKSUM | PKT_TX_OUTER_IP_CKSUM)
|
2017-09-28 21:43:30 +00:00
|
|
|
#define PKT_TX_IIP_TCP_UDP_CKSUM (PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
|
|
|
|
PKT_TX_IP_CKSUM)
|
2018-06-28 20:15:33 +00:00
|
|
|
#define PKT_TX_IIP_TCP_CKSUM (PKT_TX_TCP_CKSUM | PKT_TX_IP_CKSUM)
|
|
|
|
#define PKT_TX_IIP_UDP_CKSUM (PKT_TX_UDP_CKSUM | PKT_TX_IP_CKSUM)
|
2017-09-28 21:43:30 +00:00
|
|
|
#define PKT_TX_OIP_TCP_UDP_CKSUM (PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM | \
|
|
|
|
PKT_TX_OUTER_IP_CKSUM)
|
2018-06-28 20:15:33 +00:00
|
|
|
#define PKT_TX_OIP_UDP_CKSUM (PKT_TX_UDP_CKSUM | \
|
|
|
|
PKT_TX_OUTER_IP_CKSUM)
|
|
|
|
#define PKT_TX_OIP_TCP_CKSUM (PKT_TX_TCP_CKSUM | \
|
|
|
|
PKT_TX_OUTER_IP_CKSUM)
|
2017-09-28 21:43:30 +00:00
|
|
|
#define PKT_TX_OIP_IIP_CKSUM (PKT_TX_IP_CKSUM | \
|
|
|
|
PKT_TX_OUTER_IP_CKSUM)
|
|
|
|
#define PKT_TX_TCP_UDP_CKSUM (PKT_TX_TCP_CKSUM | PKT_TX_UDP_CKSUM)
|
|
|
|
|
|
|
|
|
|
|
|
#define TX_BD_FLG_TIP_IP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \
|
|
|
|
TX_BD_LONG_LFLAGS_T_IP_CHKSUM | \
|
|
|
|
TX_BD_LONG_LFLAGS_IP_CHKSUM)
|
|
|
|
#define TX_BD_FLG_IP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \
|
|
|
|
TX_BD_LONG_LFLAGS_IP_CHKSUM)
|
|
|
|
#define TX_BD_FLG_TIP_IP_CHKSUM (TX_BD_LONG_LFLAGS_T_IP_CHKSUM | \
|
|
|
|
TX_BD_LONG_LFLAGS_IP_CHKSUM)
|
|
|
|
#define TX_BD_FLG_TIP_TCP_UDP_CHKSUM (TX_BD_LONG_LFLAGS_TCP_UDP_CHKSUM | \
|
|
|
|
TX_BD_LONG_LFLAGS_T_IP_CHKSUM)
|
|
|
|
|
2016-06-15 21:23:13 +00:00
|
|
|
#endif
|