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 0C4E71150 for ; Wed, 1 Feb 2017 17:19:36 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga104.fm.intel.com with ESMTP; 01 Feb 2017 08:19:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,320,1477983600"; d="scan'208";a="1120729478" Received: from irsmsx104.ger.corp.intel.com ([163.33.3.159]) by fmsmga002.fm.intel.com with ESMTP; 01 Feb 2017 08:19:34 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.38]) by IRSMSX104.ger.corp.intel.com ([163.33.3.159]) with mapi id 14.03.0248.002; Wed, 1 Feb 2017 16:19:34 +0000 From: "Ananyev, Konstantin" To: Jianbo Liu , "dev@dpdk.org" , "Zhang, Helin" , "jerin.jacob@caviumnetworks.com" Thread-Topic: [PATCH 1/2] net/ixgbe: calculate the correct number of received packets in bulk alloc function Thread-Index: AQHSWb58asmucrnoMk2+2eqjXjRnOKFUl/1A Date: Wed, 1 Feb 2017 16:19:33 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583F10FF87@irsmsx105.ger.corp.intel.com> References: <1482127758-4904-1-git-send-email-jianbo.liu@linaro.org> In-Reply-To: <1482127758-4904-1-git-send-email-jianbo.liu@linaro.org> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [163.33.239.180] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 1/2] net/ixgbe: calculate the correct number of received packets in bulk alloc function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Feb 2017 16:19:37 -0000 Hi, > -----Original Message----- > From: Jianbo Liu [mailto:jianbo.liu@linaro.org] > Sent: Monday, December 19, 2016 6:09 AM > To: dev@dpdk.org; Zhang, Helin ; Ananyev, Konstant= in ; > jerin.jacob@caviumnetworks.com > Cc: Jianbo Liu > Subject: [PATCH 1/2] net/ixgbe: calculate the correct number of received = packets in bulk alloc function >=20 > To get better performance, Rx bulk alloc recv function will scan 8 descri= ptors > in one time, but the statuses are not consistent on ARM platform because > the memory allocated for Rx descriptors is cacheable hugepages. > This patch is to calculate the number of received packets by scanning DD = bit > sequentially, and stops when meeting the first packet with DD bit unset. >=20 > Signed-off-by: Jianbo Liu > --- > drivers/net/ixgbe/ixgbe_rxtx.c | 12 ++++++++---- > 1 file changed, 8 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxt= x.c > index b2d9f45..2866bdb 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -1402,17 +1402,21 @@ ixgbe_rx_scan_hw_ring(struct ixgbe_rx_queue *rxq) > for (i =3D 0; i < RTE_PMD_IXGBE_RX_MAX_BURST; > i +=3D LOOK_AHEAD, rxdp +=3D LOOK_AHEAD, rxep +=3D LOOK_AHEAD) { > /* Read desc statuses backwards to avoid race condition */ > - for (j =3D LOOK_AHEAD-1; j >=3D 0; --j) > + for (j =3D LOOK_AHEAD - 1; j >=3D 0; --j) { > s[j] =3D rte_le_to_cpu_32(rxdp[j].wb.upper.status_error); > - > - for (j =3D LOOK_AHEAD - 1; j >=3D 0; --j) > pkt_info[j] =3D rte_le_to_cpu_32(rxdp[j].wb.lower. > lo_dword.data); > + } > + > + rte_smp_rmb(); If reads can be reordered, shouldn't we fill pkt_info[] after smp_rmb() her= e? As another nit - with rmb() in and because you are looking the first gap in= s[] now, no need to read TXDs in backward order. How it looks to me (as a suggestion): for (j =3D 0; j !=3D LOOK_AHEAD; j++) s[j] =3D rte_le_to_cpu_32(rxdp[j].wb.upper.status_error); rte_smp_rmb(); for (j =3D 0; j < LOOK_AHEAD && (s[j] & IXGBE_RXDADV_STAT_DD) !=3D 0; j++) ; for (j =3D 0; j < nb_dd; ++j) { pkt_info[j] =3D rte_le_to_cpu_32(rxdp[j].wb.lower.lo_dword.data); .... Konstantin >=20 > /* Compute how many status bits were set */ > nb_dd =3D 0; > for (j =3D 0; j < LOOK_AHEAD; ++j) > - nb_dd +=3D s[j] & IXGBE_RXDADV_STAT_DD; > + if (s[j] & IXGBE_RXDADV_STAT_DD) > + ++nb_dd; > + else > + break; >=20 > nb_rx +=3D nb_dd; >=20 > -- > 2.4.11