From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id DEE02A058B; Wed, 25 Mar 2020 17:14:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3F5EF1BFA6; Wed, 25 Mar 2020 17:14:36 +0100 (CET) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40081.outbound.protection.outlook.com [40.107.4.81]) by dpdk.org (Postfix) with ESMTP id 247A41BE8A for ; Wed, 25 Mar 2020 17:14:35 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NlOmc1eJRbm1iv9DeATFHC1xwBptuXcD4YOi+QhRmfLEtuzGKaw7i8iPHowYWHsW7OeJ1gRsHyG1ebnQ3Lgo83uiiF090Sux1KU1Q5yOIeI10AK7uOl4/PrvArB/d45re16WlUK5sEzAHOvT39CBky9Q1/PJeIR+popEvxBLtSg9TXbU/fOaKCwNvCf2k/mrnCzEzYRoIfKc+/N1spuVSX90WyD7TmCRmf/GNDSboj2nwiOTDAK7yMNcZNSnDAOPsRgNu1ldXbaA9MsTBOD0B383G3tB8zfAacPo8vBZAAzIJ6KxeVF7mMjrtkxPgeWGAJ4RWqBxj5bJYFJ05IgQHA== 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-SenderADCheck; bh=gvxv2V1oe/vZZ25oSjb5gdqb5Jyejph1KmGiHqvCrnk=; b=VNjSl0ssJHZ7WRnEdK/GfSZQjPNERfabE2sA8gFvKqx/pQtT5gcg4Q6q1vjl7V5JTX9mUcN5IYnpnj3Kn4Ik0HjzKHE2f/QfefxuNV6N3E3FvGHUOPbDe0i1SC22JgyPyBqNTohE46jEulrQ3mI8f8rqOTBn4Zo7nvlgqHdRSDPv3eVl8Nai5C92+EvhBZUX6xBBftUmO4CyZqSLBN9ANbt2Z+kacDQ+7WucExkYhFAlacSyoQZEWNbgs6E0bCPGRSI2qm68++5pe7TjqDQVhMat4RARWHuyCgNhszT3PC/0jKoz5Vkbokl5VyxkErv/vOfHz5IL3Y9pD1odNqy6zQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gvxv2V1oe/vZZ25oSjb5gdqb5Jyejph1KmGiHqvCrnk=; b=od1G06DqzD1d7HZcGNBpMoY2z0ce7R2kYE4w4rVR+kZUASefH2Nm8X0f9dpMMUZ8BZQ35vfCAaMPFHY0sYEMYaqAZgywxiqgT1mKcabYWcO+acYLUFkWN+2yYmg5IjPbnQF+JJDlrnkkJ0rkVEGUsIgrekZV3SiwmZwqrs+GPOk= Received: from AM0PR05MB6707.eurprd05.prod.outlook.com (10.186.174.145) by AM0PR05MB6050.eurprd05.prod.outlook.com (20.178.118.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.18; Wed, 25 Mar 2020 16:14:33 +0000 Received: from AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9]) by AM0PR05MB6707.eurprd05.prod.outlook.com ([fe80::adbd:45ca:54:bba9%7]) with mapi id 15.20.2835.023; Wed, 25 Mar 2020 16:14:33 +0000 From: Raslan Darawsheh To: Alexander Kozyrev , "dev@dpdk.org" CC: Matan Azrad , Slava Ovsiienko Thread-Topic: [PATCH] net/mlx5: prefetch CQEs for a faster decompression Thread-Index: AQHWAer3Zoe4Y5mbdUCk0fB3M7kuZKhZfQkw Date: Wed, 25 Mar 2020 16:14:33 +0000 Message-ID: References: <20200324144530.25426-1-akozyrev@mellanox.com> In-Reply-To: <20200324144530.25426-1-akozyrev@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=rasland@mellanox.com; x-originating-ip: [188.161.229.130] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 16b0e323-7ed6-4199-bbb6-08d7d0d79b10 x-ms-traffictypediagnostic: AM0PR05MB6050:|AM0PR05MB6050: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:5236; x-forefront-prvs: 0353563E2B x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(396003)(136003)(366004)(346002)(39860400002)(376002)(5660300002)(33656002)(86362001)(107886003)(8676002)(478600001)(66946007)(66476007)(76116006)(66556008)(64756008)(66446008)(52536014)(81156014)(7696005)(81166006)(186003)(4326008)(71200400001)(26005)(55016002)(54906003)(110136005)(8936002)(2906002)(6506007)(53546011)(9686003)(316002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR05MB6050; H:AM0PR05MB6707.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 8Psat8Nu+8lnBTr5oLSpMBIfr8yRbfN3Sdg+PTCx0viPUNzY/5FfoY6KTjDIUSpEy6kot9hfuQqRYjUgTmCW/Rfi0ZVOPltCITgvnHsQHIxaEbTRjxu1215zQOnNfrx93yYz5m8SL/n3VfG9Ry7ToPsf1TnKeXmcxAPYu1ohuIQKvB8FHHmRwuG6P3k5OV/ZMpE4bQP/69uIpZb688dRsgXzB+57x8gFeoga0oXqPRi0PDGBvuc9cd7B3oW9uO4abkvM3y1giJHBp7YbWA15jvR7gy0hZYP8RTyM8xZnHpgnDoVSfkwpfydYyUlfCkU5oYhX03mdJC1c+XoTfpogtA56QQ/xAKx/lb9NDgCmcav6Jtg5gs4TAlAlZyz6vwS0yzdfwQyc6SoVwNwGII/eX5wfVzrnUEaiHoRBvNEgY2AjDg24VQV1LL/UCVTNRPV+ x-ms-exchange-antispam-messagedata: IrQWtBy27FEsf9kTemrTNh7SUUJaGNEqfr8ldS3gGtnaE9V90Cc3Nd+0ipLF79iiapzzVzVrDY0476rSgvC4f8Yi2nKfo0mJf5snCrADVbgTyf5h9owDttXr0opWdJiOSoL0fEfyCXlwIxJNj0CR+w== Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 16b0e323-7ed6-4199-bbb6-08d7d0d79b10 X-MS-Exchange-CrossTenant-originalarrivaltime: 25 Mar 2020 16:14:33.2702 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: mFyOTNIB1dXR1zuWmHJFf1DxJfBQxr+A1Anpl8032yOhjmTdgKfRquGzpGBFd4hTelRVTe/PfuqNok22Uwao6w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB6050 Subject: Re: [dpdk-dev] [PATCH] net/mlx5: prefetch CQEs for a faster decompression 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi, > -----Original Message----- > From: Alexander Kozyrev > Sent: Tuesday, March 24, 2020 4:46 PM > To: dev@dpdk.org > Cc: Raslan Darawsheh ; Matan Azrad > ; Slava Ovsiienko > Subject: [PATCH] net/mlx5: prefetch CQEs for a faster decompression >=20 > Invalidation of consumed CQEs incurs a performance penalty > due to many cache misses caused by a non-sequential CQEs access. > Prefetch CQEs to get a better data locality and speed up the > decompression of CQEs. Prefetching reduces CPI rate of the > rxq_cq_decompress_v() function from 1 to 0.85 in my environment, > resulting in 2% boost in mpps for 64B frames single core test. >=20 > Signed-off-by: Alexander Kozyrev > Acked-by: Viacheslav Ovsiienko > --- > drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 5 +++-- > drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 6 +++--- > drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 6 ++++-- > 3 files changed, 10 insertions(+), 7 deletions(-) >=20 > diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h > b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h > index aa43cab084..90548ea22d 100644 > --- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h > +++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h > @@ -155,8 +155,9 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, > volatile struct mlx5_cqe *cq, > const vector unsigned long shmax =3D {64, 64}; > #endif >=20 > - if (!(pos & 0x7) && pos + 8 < mcqe_n) > - rte_prefetch0((void *)(cq + pos + 8)); > + for (i =3D 0; i < MLX5_VPMD_DESCS_PER_LOOP; ++i) > + if (likely(pos + i < mcqe_n)) > + rte_prefetch0((void *)(cq + pos + i)); >=20 > /* A.1 load mCQEs into a 128bit register. */ > mcqe1 =3D (vector unsigned char)vec_vsx_ld(0, > diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h > b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h > index 6d952df787..44f662e1c1 100644 > --- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h > +++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h > @@ -145,9 +145,9 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, > volatile struct mlx5_cqe *cq, > -1UL << ((mcqe_n - pos) * > sizeof(uint16_t) * 8) : 0); > #endif > - > - if (!(pos & 0x7) && pos + 8 < mcqe_n) > - rte_prefetch0((void *)(cq + pos + 8)); > + for (i =3D 0; i < MLX5_VPMD_DESCS_PER_LOOP; ++i) > + if (likely(pos + i < mcqe_n)) > + rte_prefetch0((void *)(cq + pos + i)); > __asm__ volatile ( > /* A.1 load mCQEs into a 128bit register. */ > "ld1 {v16.16b - v17.16b}, [%[mcq]] \n\t" > diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h > b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h > index 406f23f595..9db9003acd 100644 > --- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h > +++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h > @@ -133,8 +133,10 @@ rxq_cq_decompress_v(struct mlx5_rxq_data *rxq, > volatile struct mlx5_cqe *cq, > __m128i byte_cnt, invalid_mask; > #endif >=20 > - if (!(pos & 0x7) && pos + 8 < mcqe_n) > - rte_prefetch0((void *)(cq + pos + 8)); > + for (i =3D 0; i < MLX5_VPMD_DESCS_PER_LOOP; ++i) > + if (likely(pos + i < mcqe_n)) > + rte_prefetch0((void *)(cq + pos + i)); > + > /* A.1 load mCQEs into a 128bit register. */ > mcqe1 =3D _mm_loadu_si128((__m128i *)&mcq[pos % 8]); > mcqe2 =3D _mm_loadu_si128((__m128i *)&mcq[pos % 8 + 2]); > -- > 2.18.2 Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh