New upstream version 18.08
[deb_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         rte_spinlock_t          lock;   /* Synchronize between rx_queue_stop
14                                          * and fast path
15                                          */
16         struct rte_mempool      *mb_pool; /* mbuf pool for RX ring */
17         struct rte_mbuf         *pkt_first_seg; /* 1st seg of pkt */
18         struct rte_mbuf         *pkt_last_seg; /* Last seg of pkt */
19         uint64_t                mbuf_initializer; /* val to init mbuf */
20         uint16_t                nb_rx_desc; /* num of RX desc */
21         uint16_t                rx_tail; /* cur val of RDT register */
22         uint16_t                nb_rx_hold; /* num held free RX desc */
23         uint16_t                rx_free_thresh; /* max free RX desc to hold */
24         uint16_t                queue_id; /* RX queue index */
25         uint16_t                reg_idx; /* RX queue register index */
26         uint16_t                port_id; /* Device port identifier */
27         uint8_t                 crc_len; /* 0 if CRC stripped, 4 otherwise */
28         uint8_t                 rx_deferred_start; /* not in global dev start */
29
30         struct bnxt             *bp;
31         int                     index;
32         struct bnxt_vnic_info   *vnic;
33
34         uint32_t                        rx_buf_size;
35         uint32_t                        rx_buf_use_size;  /* useable size */
36         struct bnxt_rx_ring_info        *rx_ring;
37         struct bnxt_cp_ring_info        *cp_ring;
38         rte_atomic64_t          rx_mbuf_alloc_fail;
39         const struct rte_memzone *mz;
40 };
41
42 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq);
43 int bnxt_mq_rx_configure(struct bnxt *bp);
44 void bnxt_rx_queue_release_op(void *rx_queue);
45 int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
46                                uint16_t queue_idx,
47                                uint16_t nb_desc,
48                                unsigned int socket_id,
49                                const struct rte_eth_rxconf *rx_conf,
50                                struct rte_mempool *mp);
51 void bnxt_free_rx_mbufs(struct bnxt *bp);
52 int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
53                                  uint16_t queue_id);
54 int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev,
55                                   uint16_t queue_id);
56 int bnxt_rx_queue_start(struct rte_eth_dev *dev,
57                         uint16_t rx_queue_id);
58 int bnxt_rx_queue_stop(struct rte_eth_dev *dev,
59                        uint16_t rx_queue_id);
60 void bnxt_rx_queue_release_mbufs(struct bnxt_rx_queue *rxq);
61 #endif