#include "bnxt_rxr.h"
#include "bnxt_rxq.h"
#include "hsi_struct_def_dpdk.h"
+#include "bnxt_rxtx_vec_common.h"
#include "bnxt_txq.h"
#include "bnxt_txr.h"
* RX Ring handling
*/
-#define RTE_BNXT_MAX_RX_BURST 32
-#define RTE_BNXT_MAX_TX_BURST 32
-#define RTE_BNXT_RXQ_REARM_THRESH 32
-#define RTE_BNXT_DESCS_PER_LOOP 4
-
static inline void
bnxt_rxq_rearm(struct bnxt_rx_queue *rxq, struct bnxt_rx_ring_info *rxr)
{
/* Return no more than RTE_BNXT_MAX_RX_BURST per call. */
nb_pkts = RTE_MIN(nb_pkts, RTE_BNXT_MAX_RX_BURST);
- /* Make nb_pkts an integer multiple of RTE_BNXT_DESCS_PER_LOOP */
+ /*
+ * Make nb_pkts an integer multiple of RTE_BNXT_DESCS_PER_LOOP.
+ * nb_pkts < RTE_BNXT_DESCS_PER_LOOP, just return no packet
+ */
nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_BNXT_DESCS_PER_LOOP);
+ if (!nb_pkts)
+ return 0;
/* Handle RX burst request */
while (1) {
}
}
-#define TX_BD_FLAGS_CMPL ((1 << TX_BD_LONG_FLAGS_BD_CNT_SFT) | \
- TX_BD_SHORT_FLAGS_COAL_NOW | \
- TX_BD_SHORT_TYPE_TX_BD_SHORT | \
- TX_BD_LONG_FLAGS_PACKET_END)
-
-#define TX_BD_FLAGS_NOCMPL (TX_BD_FLAGS_CMPL | TX_BD_LONG_FLAGS_NO_CMPL)
-
-static inline uint32_t
-bnxt_xmit_flags_len(uint16_t len, uint16_t flags)
-{
- switch (len >> 9) {
- case 0:
- return flags | TX_BD_LONG_FLAGS_LHINT_LT512;
- case 1:
- return flags | TX_BD_LONG_FLAGS_LHINT_LT1K;
- case 2:
- return flags | TX_BD_LONG_FLAGS_LHINT_LT2K;
- case 3:
- return flags | TX_BD_LONG_FLAGS_LHINT_LT2K;
- default:
- return flags | TX_BD_LONG_FLAGS_LHINT_GTE2K;
- }
-}
-
static uint16_t
bnxt_xmit_fixed_burst_vec(void *tx_queue, struct rte_mbuf **tx_pkts,
uint16_t nb_pkts)
int __rte_cold
bnxt_rxq_vec_setup(struct bnxt_rx_queue *rxq)
{
- uintptr_t p;
- struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */
-
- mb_def.nb_segs = 1;
- mb_def.data_off = RTE_PKTMBUF_HEADROOM;
- mb_def.port = rxq->port_id;
- rte_mbuf_refcnt_set(&mb_def, 1);
-
- /* prevent compiler reordering: rearm_data covers previous fields */
- rte_compiler_barrier();
- p = (uintptr_t)&mb_def.rearm_data;
- rxq->mbuf_initializer = *(uint64_t *)p;
- rxq->rxrearm_nb = 0;
- rxq->rxrearm_start = 0;
- return 0;
+ return bnxt_rxq_vec_setup_common(rxq);
}