1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2020 Broadcom
6 #ifndef _BNXT_RXTX_VEC_COMMON_H_
7 #define _BNXT_RXTX_VEC_COMMON_H_
9 #define RTE_BNXT_MAX_RX_BURST 32
10 #define RTE_BNXT_MAX_TX_BURST 32
11 #define RTE_BNXT_RXQ_REARM_THRESH 32
12 #define RTE_BNXT_DESCS_PER_LOOP 4
14 #define TX_BD_FLAGS_CMPL ((1 << TX_BD_LONG_FLAGS_BD_CNT_SFT) | \
15 TX_BD_SHORT_FLAGS_COAL_NOW | \
16 TX_BD_SHORT_TYPE_TX_BD_SHORT | \
17 TX_BD_LONG_FLAGS_PACKET_END)
19 #define TX_BD_FLAGS_NOCMPL (TX_BD_FLAGS_CMPL | TX_BD_LONG_FLAGS_NO_CMPL)
21 static inline uint32_t
22 bnxt_xmit_flags_len(uint16_t len, uint16_t flags)
26 return flags | TX_BD_LONG_FLAGS_LHINT_LT512;
28 return flags | TX_BD_LONG_FLAGS_LHINT_LT1K;
30 return flags | TX_BD_LONG_FLAGS_LHINT_LT2K;
32 return flags | TX_BD_LONG_FLAGS_LHINT_LT2K;
34 return flags | TX_BD_LONG_FLAGS_LHINT_GTE2K;
39 bnxt_rxq_vec_setup_common(struct bnxt_rx_queue *rxq)
42 struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
45 mb_def.data_off = RTE_PKTMBUF_HEADROOM;
46 mb_def.port = rxq->port_id;
47 rte_mbuf_refcnt_set(&mb_def, 1);
49 /* prevent compiler reordering: rearm_data covers previous fields */
50 rte_compiler_barrier();
51 p = (uintptr_t)&mb_def.rearm_data;
52 rxq->mbuf_initializer = *(uint64_t *)p;
54 rxq->rxrearm_start = 0;
57 #endif /* _BNXT_RXTX_VEC_COMMON_H_ */