From: Lance Richardson Date: Wed, 29 May 2019 21:02:21 +0000 (-0400) Subject: net/bnxt: move Tx bd checking to header file X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=355b482e127a82bed9969420bd6df56fff161e29;p=dpdk.git net/bnxt: move Tx bd checking to header file To allow sharing of tx_bds_in_hw() and bnxt_tx_avail() between vector-mode and non-vector transmit functions, move these functions into bnxt_txr.h. Signed-off-by: Lance Richardson Reviewed-by: Ajit Khaparde Reviewed-by: Maxime Coquelin --- diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index 9de12e0d0f..16598ba637 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -103,21 +103,6 @@ int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id) return 0; } -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); -} - static uint16_t bnxt_start_xmit(struct rte_mbuf *tx_pkt, struct bnxt_tx_queue *txq, uint16_t *coal_pkts, diff --git a/drivers/net/bnxt/bnxt_txr.h b/drivers/net/bnxt/bnxt_txr.h index f802d5080d..13ca046763 100644 --- a/drivers/net/bnxt/bnxt_txr.h +++ b/drivers/net/bnxt/bnxt_txr.h @@ -37,6 +37,21 @@ struct bnxt_sw_tx_bd { unsigned short nr_bds; }; +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); +} + void bnxt_free_tx_rings(struct bnxt *bp); int bnxt_init_one_tx_ring(struct bnxt_tx_queue *txq); int bnxt_init_tx_ring_struct(struct bnxt_tx_queue *txq, unsigned int socket_id);