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_L4_CS_UNKNOWN(rxcmp1) \
40 !((rxcmp1)->flags2 & RX_CMP_L4_CS_BITS)
42 #define RX_CMP_IP_CS_ERR_BITS \
43 rte_cpu_to_le_32(RX_PKT_CMPL_ERRORS_IP_CS_ERROR | \
44 RX_PKT_CMPL_ERRORS_T_IP_CS_ERROR)
46 #define RX_CMP_IP_CS_BITS \
47 rte_cpu_to_le_32(RX_PKT_CMPL_FLAGS2_IP_CS_CALC | \
48 RX_PKT_CMPL_FLAGS2_T_IP_CS_CALC)
50 #define RX_CMP_IP_CS_OK(rxcmp1) \
51 (((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS) && \
52 !((rxcmp1)->errors_v2 & RX_CMP_IP_CS_ERR_BITS))
54 #define RX_CMP_IP_CS_UNKNOWN(rxcmp1) \
55 !((rxcmp1)->flags2 & RX_CMP_IP_CS_BITS)
57 #define BNXT_RX_POST_THRESH 32
60 PKT_HASH_TYPE_NONE, /* Undefined type */
61 PKT_HASH_TYPE_L2, /* Input: src_MAC, dest_MAC */
62 PKT_HASH_TYPE_L3, /* Input: src_IP, dst_IP */
63 PKT_HASH_TYPE_L4, /* Input: src_IP, dst_IP, src_port, dst_port */
66 struct bnxt_tpa_info {
67 struct rte_mbuf *mbuf;
69 unsigned short gso_type;
72 enum pkt_hash_types hash_type;
77 struct bnxt_sw_rx_bd {
78 struct rte_mbuf *mbuf; /* data associated with RX descriptor */
81 struct bnxt_rx_ring_info {
87 struct rx_prod_pkt_bd *rx_desc_ring;
88 struct rx_prod_pkt_bd *ag_desc_ring;
89 struct bnxt_sw_rx_bd *rx_buf_ring; /* sw ring */
90 struct bnxt_sw_rx_bd *ag_buf_ring; /* sw ring */
92 rte_iova_t rx_desc_mapping;
93 rte_iova_t ag_desc_mapping;
95 struct bnxt_ring *rx_ring_struct;
96 struct bnxt_ring *ag_ring_struct;
99 * To deal with out of order return from TPA, use free buffer indicator
101 struct rte_bitmap *ag_bitmap;
103 struct bnxt_tpa_info *tpa_info;
106 uint16_t bnxt_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
108 void bnxt_free_rx_rings(struct bnxt *bp);
109 int bnxt_init_rx_ring_struct(struct bnxt_rx_queue *rxq, unsigned int socket_id);
110 int bnxt_init_one_rx_ring(struct bnxt_rx_queue *rxq);
111 int bnxt_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id);
112 int bnxt_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id);