955432983514a51e519510263ded99e0e6fbd6ed
[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         uint8_t                 port_id; /* Device port identifier */
52         uint8_t                 crc_len; /* 0 if CRC stripped, 4 otherwise */
53
54         struct bnxt             *bp;
55         struct bnxt_vnic_info   *vnic;
56
57         uint32_t                        rx_buf_size;
58         uint32_t                        rx_buf_use_size;  /* useable size */
59         struct bnxt_rx_ring_info        *rx_ring;
60         struct bnxt_cp_ring_info        *cp_ring;
61 };
62
63 void bnxt_free_rxq_stats(struct bnxt_rx_queue *rxq);
64 int bnxt_mq_rx_configure(struct bnxt *bp);
65 void bnxt_rx_queue_release_op(void *rx_queue);
66 int bnxt_rx_queue_setup_op(struct rte_eth_dev *eth_dev,
67                                uint16_t queue_idx,
68                                uint16_t nb_desc,
69                                unsigned int socket_id,
70                                const struct rte_eth_rxconf *rx_conf,
71                                struct rte_mempool *mp);
72 void bnxt_free_rx_mbufs(struct bnxt *bp);
73
74 #endif