From a39f5e14560df310e7af3c135a11bb6f51eb92e6 Mon Sep 17 00:00:00 2001 From: Rahul Bhansali Date: Wed, 25 May 2022 14:43:27 +0530 Subject: [PATCH] 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 Acked-by: Jerin Jacob Acked-by: Stephen Hemminger Acked-by: Hemant Agrawal --- examples/l2fwd/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index a774722204..96fb33196f 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -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++) {