uint8_t vlan_flags;
uint16_t udp_p_flag = 0; /* Rx Descriptor UDP header present */
+ /*
+ * Under the circumstance that `rx_tail` wrap back to zero
+ * and the advance speed of `rx_tail` is greater than `rxrearm_start`,
+ * `rx_tail` will catch up with `rxrearm_start` and surpass it.
+ * This may cause some mbufs be reused by application.
+ *
+ * So we need to make some restrictions to ensure that
+ * `rx_tail` will not exceed `rxrearm_start`.
+ */
+ nb_pkts = RTE_MIN(nb_pkts, RTE_IXGBE_RXQ_REARM_THRESH);
+
/* nb_pkts has to be floor-aligned to RTE_IXGBE_DESCS_PER_LOOP */
nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_IXGBE_DESCS_PER_LOOP);