examples/l2fwd: add check of Rx packets count

Message ID 20220525091327.4006824-1-rbhansali@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series examples/l2fwd: add check of Rx packets count |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing fail Testing issues
ci/iol-abi-testing success Testing PASS

Commit Message

Rahul Bhansali May 25, 2022, 9:13 a.m. UTC
  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>
---
 examples/l2fwd/main.c | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

Jerin Jacob June 2, 2022, 7:48 a.m. UTC | #1
On Wed, May 25, 2022 at 2:44 PM Rahul Bhansali <rbhansali@marvell.com> wrote:
>
> 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>


> ---
>  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
>
  
Rahul Bhansali June 23, 2022, 11:09 a.m. UTC | #2
Ping.

> -----Original Message-----
> From: Jerin Jacob <jerinjacobk@gmail.com>
> Sent: Thursday, June 2, 2022 1:19 PM
> To: Rahul Bhansali <rbhansali@marvell.com>
> Cc: dpdk-dev <dev@dpdk.org>; Bruce Richardson
> <bruce.richardson@intel.com>; Thomas Monjalon <thomas@monjalon.net>;
> Ferruh Yigit <ferruh.yigit@xilinx.com>; Ajit Khaparde
> <ajit.khaparde@broadcom.com>; Andrew Boyer <aboyer@pensando.io>;
> Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>; Beilei Xing
> <beilei.xing@intel.com>; Chas Williams <chas3@att.com>; Xia, Chenbo
> <chenbo.xia@intel.com>; Ciara Loftus <ciara.loftus@intel.com>; Devendra
> Singh Rawat <dsinghrawat@marvell.com>; Ed Czeck
> <ed.czeck@atomicrules.com>; Evgeny Schemeilin <evgenys@amazon.com>;
> Gaetan Rivet <grive@u256.net>; Gagandeep Singh <g.singh@nxp.com>;
> Guoyang Zhou <zhouguoyang@huawei.com>; Haiyue Wang
> <haiyue.wang@intel.com>; Harman Kalra <hkalra@marvell.com>;
> heinrich.kuhn@corigine.com; Hemant Agrawal <hemant.agrawal@nxp.com>;
> Hyong Youb Kim <hyonkim@cisco.com>; Igor Chauskin <igorch@amazon.com>;
> Igor Russkikh <irusskikh@marvell.com>; Jakub Grajciar <jgrajcia@cisco.com>;
> Jasvinder Singh <jasvinder.singh@intel.com>; Jian Wang
> <jianwang@trustnetic.com>; Jiawen Wu <jiawenwu@trustnetic.com>; Jingjing
> Wu <jingjing.wu@intel.com>; John Daley <johndale@cisco.com>; John Miller
> <john.miller@atomicrules.com>; John W. Linville <linville@tuxdriver.com>;
> Wiles, Keith <keith.wiles@intel.com>; Kiran Kumar Kokkilagadda
> <kirankumark@marvell.com>; Lijun Ou <oulijun@huawei.com>; Liron Himi
> <lironh@marvell.com>; Long Li <longli@microsoft.com>; Marcin Wojtas
> <mw@semihalf.com>; Martin Spinler <spinler@cesnet.cz>; Matan Azrad
> <matan@nvidia.com>; Matt Peters <matt.peters@windriver.com>; Maxime
> Coquelin <maxime.coquelin@redhat.com>; Michal Krawczyk
> <mk@semihalf.com>; Min Hu (Connor <humin29@huawei.com>; Pradeep
> Kumar Nalla <pnalla@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; Qiming Yang <qiming.yang@intel.com>; Qi Zhang
> <qi.z.zhang@intel.com>; Radha Chintakuntla <radhac@marvell.com>; Rahul
> Lakkireddy <rahul.lakkireddy@chelsio.com>; Rasesh Mody
> <rmody@marvell.com>; Rosen Xu <rosen.xu@intel.com>; Sachin Saxena
> <sachin.saxena@oss.nxp.com>; Satha Koteswara Rao Kottidi
> <skoteshwar@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>; Shai
> Brandes <shaibran@amazon.com>; Shepard Siegel
> <shepard.siegel@atomicrules.com>; Somalapuram Amaranath
> <asomalap@amd.com>; Somnath Kotur <somnath.kotur@broadcom.com>;
> Stephen Hemminger <sthemmin@microsoft.com>; Steven Webster
> <steven.webster@windriver.com>; Sunil Kumar Kori <skori@marvell.com>;
> Tetsuya Mukawa <mtetsuyah@gmail.com>; Veerasenareddy Burru
> <vburru@marvell.com>; Viacheslav Ovsiienko <viacheslavo@nvidia.com>; Xiao
> Wang <xiao.w.wang@intel.com>; Xiaoyun Wang
> <cloud.wangxiaoyun@huawei.com>; Yisen Zhuang
> <yisen.zhuang@huawei.com>; Yong Wang <yongwang@vmware.com>; Ziyang
> Xuan <xuanziyang2@huawei.com>
> Subject: [EXT] Re: [PATCH] examples/l2fwd: add check of Rx packets count
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Wed, May 25, 2022 at 2:44 PM Rahul Bhansali <rbhansali@marvell.com>
> wrote:
> >
> > 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>
> 
> 
> > ---
> >  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
> >
  
Thomas Monjalon June 26, 2022, 9:12 p.m. UTC | #3
Please could we have some tests on other hardware with this improvement?


25/05/2022 11:13, Rahul Bhansali:
> 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>
> ---
>  			nb_rx = rte_eth_rx_burst(portid, 0,
>  						 pkts_burst, MAX_PKT_BURST);
>  
> +			if (unlikely(nb_rx == 0))
> +				continue;
> +
  
Rahul Bhansali July 20, 2022, 4:52 p.m. UTC | #4
Ping

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, June 27, 2022 2:42 AM
> To: dev@dpdk.org
> Cc: Bruce Richardson <bruce.richardson@intel.com>; ferruh.yigit@xilinx.com;
> ajit.khaparde@broadcom.com; aboyer@pensando.io;
> andrew.rybchenko@oktetlabs.ru; beilei.xing@intel.com; chas3@att.com;
> chenbo.xia@intel.com; ciara.loftus@intel.com; Devendra Singh Rawat
> <dsinghrawat@marvell.com>; ed.czeck@atomicrules.com;
> evgenys@amazon.com; grive@u256.net; g.singh@nxp.com;
> zhouguoyang@huawei.com; haiyue.wang@intel.com; Harman Kalra
> <hkalra@marvell.com>; heinrich.kuhn@corigine.com;
> hemant.agrawal@nxp.com; hyonkim@cisco.com; igorch@amazon.com; Igor
> Russkikh <irusskikh@marvell.com>; jgrajcia@cisco.com;
> jasvinder.singh@intel.com; jianwang@trustnetic.com;
> jiawenwu@trustnetic.com; jingjing.wu@intel.com; johndale@cisco.com;
> john.miller@atomicrules.com; linville@tuxdriver.com; keith.wiles@intel.com;
> Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; oulijun@huawei.com;
> Liron Himi <lironh@marvell.com>; longli@microsoft.com; mw@semihalf.com;
> spinler@cesnet.cz; matan@nvidia.com; matt.peters@windriver.com;
> maxime.coquelin@redhat.com; mk@semihalf.com; humin29@huawei.com;
> Pradeep Kumar Nalla <pnalla@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; qiming.yang@intel.com; qi.z.zhang@intel.com;
> Radha Chintakuntla <radhac@marvell.com>; rahul.lakkireddy@chelsio.com;
> Rasesh Mody <rmody@marvell.com>; rosen.xu@intel.com;
> sachin.saxena@oss.nxp.com; Satha Koteswara Rao Kottidi
> <skoteshwar@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>;
> shaibran@amazon.com; shepard.siegel@atomicrules.com;
> asomalap@amd.com; somnath.kotur@broadcom.com;
> sthemmin@microsoft.com; steven.webster@windriver.com; Sunil Kumar Kori
> <skori@marvell.com>; mtetsuyah@gmail.com; Veerasenareddy Burru
> <vburru@marvell.com>; viacheslavo@nvidia.com; xiao.w.wang@intel.com;
> cloud.wangxiaoyun@huawei.com; yisen.zhuang@huawei.com;
> yongwang@vmware.com; xuanziyang2@huawei.com; Rahul Bhansali
> <rbhansali@marvell.com>
> Subject: [EXT] Re: [PATCH] examples/l2fwd: add check of Rx packets count
> 
> External Email
> 
> ----------------------------------------------------------------------
> Please could we have some tests on other hardware with this improvement?
> 
> 
> 25/05/2022 11:13, Rahul Bhansali:
> > 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>
> > ---
> >  			nb_rx = rte_eth_rx_burst(portid, 0,
> >  						 pkts_burst, MAX_PKT_BURST);
> >
> > +			if (unlikely(nb_rx == 0))
> > +				continue;
> > +
> 
> 
>
  
Stephen Hemminger July 20, 2022, 5:32 p.m. UTC | #5
On Wed, 25 May 2022 14:43:27 +0530
Rahul Bhansali <rbhansali@marvell.com> wrote:

> 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>

This makes sense. Could drop the unlikely() since in general unlikely
should be reserved for error cases. But doubt it matters at all.

Did a quick check the other examples do similar thing already.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  
Rahul Bhansali Sept. 14, 2022, 10:34 a.m. UTC | #6
Hi Thomas,

This got ack from Stephen Hemminger also. It is pending from long time, Can we consider this for RC1 ?

Regards,
Rahul

> -----Original Message-----
> From: Rahul Bhansali
> Sent: Wednesday, July 20, 2022 10:22 PM
> To: Thomas Monjalon <thomas@monjalon.net>; dev@dpdk.org
> Cc: Bruce Richardson <bruce.richardson@intel.com>; ferruh.yigit@xilinx.com;
> ajit.khaparde@broadcom.com; aboyer@pensando.io;
> andrew.rybchenko@oktetlabs.ru; beilei.xing@intel.com; chas3@att.com;
> chenbo.xia@intel.com; ciara.loftus@intel.com; Devendra Singh Rawat
> <dsinghrawat@marvell.com>; ed.czeck@atomicrules.com;
> evgenys@amazon.com; grive@u256.net; g.singh@nxp.com;
> zhouguoyang@huawei.com; haiyue.wang@intel.com; Harman Kalra
> <hkalra@marvell.com>; heinrich.kuhn@corigine.com;
> hemant.agrawal@nxp.com; hyonkim@cisco.com; igorch@amazon.com; Igor
> Russkikh <irusskikh@marvell.com>; jgrajcia@cisco.com;
> jasvinder.singh@intel.com; jianwang@trustnetic.com;
> jiawenwu@trustnetic.com; jingjing.wu@intel.com; johndale@cisco.com;
> john.miller@atomicrules.com; linville@tuxdriver.com; keith.wiles@intel.com;
> Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; oulijun@huawei.com;
> Liron Himi <lironh@marvell.com>; longli@microsoft.com; mw@semihalf.com;
> spinler@cesnet.cz; matan@nvidia.com; matt.peters@windriver.com;
> maxime.coquelin@redhat.com; mk@semihalf.com; humin29@huawei.com;
> Pradeep Kumar Nalla <pnalla@marvell.com>; Nithin Kumar Dabilpuram
> <ndabilpuram@marvell.com>; qiming.yang@intel.com; qi.z.zhang@intel.com;
> Radha Chintakuntla <radhac@marvell.com>; rahul.lakkireddy@chelsio.com;
> Rasesh Mody <rmody@marvell.com>; rosen.xu@intel.com;
> sachin.saxena@oss.nxp.com; Satha Koteswara Rao Kottidi
> <skoteshwar@marvell.com>; Shahed Shaikh <shshaikh@marvell.com>;
> shaibran@amazon.com; shepard.siegel@atomicrules.com;
> asomalap@amd.com; somnath.kotur@broadcom.com;
> sthemmin@microsoft.com; steven.webster@windriver.com; Sunil Kumar Kori
> <skori@marvell.com>; mtetsuyah@gmail.com; Veerasenareddy Burru
> <vburru@marvell.com>; viacheslavo@nvidia.com; xiao.w.wang@intel.com;
> cloud.wangxiaoyun@huawei.com; yisen.zhuang@huawei.com;
> yongwang@vmware.com; xuanziyang2@huawei.com
> Subject: RE: [EXT] Re: [PATCH] examples/l2fwd: add check of Rx packets count
> 
> Ping
> 
> > -----Original Message-----
> > From: Thomas Monjalon <thomas@monjalon.net>
> > Sent: Monday, June 27, 2022 2:42 AM
> > To: dev@dpdk.org
> > Cc: Bruce Richardson <bruce.richardson@intel.com>;
> > ferruh.yigit@xilinx.com; ajit.khaparde@broadcom.com;
> > aboyer@pensando.io; andrew.rybchenko@oktetlabs.ru;
> > beilei.xing@intel.com; chas3@att.com; chenbo.xia@intel.com;
> > ciara.loftus@intel.com; Devendra Singh Rawat
> > <dsinghrawat@marvell.com>; ed.czeck@atomicrules.com;
> > evgenys@amazon.com; grive@u256.net; g.singh@nxp.com;
> > zhouguoyang@huawei.com; haiyue.wang@intel.com; Harman Kalra
> > <hkalra@marvell.com>; heinrich.kuhn@corigine.com;
> > hemant.agrawal@nxp.com; hyonkim@cisco.com; igorch@amazon.com; Igor
> > Russkikh <irusskikh@marvell.com>; jgrajcia@cisco.com;
> > jasvinder.singh@intel.com; jianwang@trustnetic.com;
> > jiawenwu@trustnetic.com; jingjing.wu@intel.com; johndale@cisco.com;
> > john.miller@atomicrules.com; linville@tuxdriver.com;
> > keith.wiles@intel.com; Kiran Kumar Kokkilagadda
> > <kirankumark@marvell.com>; oulijun@huawei.com; Liron Himi
> > <lironh@marvell.com>; longli@microsoft.com; mw@semihalf.com;
> > spinler@cesnet.cz; matan@nvidia.com; matt.peters@windriver.com;
> > maxime.coquelin@redhat.com; mk@semihalf.com; humin29@huawei.com;
> > Pradeep Kumar Nalla <pnalla@marvell.com>; Nithin Kumar Dabilpuram
> > <ndabilpuram@marvell.com>; qiming.yang@intel.com;
> > qi.z.zhang@intel.com; Radha Chintakuntla <radhac@marvell.com>;
> > rahul.lakkireddy@chelsio.com; Rasesh Mody <rmody@marvell.com>;
> > rosen.xu@intel.com; sachin.saxena@oss.nxp.com; Satha Koteswara Rao
> > Kottidi <skoteshwar@marvell.com>; Shahed Shaikh
> > <shshaikh@marvell.com>; shaibran@amazon.com;
> > shepard.siegel@atomicrules.com; asomalap@amd.com;
> > somnath.kotur@broadcom.com; sthemmin@microsoft.com;
> > steven.webster@windriver.com; Sunil Kumar Kori <skori@marvell.com>;
> > mtetsuyah@gmail.com; Veerasenareddy Burru <vburru@marvell.com>;
> > viacheslavo@nvidia.com; xiao.w.wang@intel.com;
> > cloud.wangxiaoyun@huawei.com; yisen.zhuang@huawei.com;
> > yongwang@vmware.com; xuanziyang2@huawei.com; Rahul Bhansali
> > <rbhansali@marvell.com>
> > Subject: [EXT] Re: [PATCH] examples/l2fwd: add check of Rx packets
> > count
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> > Please could we have some tests on other hardware with this improvement?
> >
> >
> > 25/05/2022 11:13, Rahul Bhansali:
> > > 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>
> > > ---
> > >  			nb_rx = rte_eth_rx_burst(portid, 0,
> > >  						 pkts_burst, MAX_PKT_BURST);
> > >
> > > +			if (unlikely(nb_rx == 0))
> > > +				continue;
> > > +
> >
> >
> >
  
Rahul Bhansali Nov. 2, 2022, 1:47 p.m. UTC | #7
Ping.

> -----Original Message-----
> From: Rahul Bhansali
> Sent: Wednesday, September 14, 2022 4:04 PM
> To: 'Thomas Monjalon' <thomas@monjalon.net>; 'dev@dpdk.org'
> <dev@dpdk.org>
> Cc: 'Bruce Richardson' <bruce.richardson@intel.com>; 'ferruh.yigit@xilinx.com'
> <ferruh.yigit@xilinx.com>; 'ajit.khaparde@broadcom.com'
> <ajit.khaparde@broadcom.com>; 'aboyer@pensando.io'
> <aboyer@pensando.io>; 'andrew.rybchenko@oktetlabs.ru'
> <andrew.rybchenko@oktetlabs.ru>; 'beilei.xing@intel.com'
> <beilei.xing@intel.com>; 'chas3@att.com' <chas3@att.com>;
> 'chenbo.xia@intel.com' <chenbo.xia@intel.com>; 'ciara.loftus@intel.com'
> <ciara.loftus@intel.com>; Devendra Singh Rawat <dsinghrawat@marvell.com>;
> 'ed.czeck@atomicrules.com' <ed.czeck@atomicrules.com>;
> 'evgenys@amazon.com' <evgenys@amazon.com>; 'grive@u256.net'
> <grive@u256.net>; 'g.singh@nxp.com' <g.singh@nxp.com>;
> 'zhouguoyang@huawei.com' <zhouguoyang@huawei.com>;
> 'haiyue.wang@intel.com' <haiyue.wang@intel.com>; Harman Kalra
> <hkalra@marvell.com>; 'heinrich.kuhn@corigine.com'
> <heinrich.kuhn@corigine.com>; 'hemant.agrawal@nxp.com'
> <hemant.agrawal@nxp.com>; 'hyonkim@cisco.com' <hyonkim@cisco.com>;
> 'igorch@amazon.com' <igorch@amazon.com>; Igor Russkikh
> <irusskikh@marvell.com>; 'jgrajcia@cisco.com' <jgrajcia@cisco.com>;
> 'jasvinder.singh@intel.com' <jasvinder.singh@intel.com>;
> 'jianwang@trustnetic.com' <jianwang@trustnetic.com>;
> 'jiawenwu@trustnetic.com' <jiawenwu@trustnetic.com>;
> 'jingjing.wu@intel.com' <jingjing.wu@intel.com>; 'johndale@cisco.com'
> <johndale@cisco.com>; 'john.miller@atomicrules.com'
> <john.miller@atomicrules.com>; 'linville@tuxdriver.com'
> <linville@tuxdriver.com>; 'keith.wiles@intel.com' <keith.wiles@intel.com>;
> Kiran Kumar Kokkilagadda <kirankumark@marvell.com>; 'oulijun@huawei.com'
> <oulijun@huawei.com>; Liron Himi <lironh@marvell.com>;
> 'longli@microsoft.com' <longli@microsoft.com>; 'mw@semihalf.com'
> <mw@semihalf.com>; 'spinler@cesnet.cz' <spinler@cesnet.cz>;
> 'matan@nvidia.com' <matan@nvidia.com>; 'matt.peters@windriver.com'
> <matt.peters@windriver.com>; 'maxime.coquelin@redhat.com'
> <maxime.coquelin@redhat.com>; 'mk@semihalf.com' <mk@semihalf.com>;
> 'humin29@huawei.com' <humin29@huawei.com>; Pradeep Kumar Nalla
> <pnalla@marvell.com>; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>;
> 'qiming.yang@intel.com' <qiming.yang@intel.com>; 'qi.z.zhang@intel.com'
> <qi.z.zhang@intel.com>; Radha Chintakuntla <radhac@marvell.com>;
> 'rahul.lakkireddy@chelsio.com' <rahul.lakkireddy@chelsio.com>; Rasesh Mody
> <rmody@marvell.com>; 'rosen.xu@intel.com' <rosen.xu@intel.com>;
> 'sachin.saxena@oss.nxp.com' <sachin.saxena@oss.nxp.com>; Satha Koteswara
> Rao Kottidi <skoteshwar@marvell.com>; 'Shahed Shaikh'
> <shshaikh@marvell.com>; 'shaibran@amazon.com' <shaibran@amazon.com>;
> 'shepard.siegel@atomicrules.com' <shepard.siegel@atomicrules.com>;
> 'asomalap@amd.com' <asomalap@amd.com>;
> 'somnath.kotur@broadcom.com' <somnath.kotur@broadcom.com>;
> 'sthemmin@microsoft.com' <sthemmin@microsoft.com>;
> 'steven.webster@windriver.com' <steven.webster@windriver.com>; Sunil
> Kumar Kori <skori@marvell.com>; 'mtetsuyah@gmail.com'
> <mtetsuyah@gmail.com>; Veerasenareddy Burru <vburru@marvell.com>;
> 'viacheslavo@nvidia.com' <viacheslavo@nvidia.com>; 'xiao.w.wang@intel.com'
> <xiao.w.wang@intel.com>; 'cloud.wangxiaoyun@huawei.com'
> <cloud.wangxiaoyun@huawei.com>; 'yisen.zhuang@huawei.com'
> <yisen.zhuang@huawei.com>; 'yongwang@vmware.com'
> <yongwang@vmware.com>; 'xuanziyang2@huawei.com'
> <xuanziyang2@huawei.com>
> Subject: RE: [EXT] Re: [PATCH] examples/l2fwd: add check of Rx packets count
> 
> Hi Thomas,
> 
> This got ack from Stephen Hemminger also. It is pending from long time, Can we
> consider this for RC1 ?
> 
> Regards,
> Rahul
> 
> > -----Original Message-----
> > From: Rahul Bhansali
> > Sent: Wednesday, July 20, 2022 10:22 PM
> > To: Thomas Monjalon <thomas@monjalon.net>; dev@dpdk.org
> > Cc: Bruce Richardson <bruce.richardson@intel.com>;
> > ferruh.yigit@xilinx.com; ajit.khaparde@broadcom.com;
> > aboyer@pensando.io; andrew.rybchenko@oktetlabs.ru;
> > beilei.xing@intel.com; chas3@att.com; chenbo.xia@intel.com;
> > ciara.loftus@intel.com; Devendra Singh Rawat
> > <dsinghrawat@marvell.com>; ed.czeck@atomicrules.com;
> > evgenys@amazon.com; grive@u256.net; g.singh@nxp.com;
> > zhouguoyang@huawei.com; haiyue.wang@intel.com; Harman Kalra
> > <hkalra@marvell.com>; heinrich.kuhn@corigine.com;
> > hemant.agrawal@nxp.com; hyonkim@cisco.com; igorch@amazon.com; Igor
> > Russkikh <irusskikh@marvell.com>; jgrajcia@cisco.com;
> > jasvinder.singh@intel.com; jianwang@trustnetic.com;
> > jiawenwu@trustnetic.com; jingjing.wu@intel.com; johndale@cisco.com;
> > john.miller@atomicrules.com; linville@tuxdriver.com;
> > keith.wiles@intel.com; Kiran Kumar Kokkilagadda
> > <kirankumark@marvell.com>; oulijun@huawei.com; Liron Himi
> > <lironh@marvell.com>; longli@microsoft.com; mw@semihalf.com;
> > spinler@cesnet.cz; matan@nvidia.com; matt.peters@windriver.com;
> > maxime.coquelin@redhat.com; mk@semihalf.com; humin29@huawei.com;
> > Pradeep Kumar Nalla <pnalla@marvell.com>; Nithin Kumar Dabilpuram
> > <ndabilpuram@marvell.com>; qiming.yang@intel.com;
> > qi.z.zhang@intel.com; Radha Chintakuntla <radhac@marvell.com>;
> > rahul.lakkireddy@chelsio.com; Rasesh Mody <rmody@marvell.com>;
> > rosen.xu@intel.com; sachin.saxena@oss.nxp.com; Satha Koteswara Rao
> > Kottidi <skoteshwar@marvell.com>; Shahed Shaikh
> > <shshaikh@marvell.com>; shaibran@amazon.com;
> > shepard.siegel@atomicrules.com; asomalap@amd.com;
> > somnath.kotur@broadcom.com; sthemmin@microsoft.com;
> > steven.webster@windriver.com; Sunil Kumar Kori <skori@marvell.com>;
> > mtetsuyah@gmail.com; Veerasenareddy Burru <vburru@marvell.com>;
> > viacheslavo@nvidia.com; xiao.w.wang@intel.com;
> > cloud.wangxiaoyun@huawei.com; yisen.zhuang@huawei.com;
> > yongwang@vmware.com; xuanziyang2@huawei.com
> > Subject: RE: [EXT] Re: [PATCH] examples/l2fwd: add check of Rx packets
> > count
> >
> > Ping
> >
> > > -----Original Message-----
> > > From: Thomas Monjalon <thomas@monjalon.net>
> > > Sent: Monday, June 27, 2022 2:42 AM
> > > To: dev@dpdk.org
> > > Cc: Bruce Richardson <bruce.richardson@intel.com>;
> > > ferruh.yigit@xilinx.com; ajit.khaparde@broadcom.com;
> > > aboyer@pensando.io; andrew.rybchenko@oktetlabs.ru;
> > > beilei.xing@intel.com; chas3@att.com; chenbo.xia@intel.com;
> > > ciara.loftus@intel.com; Devendra Singh Rawat
> > > <dsinghrawat@marvell.com>; ed.czeck@atomicrules.com;
> > > evgenys@amazon.com; grive@u256.net; g.singh@nxp.com;
> > > zhouguoyang@huawei.com; haiyue.wang@intel.com; Harman Kalra
> > > <hkalra@marvell.com>; heinrich.kuhn@corigine.com;
> > > hemant.agrawal@nxp.com; hyonkim@cisco.com; igorch@amazon.com;
> Igor
> > > Russkikh <irusskikh@marvell.com>; jgrajcia@cisco.com;
> > > jasvinder.singh@intel.com; jianwang@trustnetic.com;
> > > jiawenwu@trustnetic.com; jingjing.wu@intel.com; johndale@cisco.com;
> > > john.miller@atomicrules.com; linville@tuxdriver.com;
> > > keith.wiles@intel.com; Kiran Kumar Kokkilagadda
> > > <kirankumark@marvell.com>; oulijun@huawei.com; Liron Himi
> > > <lironh@marvell.com>; longli@microsoft.com; mw@semihalf.com;
> > > spinler@cesnet.cz; matan@nvidia.com; matt.peters@windriver.com;
> > > maxime.coquelin@redhat.com; mk@semihalf.com; humin29@huawei.com;
> > > Pradeep Kumar Nalla <pnalla@marvell.com>; Nithin Kumar Dabilpuram
> > > <ndabilpuram@marvell.com>; qiming.yang@intel.com;
> > > qi.z.zhang@intel.com; Radha Chintakuntla <radhac@marvell.com>;
> > > rahul.lakkireddy@chelsio.com; Rasesh Mody <rmody@marvell.com>;
> > > rosen.xu@intel.com; sachin.saxena@oss.nxp.com; Satha Koteswara Rao
> > > Kottidi <skoteshwar@marvell.com>; Shahed Shaikh
> > > <shshaikh@marvell.com>; shaibran@amazon.com;
> > > shepard.siegel@atomicrules.com; asomalap@amd.com;
> > > somnath.kotur@broadcom.com; sthemmin@microsoft.com;
> > > steven.webster@windriver.com; Sunil Kumar Kori <skori@marvell.com>;
> > > mtetsuyah@gmail.com; Veerasenareddy Burru <vburru@marvell.com>;
> > > viacheslavo@nvidia.com; xiao.w.wang@intel.com;
> > > cloud.wangxiaoyun@huawei.com; yisen.zhuang@huawei.com;
> > > yongwang@vmware.com; xuanziyang2@huawei.com; Rahul Bhansali
> > > <rbhansali@marvell.com>
> > > Subject: [EXT] Re: [PATCH] examples/l2fwd: add check of Rx packets
> > > count
> > >
> > > External Email
> > >
> > > --------------------------------------------------------------------
> > > -- Please could we have some tests on other hardware with this
> > > improvement?
> > >
> > >
> > > 25/05/2022 11:13, Rahul Bhansali:
> > > > 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>
> > > > ---
> > > >  			nb_rx = rte_eth_rx_burst(portid, 0,
> > > >  						 pkts_burst, MAX_PKT_BURST);
> > > >
> > > > +			if (unlikely(nb_rx == 0))
> > > > +				continue;
> > > > +
> > >
> > >
> > >
  
Hemant Agrawal Nov. 2, 2022, 2:09 p.m. UTC | #8
On 20-Jul-22 11:02 PM, Stephen Hemminger wrote:
> On Wed, 25 May 2022 14:43:27 +0530
> Rahul Bhansali <rbhansali@marvell.com> wrote:
>
>> 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>
> This makes sense. Could drop the unlikely() since in general unlikely
> should be reserved for error cases. But doubt it matters at all.
>
> Did a quick check the other examples do similar thing already.
>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
  
Thomas Monjalon Nov. 2, 2022, 3:29 p.m. UTC | #9
02/11/2022 14:47, Rahul Bhansali:
> Ping.

Sorry it has been forgotten.
Thank you for pinging.
  
Thomas Monjalon Nov. 2, 2022, 3:47 p.m. UTC | #10
02/11/2022 15:09, Hemant Agrawal:
> On 20-Jul-22 11:02 PM, Stephen Hemminger wrote:
> > On Wed, 25 May 2022 14:43:27 +0530
> > Rahul Bhansali <rbhansali@marvell.com> wrote:
> >
> >> 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>
> > This makes sense. Could drop the unlikely() since in general unlikely
> > should be reserved for error cases. But doubt it matters at all.
> >
> > Did a quick check the other examples do similar thing already.
> >
> > Acked-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>

Applied, thanks.
  

Patch

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++) {