net/bnxt: maintain mbuf alloc failure counter per queue
[dpdk.git] / drivers / net / bnxt / bnxt_rxq.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2014-2018 Broadcom
3  * All rights reserved.
4  */
5
6 #ifndef _BNXT_RQX_H_
7 #define _BNXT_RQX_H_
8
9 struct bnxt;
10 struct bnxt_rx_ring_info;
11 struct bnxt_cp_ring_info;
12 struct bnxt_rx_queue {
13         struct rte_mempool      *mb_pool; /* mbuf pool for RX ring */
14         struct rte_mbuf         *pkt_first_seg; /* 1st seg of pkt */
15         struct rte_mbuf         *pkt_last_seg; /* Last seg of pkt */
16         uint64_t                mbuf_initializer; /* val to init mbuf */
17         uint16_t                nb_rx_desc; /* num of RX desc */
18         uint16_t                rx_tail; /* cur val of RDT register */
19         uint16_t                nb_rx_hold; /* num held free RX desc */
20         uint16_t                rx_free_thresh; /* max free RX desc to hold */
21         uint16_t                queue_id; /* RX queue index */
22         uint16_t                reg_idx; /* RX queue register index */
23         uint16_t                port_id; /* Device port identifier */
24         uint8_t                 crc_len; /* 0 if CRC stripped, 4 otherwise */
25         uint8_t                 rx_deferred_start; /* not in global dev start */
26
27         struct bnxt             *bp;
28         int                     index;
29         struct bnxt_vnic_info   *vnic;
30
31         uint32_t                        rx_buf_size;
32         uint32_t                        rx_buf_use_size;  /* useable size */
33         struct bnxt_rx_ring_info        *rx_ring;
34         struct bnxt_cp_ring_info        *cp_ring;
35         rte_atomic64_t          rx_mbuf_alloc_fail;
36 };
37
38 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq);
39 int bnxt_mq_rx_configure(struct bnxt *bp);
40 void bnxt_rx_queue_release_op(void *rx_queue);
41 int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
42                                uint16_t queue_idx,
43                                uint16_t nb_desc,
44                                unsigned int socket_id,
45                                const struct rte_eth_rxconf *rx_conf,
46                                struct rte_mempool *mp);
47 void bnxt_free_rx_mbufs(struct bnxt *bp);
48 int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
49                                  uint16_t queue_id);
50 int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev,
51                                   uint16_t queue_id);
52 int bnxt_rx_queue_start(struct rte_eth_dev *dev,
53                         uint16_t rx_queue_id);
54 int bnxt_rx_queue_stop(struct rte_eth_dev *dev,
55                        uint16_t rx_queue_id);
56 #endif