1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2014-2018 Broadcom
9 #define B_RX_DB(db, prod) \
10 (*(uint32_t *)db = (DB_KEY_RX | prod))
12 #define BNXT_TPA_L4_SIZE(x) \
14 typeof(x) hdr_info = (x); \
15 (((hdr_info) & 0xf8000000) ? ((hdr_info) >> 27) : 32) \
18 #define BNXT_TPA_INNER_L3_OFF(hdr_info) \
19 (((hdr_info) >> 18) & 0x1ff)
21 #define BNXT_TPA_INNER_L2_OFF(hdr_info) \
22 (((hdr_info) >> 9) & 0x1ff)
24 #define BNXT_TPA_OUTER_L3_OFF(hdr_info) \
27 #define RX_CMP_L4_CS_BITS \
28 rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_L4_CS_CALC | \
29 RX_PKT_CMPL_FLAGS2_T_L4_CS_CALC)
31 #define RX_CMP_L4_CS_ERR_BITS \
32 rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_L4_CS_ERROR | \
33 RX_PKT_CMPL_ERRORS_T_L4_CS_ERROR)
35 #define RX_CMP_L4_CS_OK(rxcmp1) \
36 (((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS) && \
37 !((rxcmp1)->errors_v2 & RX_CMP_L4_CS_ERR_BITS))
39 #define RX_CMP_IP_CS_ERR_BITS \
40 rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_IP_CS_ERROR | \
41 RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR)
43 #define RX_CMP_IP_CS_BITS \
44 rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC | \
45 RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC)
47 #define RX_CMP_IP_CS_OK(rxcmp1) \
48 (((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS) && \
49 !((rxcmp1)->errors_v2 & RX_CMP_IP_CS_ERR_BITS))
52 PKT_HASH_TYPE_NONE, /* Undefined type */
53 PKT_HASH_TYPE_L2, /* Input: src_MAC, dest_MAC */
54 PKT_HASH_TYPE_L3, /* Input: src_IP, dst_IP */
55 PKT_HASH_TYPE_L4, /* Input: src_IP, dst_IP, src_port, dst_port */
58 struct bnxt_tpa_info {
59 struct rte_mbuf *mbuf;
61 unsigned short gso_type;
64 enum pkt_hash_types hash_type;
69 struct bnxt_sw_rx_bd {
70 struct rte_mbuf *mbuf; /* data associated with RX descriptor */
73 struct bnxt_rx_ring_info {
79 struct rx_prod_pkt_bd *rx_desc_ring;
80 struct rx_prod_pkt_bd *ag_desc_ring;
81 struct bnxt_sw_rx_bd *rx_buf_ring; /* sw ring */
82 struct bnxt_sw_rx_bd *ag_buf_ring; /* sw ring */
84 rte_iova_t rx_desc_mapping;
85 rte_iova_t ag_desc_mapping;
87 struct bnxt_ring *rx_ring_struct;
88 struct bnxt_ring *ag_ring_struct;
91 * To deal with out of order return from TPA, use free buffer indicator
93 struct rte_bitmap *ag_bitmap;
95 struct bnxt_tpa_info *tpa_info;
98 uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
100 void bnxt_free_rx_rings(struct bnxt *bp);
101 int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id);
102 int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq);
103 int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
104 int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);