1 /* SPDX-License-Identifier: BSD-3-Clause 2 * Copyright(c) 2014-2023 Broadcom 3 * All rights reserved. 4 */ 5 6 #ifndef _BNXT_RQX_H_ 7 #define _BNXT_RQX_H_ 8 9 /* Maximum receive burst supported in vector mode. */ 10 #define RTE_BNXT_MAX_RX_BURST 64U 11 12 /* Drop by default when receive desc is not available. */ 13 #define BNXT_DEFAULT_RX_DROP_EN 1 14 15 #define BNXT_MEM_POOL_IDX_0 0 16 #define BNXT_MEM_POOL_IDX_1 1 17 18 struct bnxt; 19 struct bnxt_rx_ring_info; 20 struct bnxt_cp_ring_info; 21 struct bnxt_rx_queue { 22 struct rte_mempool *mb_pool; /* mbuf pool for RX ring */ 23 struct rte_mempool *agg_mb_pool; /* mbuf pool for AGG ring */ 24 uint64_t mbuf_initializer; /* val to init mbuf */ 25 uint16_t nb_rx_desc; /* num of RX desc */ 26 uint16_t rx_free_thresh; /* max free RX desc to hold */ 27 uint16_t queue_id; /* RX queue index */ 28 #if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64) 29 uint16_t rxrearm_nb; /* number of descs to reinit. */ 30 uint16_t rxrearm_start; /* next desc index to reinit. */ 31 #endif 32 uint16_t port_id; /* Device port identifier */ 33 uint8_t crc_len; /* 0 if CRC stripped, 4 otherwise */ 34 uint8_t rx_deferred_start; /* not in global dev start */ 35 uint8_t rx_started; /* RX queue is started */ 36 uint8_t drop_en; /* Drop when rx desc not available. */ 37 uint8_t in_reset; /* Rx ring is scheduled for reset */ 38 39 struct bnxt *bp; 40 int index; 41 struct bnxt_vnic_info *vnic; 42 43 uint32_t rx_buf_size; 44 struct bnxt_rx_ring_info *rx_ring; 45 struct bnxt_cp_ring_info *cp_ring; 46 struct rte_mbuf fake_mbuf; 47 RTE_ATOMIC(uint64_t) rx_mbuf_alloc_fail; 48 uint8_t need_realloc; 49 const struct rte_memzone *mz; 50 }; 51 52 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq); 53 int bnxt_mq_rx_configure(struct bnxt *bp); 54 void bnxt_rx_queue_release_op(struct rte_eth_dev *dev, uint16_t queue_idx); 55 int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev, 56 uint16_t queue_idx, 57 uint16_t nb_desc, 58 unsigned int socket_id, 59 const struct rte_eth_rxconf *rx_conf, 60 struct rte_mempool *mp); 61 void bnxt_free_rx_mbufs(struct bnxt *bp); 62 int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev, 63 uint16_t queue_id); 64 int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev, 65 uint16_t queue_id); 66 int bnxt_rx_queue_start(struct rte_eth_dev *dev, 67 uint16_t rx_queue_id); 68 int bnxt_rx_queue_stop(struct rte_eth_dev *dev, 69 uint16_t rx_queue_id); 70 void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq); 71 int bnxt_need_agg_ring(struct rte_eth_dev *eth_dev); 72 void bnxt_free_rxq_mem(struct bnxt_rx_queue *rxq); 73 uint64_t bnxt_get_rx_port_offloads(struct bnxt *bp); 74 #endif 75