1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018-2021 Beijing WangXun Technology Co., Ltd.
3 * Copyright(c) 2010-2017 Intel Corporation
9 /*****************************************************************************
11 *****************************************************************************/
28 } qw0; /* also as r.pkt_addr */
43 } qw1; /* also as r.hdr_addr */
46 #define RTE_PMD_NGBE_RX_MAX_BURST 32
48 #define RX_RING_SZ ((NGBE_RING_DESC_MAX + RTE_PMD_NGBE_RX_MAX_BURST) * \
49 sizeof(struct ngbe_rx_desc))
53 * Structure associated with each descriptor of the Rx ring of a Rx queue.
55 struct ngbe_rx_entry {
56 struct rte_mbuf *mbuf; /**< mbuf associated with Rx descriptor. */
59 struct ngbe_scattered_rx_entry {
60 struct rte_mbuf *fbuf; /**< First segment of the fragmented packet. */
64 * Structure associated with each Rx queue.
66 struct ngbe_rx_queue {
67 struct rte_mempool *mb_pool; /**< mbuf pool to populate Rx ring */
68 uint64_t rx_ring_phys_addr; /**< Rx ring DMA address */
69 volatile uint32_t *rdt_reg_addr; /**< RDT register address */
70 volatile uint32_t *rdh_reg_addr; /**< RDH register address */
72 volatile struct ngbe_rx_desc *rx_ring; /**< Rx ring virtual address */
73 /** address of Rx software ring */
74 struct ngbe_rx_entry *sw_ring;
75 /** address of scattered Rx software ring */
76 struct ngbe_scattered_rx_entry *sw_sc_ring;
78 struct rte_mbuf *pkt_first_seg; /**< First segment of current packet */
79 struct rte_mbuf *pkt_last_seg; /**< Last segment of current packet */
80 uint16_t nb_rx_desc; /**< number of Rx descriptors */
81 uint16_t rx_tail; /**< current value of RDT register */
82 uint16_t nb_rx_hold; /**< number of held free Rx desc */
84 uint16_t rx_nb_avail; /**< nr of staged pkts ready to ret to app */
85 uint16_t rx_next_avail; /**< idx of next staged pkt to ret to app */
86 uint16_t rx_free_trigger; /**< triggers rx buffer allocation */
88 uint16_t rx_free_thresh; /**< max free Rx desc to hold */
89 uint16_t queue_id; /**< RX queue index */
90 uint16_t reg_idx; /**< RX queue register index */
91 uint16_t port_id; /**< Device port identifier */
92 uint8_t drop_en; /**< If not 0, set SRRCTL.Drop_En */
93 uint8_t rx_deferred_start; /**< not in global dev start */
94 /** need to alloc dummy mbuf, for wraparound when scanning hw ring */
95 struct rte_mbuf fake_mbuf;
96 /** hold packets to return to application */
97 struct rte_mbuf *rx_stage[RTE_PMD_NGBE_RX_MAX_BURST * 2];
100 #endif /* _NGBE_RXTX_H_ */