From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 633765580 for ; Sun, 17 Jul 2016 16:05:21 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 17 Jul 2016 07:05:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,378,1464678000"; d="scan'208";a="996926805" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga001.jf.intel.com with ESMTP; 17 Jul 2016 07:05:20 -0700 Received: from fmsmsx158.amr.corp.intel.com (10.18.116.75) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 17 Jul 2016 07:05:19 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by fmsmsx158.amr.corp.intel.com (10.18.116.75) with Microsoft SMTP Server (TLS) id 14.3.248.2; Sun, 17 Jul 2016 07:05:19 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.181]) by shsmsx102.ccr.corp.intel.com ([169.254.2.147]) with mapi id 14.03.0248.002; Sun, 17 Jul 2016 22:05:17 +0800 From: "Liu, Yong" To: "Pattan, Reshma" , "dev@dpdk.org" CC: "Pattan, Reshma" Thread-Topic: [dpdk-dev] [PATCH] examples/distributor: fix Rx thread logic for zero packets Thread-Index: AdHgNDrrdDmL+T2cRSaANW3wvV8aAA== Date: Sun, 17 Jul 2016 14:05:17 +0000 Message-ID: <86228AFD5BCD8E4EBFD2B90117B5E81E22258EF0@SHSMSX103.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMDE1NDU2YzctYTZiZi00ZGU4LTk4ZDgtZjEyZTYxZjllMGRhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IjJFa2UzUDNEUzZBbGpXNVFzdUtib1JjZmQ3bEpXUGxLRXdhRVBleTNcL3FZPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] examples/distributor: fix Rx thread logic for zero packets X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 17 Jul 2016 14:05:21 -0000 Tested-by: Marvin Liu > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Reshma Pattan > Sent: Thursday, July 14, 2016 11:49 PM > To: dev@dpdk.org > Cc: Pattan, Reshma > Subject: [dpdk-dev] [PATCH] examples/distributor: fix Rx thread logic for > zero packets >=20 > From: Reshma Pattan >=20 > Zero packets can be returned by rte_eth_rx_burst() and > rte_distributor_returned_pkts() inside lcore_rx(), so > for zero packet scenario instead of proceeding to > next operations we should continue to the next iteration of the > loop to avoid unnecessary processing overhead which is causing > rx packets to be dropped and hence distributor failing to forward the > packets. >=20 > Fixes: 07db4a97 ("examples/distributor: new sample app") >=20 > Signed-off-by: Reshma Pattan > --- > examples/distributor/main.c | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) >=20 > diff --git a/examples/distributor/main.c b/examples/distributor/main.c > index 24857f2..537cee1 100644 > --- a/examples/distributor/main.c > +++ b/examples/distributor/main.c > @@ -221,14 +221,22 @@ lcore_rx(struct lcore_params *p) > struct rte_mbuf *bufs[BURST_SIZE*2]; > const uint16_t nb_rx =3D rte_eth_rx_burst(port, 0, bufs, > BURST_SIZE); > + if (unlikely(nb_rx =3D=3D 0)) { > + if (++port =3D=3D nb_ports) > + port =3D 0; > + continue; > + } > app_stats.rx.rx_pkts +=3D nb_rx; >=20 > rte_distributor_process(d, bufs, nb_rx); > const uint16_t nb_ret =3D rte_distributor_returned_pkts(d, > bufs, BURST_SIZE*2); > app_stats.rx.returned_pkts +=3D nb_ret; > - if (unlikely(nb_ret =3D=3D 0)) > + if (unlikely(nb_ret =3D=3D 0)) { > + if (++port =3D=3D nb_ports) > + port =3D 0; > continue; > + } >=20 > uint16_t sent =3D rte_ring_enqueue_burst(r, (void *)bufs, > nb_ret); > app_stats.rx.enqueued_pkts +=3D sent; > -- > 2.5.0