examples/l2fwd: check Rx packets count

An additional check is added to avoid extra processing if
receive packets are 0.

Performance impact: with Marvell OCTEON TX2 platform, observed an
improvement by ~14%.

Signed-off-by: Rahul Bhansali <rbhansali@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
This commit is contained in:
Rahul Bhansali 2022-05-25 14:43:27 +05:30 committed by Thomas Monjalon
parent 41f8e803bf
commit a39f5e1456

View File

@ -283,6 +283,9 @@ l2fwd_main_loop(void)
nb_rx = rte_eth_rx_burst(portid, 0,
pkts_burst, MAX_PKT_BURST);
if (unlikely(nb_rx == 0))
continue;
port_statistics[portid].rx += nb_rx;
for (j = 0; j < nb_rx; j++) {