New upstream version 18.02
[deb_dpdk.git] / drivers / net / bnxt / bnxt_rxq.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) Broadcom Limited.
5  *   All rights reserved.
6  *
7  *   Redistribution and use in source and binary forms, with or without
8  *   modification, are permitted provided that the following conditions
9  *   are met:
10  *
11  *     * Redistributions of source code must retain the above copyright
12  *       notice, this list of conditions and the following disclaimer.
13  *     * Redistributions in binary form must reproduce the above copyright
14  *       notice, this list of conditions and the following disclaimer in
15  *       the documentation and/or other materials provided with the
16  *       distribution.
17  *     * Neither the name of Broadcom Corporation nor the names of its
18  *       contributors may be used to endorse or promote products derived
19  *       from this software without specific prior written permission.
20  *
21  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _BNXT_RQX_H_
35 #define _BNXT_RQX_H_
36
37 struct bnxt;
38 struct bnxt_rx_ring_info;
39 struct bnxt_cp_ring_info;
40 struct bnxt_rx_queue {
41         struct rte_mempool      *mb_pool; /* mbuf pool for RX ring */
42         struct rte_mbuf         *pkt_first_seg; /* 1st seg of pkt */
43         struct rte_mbuf         *pkt_last_seg; /* Last seg of pkt */
44         uint64_t                mbuf_initializer; /* val to init mbuf */
45         uint16_t                nb_rx_desc; /* num of RX desc */
46         uint16_t                rx_tail; /* cur val of RDT register */
47         uint16_t                nb_rx_hold; /* num held free RX desc */
48         uint16_t                rx_free_thresh; /* max free RX desc to hold */
49         uint16_t                queue_id; /* RX queue index */
50         uint16_t                reg_idx; /* RX queue register index */
51         uint16_t                port_id; /* Device port identifier */
52         uint8_t                 crc_len; /* 0 if CRC stripped, 4 otherwise */
53         uint8_t                 rx_deferred_start; /* not in global dev start */
54
55         struct bnxt             *bp;
56         int                     index;
57         struct bnxt_vnic_info   *vnic;
58
59         uint32_t                        rx_buf_size;
60         uint32_t                        rx_buf_use_size;  /* useable size */
61         struct bnxt_rx_ring_info        *rx_ring;
62         struct bnxt_cp_ring_info        *cp_ring;
63 };
64
65 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq);
66 int bnxt_mq_rx_configure(struct bnxt *bp);
67 void bnxt_rx_queue_release_op(void *rx_queue);
68 int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
69                                uint16_t queue_idx,
70                                uint16_t nb_desc,
71                                unsigned int socket_id,
72                                const struct rte_eth_rxconf *rx_conf,
73                                struct rte_mempool *mp);
74 void bnxt_free_rx_mbufs(struct bnxt *bp);
75 int bnxt_rx_queue_intr_enable_op(struct rte_eth_dev *eth_dev,
76                                  uint16_t queue_id);
77 int bnxt_rx_queue_intr_disable_op(struct rte_eth_dev *eth_dev,
78                                   uint16_t queue_id);
79 int bnxt_rx_queue_start(struct rte_eth_dev *dev,
80                         uint16_t rx_queue_id);
81 int bnxt_rx_queue_stop(struct rte_eth_dev *dev,
82                        uint16_t rx_queue_id);
83 #endif