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 593D142A08; Thu, 27 Apr 2023 09:38:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D65E142B8C; Thu, 27 Apr 2023 09:38:05 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 446D442670 for ; Thu, 27 Apr 2023 09:38:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1682581083; x=1714117083; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=dCsR4K/JerxHhErXcZ0hW9HwpLYh+xZ8Y/FvWQqBlso=; b=PTqwO1wZDQ3IE9eTwNxjKFGlzhzLFOJ+erztyGLJZt0nVNfyXfAicGOl xOULmfMdNFKdVLmHmrm2o1cBFz/7Sds852QCMX7oBG0eWwLbWZKlG5H1A zVbYuYK2aHr94OlD+WfuIN72NqBvuSw6p7mklbBWRsJbza8KnjagkiwtO bqIy04aqxFVcJczJMjXPI/udFbehcT8Amsay5tld+blrlHxIVKKchfoGR wd4mkBDMTQYx5IFXNNJu2yDKlNOWuC17snXGP9JujHGyESKc4G5da36cn sjk9OWLv+2o3/hbSTRsDJQookMCJQOb75ycvRvWIGnGNr2iIm34Lw1mLN g==; X-IronPort-AV: E=McAfee;i="6600,9927,10692"; a="326965271" X-IronPort-AV: E=Sophos;i="5.99,230,1677571200"; d="scan'208";a="326965271" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Apr 2023 00:38:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10692"; a="644589153" X-IronPort-AV: E=Sophos;i="5.99,230,1677571200"; d="scan'208";a="644589153" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orsmga003.jf.intel.com with ESMTP; 27 Apr 2023 00:38:01 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 27 Apr 2023 00:38:00 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23 via Frontend Transport; Thu, 27 Apr 2023 00:38:00 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.43) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.23; Thu, 27 Apr 2023 00:38:00 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EsG/uSp18Gl/kiHOW0Ya7NOs+qLMzNodCkZpWyBlWjMVb6Vvba/H5KsUdKhBY/0b1IW4DUGcSn0RUfvzBe03hjaMLG5qX5HN0U0aaFh3L7zfqFA00Dn3WrYUisOtPSdmKoYSe8vTuFQvS/nNaXc6b01UBmKhceVRQb88lvGvIOvzIgu1mlxF2ezfoGx+eFG1LTNipmWyON0OTXbMpPeG2h4JGKKuBfSD/Te2sRXz7O3XlLOmuccrzo5XTVSue2wsz2ipH9Vz3wNB7vF14ESxOdHDxC0nEv2/svedjtiaZqYw6qq0CgmziTQY6lcDjBEkyjys20Fu/3AC79wiOgwlcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zeFwZcln6jq563yQ7Kd02WenABXmXDHVftCwuGUNp5I=; b=RzmgGgokpGIRDnbg2Te7V4FFwJjOp1FUf9KE2Xl06eO4i5Lw+jjnFHLeLcEGtAIwNRG4ha1wC7WeF+9oo3sD1jat7LkIBTSr7/Mczt/rW5CBNjn7wcSzpNNoCT0KIdi6B70vxiErRyEw4cQGFNHv5JJysV2hxJGziCoEwA4Yceapcp/UKypRbb3ayS69eNIPSqTy6XW5YReqU2C6frJhN5Gomszs3L46NyoEWEpNvPnzoFhVdcybh0rFqYo3j3zRlnWZP0pMAj/U8u0Uz0U+kRB5amIV7AvTVoArK8rPczMyGTWWwZa6BQI243O5P9lyHuZ2w76bcMrdWNKVaUq/0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from PH7PR11MB5982.namprd11.prod.outlook.com (2603:10b6:510:1e1::20) by PH0PR11MB7564.namprd11.prod.outlook.com (2603:10b6:510:288::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6319.33; Thu, 27 Apr 2023 07:37:53 +0000 Received: from PH7PR11MB5982.namprd11.prod.outlook.com ([fe80::385:196f:787e:822f]) by PH7PR11MB5982.namprd11.prod.outlook.com ([fe80::385:196f:787e:822f%6]) with mapi id 15.20.6340.021; Thu, 27 Apr 2023 07:37:53 +0000 From: "Zhang, Qi Z" To: Feifei Wang , "Richardson, Bruce" , Konstantin Ananyev , "Zhang, Yuying" , "Xing, Beilei" , David Christensen , Ruifeng Wang CC: "dev@dpdk.org" , "nd@arm.com" , "Honnappa Nagarahalli" Subject: RE: [PATCH v2] net/i40e: remove redundant judgment Thread-Topic: [PATCH v2] net/i40e: remove redundant judgment Thread-Index: AQHZYUb6pZ3945Elkku6Wif5jzf/xa8+8XYw Date: Thu, 27 Apr 2023 07:37:53 +0000 Message-ID: References: <20211220054246.4031616-1-feifei.wang2@arm.com> <20230328072828.386576-1-feifei.wang2@arm.com> In-Reply-To: <20230328072828.386576-1-feifei.wang2@arm.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PH7PR11MB5982:EE_|PH0PR11MB7564:EE_ x-ms-office365-filtering-correlation-id: b5210f0b-d401-4a7c-81fe-08db46f24f6a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: FpchvIXXChT043QUJHzaMIKVH3ezjlJDETJqS4RAhWpdXiikZJkI+9cpkbvi18iFCQ+75H5XvbTOR4uUIDXBBLWrV+S0EMd5yU8jGXd3oec5olFyLXoYxEmy+4yuiLM1ukwVbZk70nmB4XGlELYnzw7G671Q0ruPSTWb0LzhyjM4+WP3WKbxPT0QQKDtYHzBUcmKoXV16H0TKPlNp4BcVPsXbR6fiHsFvdAFhsrziBRxq2APJ+bqzBc3GWTs5o4r6U1gWF8VYFLS0CJUqk+7fsSdUxgOQSU0KJjxH+FGFxj0PVGDJzNAiKcI4+nE1ugNRxRVagdvgyukbNFZIIykzN+fzBupcLeP7rQQjobRrWRc53OmjjokRgJaN6lDolrjglv1HehZf51Fa5rrS1/Wl65NkXKjyrXRezWD8SxcJhwE84O3t5EhwZiPiYisKCfUJ/zHQDSFFcROOdYR+sVnK0DKWt+QpGs6xES/JKK9zLQO757n1XnN+8ErpPbUt8HjZJfqNoHfZY9e0biluoe7dNwokuVFmUDav0QbmeOlK+oDgBEV9COA62+V9AByEoP1TmrWiFC5p67FRWFzR4vlO/QfcpkR6ntajtUjBhZGl4nlxwV/rRAoRBoUwPrxKoZIo3vR2c6OJygXQAO2xCgjYA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR11MB5982.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(39860400002)(136003)(346002)(376002)(366004)(396003)(451199021)(186003)(9686003)(2906002)(41300700001)(110136005)(6506007)(53546011)(4326008)(26005)(38070700005)(83380400001)(86362001)(54906003)(33656002)(71200400001)(52536014)(7696005)(66556008)(5660300002)(8676002)(8936002)(82960400001)(921005)(316002)(122000001)(478600001)(38100700002)(55016003)(66946007)(66476007)(64756008)(66446008)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?gWmH3SSsk4LoYjNwZZNv56WMXtgoyK+wSTOh/YBuAEHJnUwaXFjzt5a7eCZN?= =?us-ascii?Q?Jk6ozSGRBnHuocdeHI0PJwk23Acg7GuYHHUha/+fOKTAdBFLXQbM0F4yJMie?= =?us-ascii?Q?AjeZ0CC4Ll7Tqv8mc6AZt3e2KRkQaa9PveEJOvX+wW0YedTi3BF3dM9rX1cb?= =?us-ascii?Q?BtgCWGbEQbpRVgokkbV8AuRT0ziq0E4Z7+z0+M/b2weu4pjc/m5qegxrwGZI?= =?us-ascii?Q?yhUEO0pLPiXL67xTdKS9r3lknEIE3R4PcW1CdZ/0l6bypk11e4JgRLXSBAZW?= =?us-ascii?Q?eqXNft3OaBKPqu3ZToLOEDvPjdunRcPt0RedprNzcYzfI6CU8jv3TFF5vzWz?= =?us-ascii?Q?bAzdNC8BcGU8hvnpcpK6xZbDB8fURjW7AlU6hK5U+uQuX8rbuHC1Zw3sVPX0?= =?us-ascii?Q?JItJ86lGxQtfDphJuwYD7grIk/iiKeC3v2qzzD7X39S5VjKdb01dOaji9DYL?= =?us-ascii?Q?9V8zN3mAskftAuoLks/QTCIU6rBpRjLWNscwStn7KhQcTcQWnR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cPzRZdcQ/zv/JiaDzM5P7PSukYXpSy3TLWcu+pcneT7Xh8?= =?us-ascii?Q?37aB/h+fQj1XNXoI97BMeAwaHevviKZW6SDDcoEcV/8XPQpK3cFrGZNr4Gcg?= =?us-ascii?Q?7OJIkGNbYr6u2Pl3e00OgWc8XLwb7nk/7Lbo6VH+tAIDzR99HWj/ZyyVy1oE?= =?us-ascii?Q?0wjHLslBvoM14xmnH+GIPAZapxNnUhhm5u4wIudh?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PH7PR11MB5982.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5210f0b-d401-4a7c-81fe-08db46f24f6a X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Apr 2023 07:37:53.1164 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eDOWLE+9dfrgJRFGG39i3H2wVZvkxLX2XxylV2sP2Etmp6P/Je1AmZRlXO8rBPexPl0+gVhbOXdtBbK1BI1tJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR11MB7564 X-OriginatorOrg: intel.com 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 > -----Original Message----- > From: Feifei Wang > Sent: Tuesday, March 28, 2023 3:28 PM > To: Richardson, Bruce ; Konstantin Ananyev > ; Zhang, Yuying > ; Xing, Beilei ; David > Christensen ; Ruifeng Wang > > Cc: dev@dpdk.org; nd@arm.com; Feifei Wang ; > Honnappa Nagarahalli > Subject: [PATCH v2] net/i40e: remove redundant judgment >=20 > Merged variable updates under the same condition. It reduces branch. >=20 > In ampere-altra, there is no performance improvement with this patch. > In x86 sse and avx2 path, there is also no performance improvement. Thanks for sharing the results. While the code implements some best practic= es, such as reducing branching and adding compiler hints, which should gene= rally improve performance, it's not necessary to highlight that it didn't p= rovide benefits on certain specific platforms. Would it be ok to remove the last two lines when merging the patch? Otherwise Acked-by: Qi Zhang >=20 >=20 > v2: > 1. add change for avx and altivec path. >=20 > Suggested-by: Honnappa Nagarahalli > Signed-off-by: Feifei Wang > Reviewed-by: Ruifeng Wang > --- > drivers/net/i40e/i40e_rxtx_common_avx.h | 9 +++++---- > drivers/net/i40e/i40e_rxtx_vec_altivec.c | 9 +++++---- > drivers/net/i40e/i40e_rxtx_vec_neon.c | 9 +++++---- > drivers/net/i40e/i40e_rxtx_vec_sse.c | 9 +++++---- > 4 files changed, 20 insertions(+), 16 deletions(-) >=20 > diff --git a/drivers/net/i40e/i40e_rxtx_common_avx.h > b/drivers/net/i40e/i40e_rxtx_common_avx.h > index cfc1e63173..85958d6c81 100644 > --- a/drivers/net/i40e/i40e_rxtx_common_avx.h > +++ b/drivers/net/i40e/i40e_rxtx_common_avx.h > @@ -198,14 +198,15 @@ i40e_rxq_rearm_common(struct i40e_rx_queue > *rxq, __rte_unused bool avx512) #endif >=20 > rxq->rxrearm_start +=3D RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >=3D rxq->nb_rx_desc) > + rx_id =3D rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >=3D rxq->nb_rx_desc)) { > rxq->rxrearm_start =3D 0; > + rx_id =3D rxq->nb_rx_desc - 1; > + } >=20 > rxq->rxrearm_nb -=3D RTE_I40E_RXQ_REARM_THRESH; >=20 > - rx_id =3D (uint16_t)((rxq->rxrearm_start =3D=3D 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } diff --git > a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > index 2dfa04599c..8672ad1c41 100644 > --- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c > +++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c > @@ -89,14 +89,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > } >=20 > rxq->rxrearm_start +=3D RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >=3D rxq->nb_rx_desc) > + rx_id =3D rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >=3D rxq->nb_rx_desc)) { > rxq->rxrearm_start =3D 0; > + rx_id =3D rxq->nb_rx_desc - 1; > + } >=20 > rxq->rxrearm_nb -=3D RTE_I40E_RXQ_REARM_THRESH; >=20 > - rx_id =3D (uint16_t)((rxq->rxrearm_start =3D=3D 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WRITE(rxq->qrx_tail, rx_id); } diff --git > a/drivers/net/i40e/i40e_rxtx_vec_neon.c > b/drivers/net/i40e/i40e_rxtx_vec_neon.c > index 12e6f1cbcb..49391fe4c7 100644 > --- a/drivers/net/i40e/i40e_rxtx_vec_neon.c > +++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c > @@ -64,14 +64,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > } >=20 > rxq->rxrearm_start +=3D RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >=3D rxq->nb_rx_desc) > + rx_id =3D rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >=3D rxq->nb_rx_desc)) { > rxq->rxrearm_start =3D 0; > + rx_id =3D rxq->nb_rx_desc - 1; > + } >=20 > rxq->rxrearm_nb -=3D RTE_I40E_RXQ_REARM_THRESH; >=20 > - rx_id =3D (uint16_t)((rxq->rxrearm_start =3D=3D 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > rte_io_wmb(); > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WRITE_RELAXED(rxq->qrx_tail, rx_id); diff --git > a/drivers/net/i40e/i40e_rxtx_vec_sse.c > b/drivers/net/i40e/i40e_rxtx_vec_sse.c > index bdc979a839..baf83cb3df 100644 > --- a/drivers/net/i40e/i40e_rxtx_vec_sse.c > +++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c > @@ -77,14 +77,15 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) > } >=20 > rxq->rxrearm_start +=3D RTE_I40E_RXQ_REARM_THRESH; > - if (rxq->rxrearm_start >=3D rxq->nb_rx_desc) > + rx_id =3D rxq->rxrearm_start - 1; > + > + if (unlikely(rxq->rxrearm_start >=3D rxq->nb_rx_desc)) { > rxq->rxrearm_start =3D 0; > + rx_id =3D rxq->nb_rx_desc - 1; > + } >=20 > rxq->rxrearm_nb -=3D RTE_I40E_RXQ_REARM_THRESH; >=20 > - rx_id =3D (uint16_t)((rxq->rxrearm_start =3D=3D 0) ? > - (rxq->nb_rx_desc - 1) : (rxq->rxrearm_start - 1)); > - > /* Update the tail pointer on the NIC */ > I40E_PCI_REG_WC_WRITE(rxq->qrx_tail, rx_id); } > -- > 2.25.1