From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0079.outbound.protection.outlook.com [104.47.33.79]) by dpdk.org (Postfix) with ESMTP id A29CC58F6 for ; Fri, 28 Apr 2017 10:58:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lF0iy4gvD0kMKYixzBTPWdgetRCbwppz/UDZ0Zind9c=; b=mUmrYpgKP/WLZmxFPyOyHS39SfS1Uz30mTqXzFoEVce6oqlgwKnjE7eFIyuzRO/thyDjw3qHTiG7hZa7OJZDzaUqhdQfz+lIhPgHlBEUu6SqMU8RPvpaBVefVjjxKDUNRJDUi+0I2ivw3KOjT0Jcdc/MgA8ewEXZyBo1wxY1Ur0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Ashwin.Sekhar@cavium.com; Received: from 1scrb-1.caveonetworks.com (50.233.148.156) by BL2PR07MB2418.namprd07.prod.outlook.com (10.167.101.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Fri, 28 Apr 2017 08:58:45 +0000 From: Ashwin Sekhar T K To: cristian.dumitrescu@intel.com, jerin.jacob@caviumnetworks.com, jianbo.liu@linaro.org Cc: dev@dpdk.org, Ashwin Sekhar T K Date: Fri, 28 Apr 2017 01:58:31 -0700 Message-Id: <20170428085831.15945-2-ashwin.sekhar@caviumnetworks.com> X-Mailer: git-send-email 2.13.0.rc1 In-Reply-To: <20170428085831.15945-1-ashwin.sekhar@caviumnetworks.com> References: <20170427134728.35392-1-ashwin.sekhar@caviumnetworks.com> <20170428085831.15945-1-ashwin.sekhar@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: CY4PR02CA0022.namprd02.prod.outlook.com (10.169.188.32) To BL2PR07MB2418.namprd07.prod.outlook.com (10.167.101.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 82afcf77-4e09-4855-226f-08d48e14c733 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:BL2PR07MB2418; X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2418; 3:TFKwAk5R6ahI73iZOfkQKD2ReIZA9LovPwXys9yWxy+y2ziz10XlKnyx+E+1A2kO1vqJTwGEu/NyC/pB4tcneV0n27JNK4IoYVRVIZPbZgLIJp8gK+a8eP1LNEmrAgAv2SQYWo54ZPzOSUNAz996GgVIelzrQCZLhd5HDteedokE5ed2kCF/Tnb+h6MysTfBRw/q6OpeceiQ+iw8LCSmqjs70iBxFeHLbZrzKsdx/iGeCc80VrjKyi20sbguKFiEj3NY1YTTNknrjWjHGEXTvIqVEmGjnetJgNTmz+UtuIm1uC8qZXmZl0CD0KCXDbuuMFwvwtNfGM7P66KIN+Ie6g==; 25:oMX8B3Y0yjegcNocnkdzUkrGO1X19UHLgX30Dga0tAyaGw9A1CuTdCNkjp9SPCcJkfgNoF2aLpnq+mE6jBhGLv/X9KJ7WvF4yfYUrofmUIjAeeXxXEYqGnT/S7XGI6WQ6Z/Ud7v5mngByfqqEgqrwubecYp1KSsAoPDbQhdrZXk6saHLe8UyEybch0u4N6U5UZjxD+wO5T481kn1y51STexTCcc18N6OMeCADUDhnlh0pDDLQk+ySsfAzrRsDloAkHGkNOf9GSR12pibWo+KSfelEyEP+hFmTqRzihwypwCDVcGthGC25sXtcZFYonKM/6nuI5h0U0rLOFVG+uNDDvugdysKj1xttb9udd+Fd/TKPOOg0rb8724X/mJ6TeIdreTnewLsUleq4u5qN4umjBFh+IaphR94rTdv8aIJoA+ii6T0WYfB7h/AJVpMyJvsc1UjA1TnDfBfe4dVpxg4+w== X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2418; 31:dKF5kEr2/OVngEyUHQYLZp/dylDbYeInNRXcYScOvug96hYxJmG9+1lSlTArGVpg0U0rK8AEqRj7fMLjnPGabDdijwvT8nk5uXpFqKHm+EvAWHSHsLfBHaSGcMVr6BwtKpCUXfns31krjhfX4whOlGmxfboQKdo3JWZNpbtCVo/jsHJ1/6xujd781SgfQ/Kv6tk00l+VKg/7p+Jl9hHEjQeJRZ2/3IwuK22qUYwgPwE=; 20:7IPkCW3/q38K0eWWz4QCtuJjH66HqtbqMtC/xpYrrL1ZGSa0zTuo1YHYsAeLht++DhyJ1PF10vty0hB/NuO7gysGKR8zOFYaORp2y6+KkkMQW7U/d7AHGZuw8U6Bjve8qrvzdUPMRkuyiPynKTC/3xci8z+MhdzYrIl1y+RaLITCG7cospf5XLABLkh9LP5lBSDHJDqiIJ0b1nyc//hkEpI8xJAn5Y1sKbOn4dAhktAM+E/ZHblYhl9QPNuBXgRxckbiCkkHr3+U8x6y1JgoAr+zzEHhys31m2fXpHNlCCePb0K0XQ3TYbJWsfOI+XcY1bVu8zd3vNKMQujnGkRtbQnbbno1XpAcgQzAsXIApetWm0wGuiBoz3v8l6ZE5sohBfum9SvqUgPtW7ENqHN6fGUlcsOGhvSzYcNEEvPWCfwjU8hPROGwgfgnBpdwc8LJO5la12uCC1741JDmtcbKJvWa8OQy++Tc2Eb2hGbTmsullGg1i4pm/yuRwssZ/1dLyKLvGqCMlwTtXg1uQIsrvluV+KS8mFgs8ScR//wlp9jiIURnycAR8Cr1qmzjxvyyiBIHMaU5o+FW3sA6mAllaPd8QXQr9T3fmMUBNFIYZQ4= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(93006095)(10201501046)(3002001)(6041248)(20161123560025)(20161123555025)(20161123564025)(201703131423075)(201703011903075)(201702281528075)(201703061421075)(20161123562025)(6072148); SRVR:BL2PR07MB2418; BCL:0; PCL:0; RULEID:; SRVR:BL2PR07MB2418; X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2418; 4:rPoIAz/kX3Qyvry+CagvM0RFfu7Wt7728iIrN0yudf1pUV5GezcIHWlfwLEB7W3cS0Rq35bzDL5bl+t7wfgRflGhtxMeCBKONgj0TFQldbdVcTSYTkcrvbRMIlWqaU2ACOJWY8kHBJ8lNSUHducofWe0KzEnhKQF7qoz8KsTVTI4zEBzKZZQoUC3fHMDM+E43Be5Xqs3Ll3/4b+6laQw5LKDcbom/IkLSu99/hcv1zhs39udhWXDqxwFJfKgkRxDhTepXDdIwEQ7SfiwlzC6lITq8l4Zu1rEB42r1WvC7rKys2GLv5KYM8F2EyZYUb+CoWRpLKXOJ50WSMfmnlwxQKBQnYZL9GXYJX0DlYo2PSCSfgE73Y+ZR9+S8/nIveETCODgGfAUx8l4ograMhweQpo2yVgqhTqLbb25BZozXR4O0h/Q8y8275NY8BkP7CFrQj7cKmZJvCF/hk2xoobLDy9YQPnWWejZvBRdWpmKwcH4+qfxNiOqzkoonrmqr1SWo0c6e0RMBRQ4Y1f5vQnN/xQSPO7Q2x6mRTwTlFqCjPoKi7dNrtM+YkWdMIVnNDW4WukwebxJC09kOe5yYma5QvfM2bXKgb4TxW5QL5B+QlTNnq01XsJXZrCES/qQnmDhLbyp1cbIcRWi4u/ckK4Xz7bifd6ldufhpXq7rFSvJdG4yNe0zjKutpdLdAaPcScUIy4I4g7HRuJWZq8cOQhKH5cM2uAafnOx4zlpR0MJuOQ= X-Forefront-PRVS: 029174C036 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(979002)(6009001)(39450400003)(39840400002)(39400400002)(39850400002)(39410400002)(5660300001)(575784001)(2906002)(6116002)(3846002)(5003940100001)(7736002)(6486002)(305945005)(6512007)(189998001)(6506006)(53936002)(2950100002)(42882006)(36756003)(48376002)(6666003)(50986999)(4326008)(50226002)(76176999)(1076002)(25786009)(50466002)(53416004)(66066001)(42186005)(81166006)(47776003)(8676002)(38730400002)(110136004)(107886003)(33646002)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR07MB2418; H:1scrb-1.caveonetworks.com; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR07MB2418; 23:GJXXmwC0S6SpFHSjZbpYeA6pAuKNU6Lvhmhil7YOl?= =?us-ascii?Q?vbM5Z55gVmvqbl/T8xGc0SQM/5Te6QJS0RMA7sDgWjYzDdJrmOclEoAEQ0jM?= =?us-ascii?Q?JW5rNzCzeGAS20Ab7sS8UkB+oSD3fHZBtPHU099bY9uMyMrQVrj8x31627XU?= =?us-ascii?Q?sos2NR/3yUJsZbFrTOi8R49Lrj5Qq/YDI2C0XMaNO93ep8N7PR0B384Fa/Bg?= =?us-ascii?Q?wAi+OhkIpSWsExNFu5zHDuSE5fZQzEG/7aUT7eVnX3j/NgJqQgdNk6so2l/q?= =?us-ascii?Q?dLOA9wWLwzuAVzzON6PUgo+40Rf/LREegReVioqBXLqJhqyb3qhBqAguzWZz?= =?us-ascii?Q?gNcrXAnQpDUtDv+jroL0/RGyhx7JNew1X20F6Zn3TQ7ujjovW6BaiTTRUOIN?= =?us-ascii?Q?qhW4opP/NbsK28C47+kornUSqronv2BFRZmO3IL4oa6YEoHL7yyocnRs4q/W?= =?us-ascii?Q?elS1bvJjfdtLt2HtrnIh8P+zJYMZBz82CglBcGYyV/wGkXo7MSPOA6UjLcKc?= =?us-ascii?Q?ITc1Yh6QM9dQqMtD37dBFQdbKefKPMEDs6zgGvlrsTPqT7SvIhmwKfzpUeeB?= =?us-ascii?Q?zGbOj3yg4pFDnXcS6AvYgoqY1zcVkaYRwmn9v+tb91vNdnRL5CMEIl8LoglL?= =?us-ascii?Q?WVgNweZECiZ57OTGdg5pxfZtM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RzwX9SVlkfCpwgFS7y2E4twYCK8kveScj/wITXqZ6pXcib7oaqe538pi4p+vFrPgKLao/B+7vny3d9x+1Ap/J3JRUPOG5B0ENOx2TFhsd2tWY3guQS1nPjAaYlp/2ha6A==; 5:S37/bl3WU6px6+oIbJWpZhUzksbqzHWMshxTltCQavh1Wh+qpiap2SJ304qRHCsoRqZ4Kx2aNjeWor7lCdJsPhbdPUYLqhIHbqA0vCITSw4pZ7iWF4GeJ4WBBB6eDmZgH2VgXYQYeIV1YX0z3RaYlQ==; 24:pggKiS8acdcfzEnM6VP98vrE2ienb4uvwIvZtTSlfsDiI2Lf6WfZRCb1+HBWyrwQkYt+eEs8GlcSuKgUFVMRRNlF/7X8mD4JqXYKPAFL5yk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR07MB2418; 7:u4SQwz7NhK2ygDR5+kGR+Fmi5YoQjjjCfkTgbP0l7yFnDL5RYemIPsAhr42iuEisnJu1LIFPo1gFyBAzob8JQlLVN2spqD1KeiyCcPvaQ0KNDKIEtmNth0p3XckhNC4KT49s1IXjlh1HwmzDiVpXQCqMfYPQfNBtBDtbrEkFjsmSoBI5164v61N4/Xdnc9v954besSTlOddaPPj0ipCNAakEVqi+gX0Ss1GJ3Z9h7zEAN88TgM+rrp28bd81xKB3FN8Sijtkg14qQvFHiFlsH5qB9y7ZPIiC9OMQ4sV9FQGdMtFeK6ZvcFXzaqu4r7JCErvKCJmWiB7yL7okc7ZZog== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Apr 2017 08:58:45.3055 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR07MB2418 Subject: [dpdk-dev] [PATCH v2 2/2] table: add neon version for lru strategy 3 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: Fri, 28 Apr 2017 08:58:48 -0000 * Added new file rte_lru_arm64.h for holding arm64 specific definitions * Verified the changes with table_autotest unit test case Signed-off-by: Ashwin Sekhar T K --- v2: * Fixed checkpatch warnings/errors * Fixed merge conflict in MAINTAINERS * Symlink rte_lru_arm64.h only for arm64 architecture MAINTAINERS | 1 + lib/librte_table/Makefile | 3 ++ lib/librte_table/rte_lru.h | 2 + lib/librte_table/rte_lru_arm64.h | 88 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+) create mode 100644 lib/librte_table/rte_lru_arm64.h diff --git a/MAINTAINERS b/MAINTAINERS index b6495d2..de0faf5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -147,6 +147,7 @@ F: lib/librte_eal/common/include/arch/arm/*_64.h F: lib/librte_acl/acl_run_neon.* F: lib/librte_lpm/rte_lpm_neon.h F: lib/librte_hash/rte*_arm64.h +F: lib/librte_table/rte*_arm64.h F: drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c F: drivers/net/i40e/i40e_rxtx_vec_neon.c F: drivers/net/virtio/virtio_rxtx_simple_neon.c diff --git a/lib/librte_table/Makefile b/lib/librte_table/Makefile index 042babf..8ddc880 100644 --- a/lib/librte_table/Makefile +++ b/lib/librte_table/Makefile @@ -72,6 +72,9 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru.h ifeq ($(CONFIG_RTE_ARCH_X86),y) SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru_x86.h endif +ifeq ($(CONFIG_RTE_ARCH_ARM64),y) +SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru_arm64.h +endif SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_array.h SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_stub.h diff --git a/lib/librte_table/rte_lru.h b/lib/librte_table/rte_lru.h index 2fe87c8..93258ef 100644 --- a/lib/librte_table/rte_lru.h +++ b/lib/librte_table/rte_lru.h @@ -40,6 +40,8 @@ extern "C" { #ifdef RTE_ARCH_X86_64 #include "rte_lru_x86.h" +#elif defined(RTE_ARCH_ARM64) +#include "rte_lru_arm64.h" #else #undef RTE_TABLE_HASH_LRU_STRATEGY #define RTE_TABLE_HASH_LRU_STRATEGY 1 diff --git a/lib/librte_table/rte_lru_arm64.h b/lib/librte_table/rte_lru_arm64.h new file mode 100644 index 0000000..6ee60ce --- /dev/null +++ b/lib/librte_table/rte_lru_arm64.h @@ -0,0 +1,88 @@ +/* + * BSD LICENSE + * + * Copyright (C) Cavium networks Ltd. 2017. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Cavium networks nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __RTE_LRU_ARM64_H__ +#define __RTE_LRU_ARM64_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#ifndef RTE_TABLE_HASH_LRU_STRATEGY +#ifdef RTE_MACHINE_CPUFLAG_NEON +#define RTE_TABLE_HASH_LRU_STRATEGY 3 +#else /* if no NEON, use simple scalar version */ +#define RTE_TABLE_HASH_LRU_STRATEGY 1 +#endif +#endif + +#if RTE_TABLE_HASH_LRU_STRATEGY == 3 + +#define lru_init(bucket) \ + { bucket->lru_list = ~0LLU; } + +static inline int +f_lru_pos(uint64_t lru_list) +{ + /* Compare the vector to zero vector */ + uint16x4_t lru_vec = vld1_u16((uint16_t *)&lru_list); + uint16x4_t min_vec = vmov_n_u16(vminv_u16(lru_vec)); + uint64_t mask = vget_lane_u64(vreinterpret_u64_u16( + vceq_u16(min_vec, lru_vec)), 0); + return __builtin_clzl(mask) >> 4; +} +#define lru_pos(bucket) f_lru_pos(bucket->lru_list) + +#define lru_update(bucket, mru_val) \ +do { \ + const uint64_t orvals[] = {0xFFFFLLU, 0xFFFFLLU << 16, \ + 0xFFFFLLU << 32, 0xFFFFLLU << 48, 0LLU}; \ + const uint64_t decs[] = {0x1000100010001LLU, 0}; \ + uint64x1_t lru = vdup_n_u64(bucket->lru_list); \ + uint64x1_t vdec = vdup_n_u64(decs[mru_val>>2]); \ + bucket->lru_list = vget_lane_u64(vreinterpret_u64_u16( \ + vsub_u16(vreinterpret_u16_u64(lru), \ + vreinterpret_u16_u64(vdec))), \ + 0); \ + bucket->lru_list |= orvals[mru_val]; \ +} while (0) + +#endif + +#ifdef __cplusplus +} +#endif + +#endif -- 2.7.4