From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 9E47998 for ; Sat, 4 Feb 2017 14:26:22 +0100 (CET) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga105.fm.intel.com with ESMTP; 04 Feb 2017 05:26:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,333,1477983600"; d="scan'208";a="221299238" Received: from irsmsx102.ger.corp.intel.com ([163.33.3.155]) by fmsmga004.fm.intel.com with ESMTP; 04 Feb 2017 05:26:20 -0800 Received: from irsmsx105.ger.corp.intel.com ([169.254.7.38]) by IRSMSX102.ger.corp.intel.com ([169.254.2.230]) with mapi id 14.03.0248.002; Sat, 4 Feb 2017 13:26:19 +0000 From: "Ananyev, Konstantin" To: Jianbo Liu , "dev@dpdk.org" , "Zhang, Helin" , "jerin.jacob@caviumnetworks.com" Thread-Topic: [PATCH v2 1/2] net/ixgbe: calculate the correct number of received packets in bulk alloc function Thread-Index: AQHSfspPXOE8A/6OI0iGKLtZsKL0AqFY1rxg Date: Sat, 4 Feb 2017 13:26:18 +0000 Message-ID: <2601191342CEEE43887BDE71AB9772583F110DC7@irsmsx105.ger.corp.intel.com> References: <1482127758-4904-1-git-send-email-jianbo.liu@linaro.org> <1486201024-32656-1-git-send-email-jianbo.liu@linaro.org> In-Reply-To: <1486201024-32656-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 v2 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: Sat, 04 Feb 2017 13:26:23 -0000 >=20 > To get better performance, Rx bulk alloc recv function will scan 8 descs > 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 scan 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 | 16 +++++++++------- > 1 file changed, 9 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxt= x.c > index 36f1c02..613890e 100644 > --- a/drivers/net/ixgbe/ixgbe_rxtx.c > +++ b/drivers/net/ixgbe/ixgbe_rxtx.c > @@ -1460,17 +1460,19 @@ static inline int __attribute__((always_inline)) > 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 0; j < LOOK_AHEAD; j++) > s[j] =3D rte_le_to_cpu_32(rxdp[j].wb.upper.status_error); >=20 > - 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(); >=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; > + for (nb_dd =3D 0; nb_dd < LOOK_AHEAD && > + (s[nb_dd] & IXGBE_RXDADV_STAT_DD); nb_dd++) > + ; > + > + for (j =3D 0; j < nb_dd; j++) > + pkt_info[j] =3D rte_le_to_cpu_32(rxdp[j].wb.lower. > + lo_dword.data); >=20 > nb_rx +=3D nb_dd; >=20 > -- Acked-by: Konstantin Ananyev > 1.8.3.1