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 E6109A0350; Mon, 11 May 2020 12:23:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7F5591C129; Mon, 11 May 2020 12:23:31 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 71D201BFE2 for ; Mon, 11 May 2020 12:23:30 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 04BAFZBR011674; Mon, 11 May 2020 03:23:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pfpt0818; bh=wi6Rv3ClNLEEOCxvUDzwnCIfAY39RkUuqgaSlOxoTnM=; b=lnekiZGBzwEzmavqR4RehOunaeYpTTZqXX0HN3rG9CmY+aD4tS0rJu9Vp0PRUCgKGBuT DDBwwbk6Gw+Es8vq9EINURQG3ra/FfRviX9NCBC7i1v0W2p0UoB40deNamVsctFTP10R QfzA0jKG+XWeAiFASvCGqsKyX35uei53JRk2m00DH4WWLyIUua79k1sCsfGG4wjWA4Pa Pe2SnESwPzAZsCLRWPKMElH60fWiZKA6p7V9nN+0OwrGW2QS+vJlijyt5gY+LhvTxWYq yJ7Bz7ZY7Wr9TVly6JqFNNOmsumWDfG3g9+lTGAvx/TF8k5/8RT4O/eFgnmQy0ZtgK9x Og== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 30wv1n5w5b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 11 May 2020 03:23:25 -0700 Received: from SC-EXCH04.marvell.com (10.93.176.84) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 11 May 2020 03:23:23 -0700 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (104.47.37.54) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2 via Frontend Transport; Mon, 11 May 2020 03:23:23 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TdVWrOzJ/YKXOS6gcuksEMNpv+oxMouDxqTp0dxBIduMowxZurFnQa+TqnxfOW0qhp1kEAJyckf2YC1aHsc9TUpcjw9Tn6VE7WBgzK60W82LkEYlggix1FLRyJOVPMC7oy86+IS+kL2qsjkiyDLHzC51gRRzIVrQdSOiCPwPtzqMKVr3IwYgwnzZAZBdqIYxGPIj8Cw7njUB6bhhH9vAAPKgfaa0DPpfz4f8dSe6eCm65CAPArR8ViizLBju1QkjALAPyki7xr412JQgqTsMYKjHeM4kmRKpmP8nffYcRIiTlqg1g7k0Mi0MGkj80bCtTICjW2dX1OXpjkf9F6ohuA== 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=wi6Rv3ClNLEEOCxvUDzwnCIfAY39RkUuqgaSlOxoTnM=; b=i+rubLedNhVOdC9BjVArhcclen2nbe/55OYoscazonx2WjJbbV3QmUW1E29KuSYuKyuxGlLkQe3vhkA03A6ezLHBrn2fe/MrZ2x/s6hcFHNbud6EGeV4RfbgH2exF/kfJmLvCJhr0VEqy9PJ5/XAqaKINTlbJTiOCeDmHdpUG156m60biw7j8fIvP6khcPWX2FX9MR6c0xuuHWx69dbBOBdS6U7RuOvCYDPItSAfDsT65EzEbKpmf+pfBvNL6ds4UTgGrZs57hk6mTdkouQEU/+cSXCpuWTIertzlMk+2f59E62pDn/j4XauEPm31+OYxC7s4j4+dH9A4db6dDBYMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com; dkim=pass header.d=marvell.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wi6Rv3ClNLEEOCxvUDzwnCIfAY39RkUuqgaSlOxoTnM=; b=rIx1DZRtHadMW6scBVsMWAiqFd6jFFhPLKDr1arshjE1MBoHxRfyrZ3OBvoJqDbRJIv0dE6k/4XvGn3x1/nS2FAJchfLVqCREDM7kW8iLGFvEpNL/HvdwLLcFTUGY9e8siQnLYkv6HBL1Jej6Y+2Q64nbWCZ7aerm71qaHCMw7w= Received: from BYAPR18MB2518.namprd18.prod.outlook.com (2603:10b6:a03:13b::18) by BYAPR18MB2822.namprd18.prod.outlook.com (2603:10b6:a03:111::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.29; Mon, 11 May 2020 10:23:22 +0000 Received: from BYAPR18MB2518.namprd18.prod.outlook.com ([fe80::fca4:5e00:46d9:a289]) by BYAPR18MB2518.namprd18.prod.outlook.com ([fe80::fca4:5e00:46d9:a289%3]) with mapi id 15.20.2979.033; Mon, 11 May 2020 10:23:22 +0000 From: Pavan Nikhilesh Bhagavatula To: "Ananyev, Konstantin" , "Jerin Jacob Kollanukkaran" , "thomas@monjalon.net" , "Wang, Yipeng1" , "Gobriel, Sameh" , "Richardson, Bruce" , Ruifeng Wang CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [RFC] hash: unify crc32 API header for x86 and ARM Thread-Index: AQHWJTgHo7IAeERCXE2KuklKRB3ozKih8AfggAC3mICAAAZJoA== Date: Mon, 11 May 2020 10:23:21 +0000 Message-ID: References: <20200429180515.5704-1-pbhagavatula@marvell.com> In-Reply-To: Accept-Language: en-IN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=marvell.com; x-originating-ip: [223.226.86.58] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 562bfe9c-62f9-48c7-30bb-08d7f59554f9 x-ms-traffictypediagnostic: BYAPR18MB2822: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-forefront-prvs: 04004D94E2 x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OnUjE6hZLLqVrreKNvluWE+qXAMCBSbesEBqME4JjXNQ+C+xcfhy53QVo/r8mbzklcOGmg/McTIGqZB6yknmEBME16IOnZquLOff3guae1rehoX+bAnoEjPdQwevkEVJr+iBAatMRG4l8aWcosPEoVwL/IV//v+2Y9sBKBM0n3KiR2FbWydf2v2uIlm5jccLKBdRRtG4bGKLJMXSVU1CzL+6HC7Lkxwq3w9inw1qaA4eO1HQbbjS5cN3p7c2lXnxpzpAuyVaHMRo5u12Neuuj7sfSi1vvYdFKjSBrCtmeHSxUfj/hnYWko1/Ay0HGSIZMVkcBWsbYwFVFzrYtD2akj49kczfa/sBzq/gkWndXrL2MhEALh6v8mSXBS6W/+2VYkVk50g/vX+IUk2u+Nywd5KH4yqJ+IIl9JFFU6vES3xwdm9SPsuUmJ05fPhUgNRvAmPB1TmSIWs3yhbaR3+KcrHI2squtRJ3B1jST6PceXTWbtDUbXleO+ydA3U+Z3t06QA2cd7EngjEwKp7QqVdk8EJZ3pqPjdr2TjDPX7BR40= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR18MB2518.namprd18.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(376002)(346002)(366004)(39850400004)(396003)(33430700001)(4326008)(55016002)(186003)(9686003)(6506007)(55236004)(2906002)(33440700001)(26005)(52536014)(8676002)(110136005)(5660300002)(478600001)(71200400001)(316002)(33656002)(66476007)(64756008)(66946007)(8936002)(66446008)(76116006)(66556008)(7696005)(86362001)(921003); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: 3tbqgIM6YeQ6M+w2/mie8EObRw0mZCOJLf9peaRFBiIIgeAB7acCeOCqyVPp8OVKpXbxCS9KGQAw6u10cHFQKqxyL8q+Zfloss1RQXYudUJFGq6adZgwxYOQVjU0cZWbPJYQZlP0s6wLDrC8Nx0BcjviouARb3/H38eCPGI9p1zsG+r+EKSscH+F6Z1cMXpdhGoYPnQR2TgOlqMHiFd3CM9OHCzHy3JX4ZWnNTFacAvee6XWSsBj5H0ktOyC5lXwSuwEkjqOtgPSfxb5NZQsFxV1FFi0kgMbl8vXqVKqC/Sy0NZGLeV5MBfP7VIbWcl9nfAaXBLv+k65dY7q/X+D+mgm0N2qXuw+/MEf4GU18ruJXwk4Pej8bp2ncFqs1ggWYJ5GvXJb0iu/5xyAZFNBrhujsfHcxUefKvk+dBkp3dApX36PbUfCR0nChbqs1SzvlOIG45+imuwfXg/4mPfSYXaY5hq3FXkUuzYfwAImncQ= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 562bfe9c-62f9-48c7-30bb-08d7f59554f9 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2020 10:23:21.9374 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: qVEXTcZiFg0e7piuB1TMEYH1cBYiO3lK98KPo6Ou42hD/N0FRuzKpa2jwLx0gbDmoEcVqiCmZCDbexnMqrtgqOvJB0ctOrc/RxpGYzqlbfg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR18MB2822 X-OriginatorOrg: marvell.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216, 18.0.676 definitions=2020-05-11_04:2020-05-11, 2020-05-11 signatures=0 Subject: Re: [dpdk-dev] [RFC] hash: unify crc32 API header for x86 and ARM 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" >> >> From: Pavan Nikhilesh >> >> >> >> Merge crc32 hash calculation public API headers for x86 and ARM, >> >> split implementations of x86 and ARM into their respective private >> >> headers. >> >> This reduces the ifdef code clutter while keeping current ABI >intact. >> >> >> >> Although we install `rte_crc_arm64.h` it is not used in any of the li= b >or >> >> drivers layers. All the libs and drivers use `rte_hash_crc.h` which >falls >> >> back to SW crc32 calculation for ARM platform. >> >> >> >> Signed-off-by: Pavan Nikhilesh >> >> --- >> >> >> >> Currently, if application incorrectly sets CRC32_ARM64 as crc32 >> >algorithm >> >> through `rte_hash_crc_set_alg()` on x86 or vice-versa we fallback >to >> >algorithm >> >> set previously via `rte_hash_crc_set_alg()` instead of setting the >best >> >> available. >> >> This behaviour should probably change to setting the best >available >> >algorithm >> >> and is up for discussion. >> >> >> >> app/test/test_hash.c | 6 + >> >> lib/librte_hash/Makefile | 5 - >> >> lib/librte_hash/crc_arm64.h | 67 +++++++++++ >> >> lib/librte_hash/crc_x86.h | 68 +++++++++++ >> >> lib/librte_hash/meson.build | 3 +- >> >> lib/librte_hash/rte_crc_arm64.h | 183 ------------------------------ >> >> lib/librte_hash/rte_hash_crc.h | 193 +++++++++++++-------------- >---- >> >- >> >> 7 files changed, 219 insertions(+), 306 deletions(-) >> >> create mode 100644 lib/librte_hash/crc_arm64.h >> >> create mode 100644 lib/librte_hash/crc_x86.h >> >> delete mode 100644 lib/librte_hash/rte_crc_arm64.h >> >> >> >> diff --git a/app/test/test_hash.c b/app/test/test_hash.c >> >> index afa3a1a3c..7bd457dac 100644 >> >> --- a/app/test/test_hash.c >> >> +++ b/app/test/test_hash.c >> >> @@ -195,7 +195,13 @@ test_crc32_hash_alg_equiv(void) >> >> } >> >> >> >> /* Resetting to best available algorithm */ >> >> +#if defined RTE_ARCH_X86 >> >> rte_hash_crc_set_alg(CRC32_SSE42_x64); >> >> +#elif defined RTE_ARCH_ARM64 >> >> + rte_hash_crc_set_alg(CRC32_ARM64); >> >> +#else >> >> + rte_hash_crc_set_alg(CRC32_SW); >> >> +#endif >> >> >> >> if (i =3D=3D CRC32_ITERATIONS) >> >> return 0; >> >> diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile >> >> index ec9f86499..f640afc42 100644 >> >> --- a/lib/librte_hash/Makefile >> >> +++ b/lib/librte_hash/Makefile >> >> @@ -19,11 +19,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_HASH) +=3D >> >rte_fbk_hash.c >> >> # install this header file >> >> SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include :=3D rte_hash.h >> >> SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include +=3D >rte_hash_crc.h >> >> -ifeq ($(CONFIG_RTE_ARCH_ARM64),y) >> >> -ifneq ($(findstring RTE_MACHINE_CPUFLAG_CRC32,$(CFLAGS)),) >> >> -SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include +=3D >rte_crc_arm64.h >> >> -endif >> >> -endif >> >> SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include +=3D rte_jhash.h >> >> SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include +=3D rte_thash.h >> >> SYMLINK-$(CONFIG_RTE_LIBRTE_HASH)-include +=3D >rte_fbk_hash.h >> >> diff --git a/lib/librte_hash/crc_arm64.h >b/lib/librte_hash/crc_arm64.h >> >> new file mode 100644 >> >> index 000000000..8e75f8297 >> > >> >Wouldn't that break 'make install T=3D...'? >> >> My bad I verified with meson and it was building fine. >> >> >As now rte_hash_crc.h includes not public headers (crc_x86.h, etc.). >> >Same question about external apps, where they would get from >these >> >headers? >> >> I think in the next version we can directly have the arch specific >functions >> Implemented in rte_hash_crc.h. Since its pretty stable code and >overhead of extra >> ~120 lines. > >Ok... but why not then just leave arch specific headers, as they are right >now? >What is wrong with current approach? The problem is if any application directly includes only rte_crc_arm64.h=20 (completely legal) it will break the build. Example: diff --git a/lib/librte_efd/rte_efd.c b/lib/librte_efd/rte_efd.c index 6a799556d..318670940 100644 --- a/lib/librte_efd/rte_efd.c +++ b/lib/librte_efd/rte_efd.c @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include "rte_efd.h" (END) Causes: ../lib/librte_hash/rte_crc_arm64.h: In function 'rte_hash_crc_set_alg': ../lib/librte_hash/rte_crc_arm64.h:77:7: error: 'CRC32_ARM64' undeclared (f= irst use in this function) 77 | case CRC32_ARM64: | ^~~~~~~~~~~ ../lib/librte_hash/rte_crc_arm64.h:77:7: note: each undeclared identifier i= s reported only once for each function it appears in ../lib/librte_hash/rte_crc_arm64.h:79:10: error: 'CRC32_SW' undeclared (fir= st use in this function) 79 | alg =3D CRC32_SW; | ^~~~~~~~ ../lib/librte_hash/rte_crc_arm64.h:82:3: error: 'crc32_alg' undeclared (fir= st use in this function) 82 | crc32_alg =3D alg; | ^~~~~~~~~ ../lib/librte_hash/rte_crc_arm64.h: In function 'rte_hash_crc_init_alg': ../lib/librte_hash/rte_crc_arm64.h:92:23: error: 'CRC32_ARM64' undeclared (= first use in this function) 92 | rte_hash_crc_set_alg(CRC32_ARM64); Thanks, Pavan.