4 * Copyright(c) Broadcom Limited.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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
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.
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.
39 #include <rte_memory.h>
41 #define RING_NEXT(ring, idx) (((idx) + 1) & (ring)->ring_mask)
43 #define RTE_MBUF_DATA_DMA_ADDR(mb) \
44 ((uint64_t)((mb)->buf_physaddr + (mb)->data_off))
46 #define DB_IDX_MASK 0xffffff
47 #define DB_IDX_VALID (0x1 << 26)
48 #define DB_IRQ_DIS (0x1 << 27)
49 #define DB_KEY_TX (0x0 << 28)
50 #define DB_KEY_RX (0x1 << 28)
51 #define DB_KEY_CP (0x2 << 28)
52 #define DB_KEY_ST (0x3 << 28)
53 #define DB_KEY_TX_PUSH (0x4 << 28)
54 #define DB_LONG_TX_PUSH (0x2 << 24)
56 #define DEFAULT_CP_RING_SIZE 256
57 #define DEFAULT_RX_RING_SIZE 256
58 #define DEFAULT_TX_RING_SIZE 256
62 /* These assume 4k pages */
63 #define MAX_RX_DESC_CNT (8 * 1024)
64 #define MAX_TX_DESC_CNT (4 * 1024)
65 #define MAX_CP_DESC_CNT (16 * 1024)
67 #define INVALID_HW_RING_ID ((uint16_t)-1)
78 uint16_t fw_ring_id; /* Ring id filled by Chimp FW */
82 struct bnxt_ring_grp_info {
83 uint16_t fw_stats_ctx;
85 uint16_t rx_fw_ring_id;
86 uint16_t cp_fw_ring_id;
87 uint16_t ag_fw_ring_id;
91 struct bnxt_tx_ring_info;
92 struct bnxt_rx_ring_info;
93 struct bnxt_cp_ring_info;
94 void bnxt_free_ring(struct bnxt_ring *ring);
95 void bnxt_init_ring_grps(struct bnxt *bp);
96 int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,
97 struct bnxt_tx_ring_info *tx_ring_info,
98 struct bnxt_rx_ring_info *rx_ring_info,
99 struct bnxt_cp_ring_info *cp_ring_info,
101 int bnxt_alloc_hwrm_rings(struct bnxt *bp);