From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 54C77A054F; Wed, 25 May 2022 11:14:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E9AAA400EF; Wed, 25 May 2022 11:14:09 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 7DD82400D6 for ; Wed, 25 May 2022 11:14:08 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 24P7Gl8B020546; Wed, 25 May 2022 02:13:52 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=OfGkUObmTGGhfrYOnN8VW/C+XSiBHAWXGmbCepr6lhU=; b=C4XgK0Dn/oFALFRFTTf3argp6utMY37N4LqyZaEE2p4vJfg8JySBvcJbtzKpuAnutGq/ lfi9Vu2xTD1RrtGr9mVglRsVFkftCDHqfVhhtSVKClKMTjXXzl4SjMhKwaJq6aKygEh1 bKXc9LcjEk53tiSQPUkhDO2J7sB1yqUA9jYqjcNRIEKYvQh6Qu5+ecqTRZh70xoXlq5T uhoJmgvcYwJ/uJjoq3ifnHZj+sD0xQ0irouZOPoGbHoBdeev2xLHf64UmHNg2GzoppYE oReXIFYukeEgFHnIrslc/FwVaCrIJsZ0zV4YiHt/zr4k7R3dWacGFtoSJ1oucuhSNPrv Ww== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3g93ty30vu-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 25 May 2022 02:13:52 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 25 May 2022 02:13:47 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Wed, 25 May 2022 02:13:49 -0700 Received: from localhost.localdomain (unknown [10.28.48.107]) by maili.marvell.com (Postfix) with ESMTP id 1BD393F7064; Wed, 25 May 2022 02:13:31 -0700 (PDT) From: Rahul Bhansali To: , Bruce Richardson CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Rahul Bhansali Subject: [PATCH] examples/l2fwd: add check of Rx packets count Date: Wed, 25 May 2022 14:43:27 +0530 Message-ID: <20220525091327.4006824-1-rbhansali@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: enulHC2fEYC8-H9Dh2II_QZbFZ9BKtaX X-Proofpoint-ORIG-GUID: enulHC2fEYC8-H9Dh2II_QZbFZ9BKtaX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.874,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-25_03,2022-05-23_01,2022-02-23_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org 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 --- examples/l2fwd/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 281c6b7a3f..28c498712e 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -286,6 +286,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++) { -- 2.25.1