From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0066.outbound.protection.outlook.com [104.47.0.66]) by dpdk.org (Postfix) with ESMTP id A58232BEA for ; Fri, 7 Oct 2016 09:06:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=ERfVD5j8UwPG9wQmcRGRtUWZY2r6d0GF+yW1CK5lT+g=; b=K/8wkbGUsH2RcCz3pEjvprMEYZLk8hY70GY/fb223pqW8JmBlUcVGQBRKhYZr/ctfuUQy2ghKYyBngSoJ1J8/ff6xkgWXgyRd7n/96bO4YWK/WumtTDwMBZLsU+YHQZahuyxcZL0zsuS91ioql+5sEytQ8unZib2sTb3IUEtaYQ= Received: from DB5PR04MB1605.eurprd04.prod.outlook.com (10.164.38.147) by DB5PR04MB1606.eurprd04.prod.outlook.com (10.164.38.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.659.8; Fri, 7 Oct 2016 07:06:19 +0000 Received: from DB5PR04MB1605.eurprd04.prod.outlook.com ([10.164.38.147]) by DB5PR04MB1605.eurprd04.prod.outlook.com ([10.164.38.147]) with mapi id 15.01.0659.014; Fri, 7 Oct 2016 07:06:19 +0000 From: Hemant Agrawal To: Jerin Jacob CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH] examples/l3fwd: em path hash offload to machine Thread-Index: AQHR/R+dpc03OKCKh0u6afquvTD5BqCaA7mAgALUgoA= Date: Fri, 7 Oct 2016 07:06:18 +0000 Message-ID: References: <1471964080-29958-1-git-send-email-hemant.agrawal@nxp.com> <20161005115243.GA7027@localhost.localdomain> In-Reply-To: <20161005115243.GA7027@localhost.localdomain> 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=hemant.agrawal@nxp.com; x-originating-ip: [192.88.169.1] x-ms-office365-filtering-correlation-id: 38be98d5-2496-498d-ff15-08d3ee80700c x-microsoft-exchange-diagnostics: 1; DB5PR04MB1606; 6:FoFtgMIgcu2oE7nKYT7N7szZwlem1b5ERqlaX4P6dRDk2Kp0J4IXPEfyORtbGge0UYGP7H3db7Hu+ZTHxXkucZ/X7rT1VKmMmJlKUDrPtWdYu+IeEyrEdplhVhdhHTUstbDwKCnWV/JZiga8MUwp5UdTbnyLd6gBaVKcdDknFONt+ul3MVMati+B+MTlrG31WKPtC6oMqWyXvVWQlbNwJTKE38sWPCGy9K3Fyo1+XFi40vf8ucI38jjnyVAi3marKNyXS1SY5WOmy+ubAMMHp0OjvFDUhRBm69lovPi0niY7rtYU5GG2A2On6c9/gwiilXSGo2/MTR7RIxoOBlhNyw==; 5:y0eUwCO5CGaKoKIX+LW2ROb1JJeFxP3u9m6yqiD9XUqxkObtshVhH068C7G9xb1w4ovJooNQFUuOWDEwgO5rJfIiZinjh4nNSR+sQpus9MuoxjHESIYLJa6lZ0GPTVf7rZu9xXIRo256OV1w9epGjQdPwZ4wn9iZ+2CSYFu/NLc=; 24:X/mRNSj5zFtrubfG7bOoD7QtYwftlXID1gAtNFMGH7gErR4irdRcWwq68TES/l8xgYwJtfTe+L30kGLLLhfrBRXHDL4t9P3N2lTUidIrXcE=; 7:R9alPv327j5rQ5RreNjuvuk1YSe2r4deumTgJHFQMcv8b7LXmBRRo+JgQyqep0QwhAYCzv1Uf4RimZ0gdlvhwiIWSN8m73EXNnOPJtiEH4JQo7R33xQJ5NVPgWrdgnVrZJ9KtVfDemoZCNkpndeCJ1dVaym5EZlvBJtCv0lu5ua65QKgvzKXriENuSqNhuSQYMmfvz7Fh1DM9CYMjUldnM3yiKiihpDRtjjyq5qzWOfNaot9qrCHWXfwmR5H8pRnj/ioraX+OHz+qYVAGEc9im8rZzuis4U9/Erj8DJikp4GEXAGIrE/vC64evhLSh7Q x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR04MB1606; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:DB5PR04MB1606; BCL:0; PCL:0; RULEID:; SRVR:DB5PR04MB1606; x-forefront-prvs: 0088C92887 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(189002)(377454003)(199003)(51914003)(13464003)(24454002)(3280700002)(76176999)(50986999)(189998001)(3846002)(586003)(6116002)(102836003)(7846002)(7736002)(101416001)(2906002)(122556002)(3660700001)(2900100001)(87936001)(11100500001)(5002640100001)(92566002)(68736007)(8936002)(19580395003)(19580405001)(97736004)(4326007)(66066001)(33656002)(86362001)(7696004)(76576001)(54356999)(6916009)(110136003)(9686002)(2950100002)(305945005)(106116001)(105586002)(81166006)(81156014)(5660300001)(106356001)(77096005)(74316002)(10400500002)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:DB5PR04MB1606; H:DB5PR04MB1605.eurprd04.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2016 07:06:19.0134 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR04MB1606 Subject: Re: [dpdk-dev] [PATCH] examples/l3fwd: em path hash offload to machine 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: Fri, 07 Oct 2016 07:06:21 -0000 Hi Jerin, Thanks for the review, I will send a v2 with the suggestions made Regards, Hemant > -----Original Message----- > From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com] > Sent: Wednesday, October 05, 2016 5:23 PM > To: Hemant Agrawal > Cc: dev@dpdk.org > Subject: Re: [dpdk-dev] [PATCH] examples/l3fwd: em path hash offload to > machine >=20 > On Tue, Aug 23, 2016 at 08:24:39PM +0530, Hemant Agrawal wrote: >=20 > Maybe you can change the subject line to: > examples/l3fwd: em: use hw accelerated crc hash function for arm64 instea= d of: > examples/l3fwd: em path hash offload to machine >=20 > > if machine level CRC extension are available, offload the hash to > > machine provided functions e.g. armv8-a CRC extensions support it > > > > Signed-off-by: Hemant Agrawal > > --- > > examples/l3fwd/l3fwd_em.c | 20 ++++++++++---------- > > 1 file changed, 10 insertions(+), 10 deletions(-) > > > > diff --git a/examples/l3fwd/l3fwd_em.c b/examples/l3fwd/l3fwd_em.c > > index def5a02..a889c67 100644 > > --- a/examples/l3fwd/l3fwd_em.c > > +++ b/examples/l3fwd/l3fwd_em.c > > @@ -58,13 +58,13 @@ > > > > #include "l3fwd.h" > > > > -#ifdef RTE_MACHINE_CPUFLAG_SSE4_2 > > +#if defined(RTE_MACHINE_CPUFLAG_SSE4_2) || > > +defined(RTE_MACHINE_CPUFLAG_CRC32) >=20 > Rather than adding new compilation flag everywhere, Maybe you can add >=20 > #if defined(RTE_MACHINE_CPUFLAG_SSE4_2) && > defined(RTE_MACHINE_CPUFLAG_CRC32) > #define EM_HASH_CRC 1 > #endif >=20 > something like above to reduce the change for future platforms with crc > support. >=20 > Other than that, you can add: > Reviewed-by: Jerin Jacob >=20 > > #include > > #define DEFAULT_HASH_FUNC rte_hash_crc > > #else > > #include > > #define DEFAULT_HASH_FUNC rte_jhash > > -#endif /* RTE_MACHINE_CPUFLAG_SSE4_2 */ > > +#endif > > > > #define IPV6_ADDR_LEN 16 > > > > @@ -169,17 +169,17 @@ ipv4_hash_crc(const void *data, __rte_unused > uint32_t data_len, > > t =3D k->proto; > > p =3D (const uint32_t *)&k->port_src; > > > > -#ifdef RTE_MACHINE_CPUFLAG_SSE4_2 > > +#if defined(RTE_MACHINE_CPUFLAG_SSE4_2) || > > +defined(RTE_MACHINE_CPUFLAG_CRC32) > > init_val =3D rte_hash_crc_4byte(t, init_val); > > init_val =3D rte_hash_crc_4byte(k->ip_src, init_val); > > init_val =3D rte_hash_crc_4byte(k->ip_dst, init_val); > > init_val =3D rte_hash_crc_4byte(*p, init_val); -#else /* > > RTE_MACHINE_CPUFLAG_SSE4_2 */ > > +#else > > init_val =3D rte_jhash_1word(t, init_val); > > init_val =3D rte_jhash_1word(k->ip_src, init_val); > > init_val =3D rte_jhash_1word(k->ip_dst, init_val); > > init_val =3D rte_jhash_1word(*p, init_val); -#endif /* > > RTE_MACHINE_CPUFLAG_SSE4_2 */ > > +#endif > > > > return init_val; > > } > > @@ -191,16 +191,16 @@ ipv6_hash_crc(const void *data, __rte_unused > uint32_t data_len, > > const union ipv6_5tuple_host *k; > > uint32_t t; > > const uint32_t *p; > > -#ifdef RTE_MACHINE_CPUFLAG_SSE4_2 > > +#if defined(RTE_MACHINE_CPUFLAG_SSE4_2) || > > +defined(RTE_MACHINE_CPUFLAG_CRC32) > > const uint32_t *ip_src0, *ip_src1, *ip_src2, *ip_src3; > > const uint32_t *ip_dst0, *ip_dst1, *ip_dst2, *ip_dst3; -#endif /* > > RTE_MACHINE_CPUFLAG_SSE4_2 */ > > +#endif > > > > k =3D data; > > t =3D k->proto; > > p =3D (const uint32_t *)&k->port_src; > > > > -#ifdef RTE_MACHINE_CPUFLAG_SSE4_2 > > +#if defined(RTE_MACHINE_CPUFLAG_SSE4_2) || > > +defined(RTE_MACHINE_CPUFLAG_CRC32) > > ip_src0 =3D (const uint32_t *) k->ip_src; > > ip_src1 =3D (const uint32_t *)(k->ip_src+4); > > ip_src2 =3D (const uint32_t *)(k->ip_src+8); @@ -219,14 +219,14 @@ > > ipv6_hash_crc(const void *data, __rte_unused uint32_t data_len, > > init_val =3D rte_hash_crc_4byte(*ip_dst2, init_val); > > init_val =3D rte_hash_crc_4byte(*ip_dst3, init_val); > > init_val =3D rte_hash_crc_4byte(*p, init_val); -#else /* > > RTE_MACHINE_CPUFLAG_SSE4_2 */ > > +#else > > init_val =3D rte_jhash_1word(t, init_val); > > init_val =3D rte_jhash(k->ip_src, > > sizeof(uint8_t) * IPV6_ADDR_LEN, init_val); > > init_val =3D rte_jhash(k->ip_dst, > > sizeof(uint8_t) * IPV6_ADDR_LEN, init_val); > > init_val =3D rte_jhash_1word(*p, init_val); -#endif /* > > RTE_MACHINE_CPUFLAG_SSE4_2 */ > > +#endif > > return init_val; > > } > > > > -- > > 1.9.1 > >