From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0061.outbound.protection.outlook.com [104.47.38.61]) by dpdk.org (Postfix) with ESMTP id 836351077 for ; Thu, 27 Apr 2017 15:47:40 +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=WnybY2Qo/RKMbiY71FklUddJzGfj2lm1nV+MQ9U2d+E=; b=GKwz/ljeTJRRJ7d1TiKHdA7pBki96EET+oHK5DelVlHzKaB/dKBMw8m2OVCSV9/DdvKwng4Pa8pBIXNTxp8mn7uARPcpteKWAvoUH02tb6DKOyJjgq7KdK+SINu8p5yAUO7/Uiru1VnoIQxxxIOteBlxApfSPh8g111ZPOdjfTI= Authentication-Results: caviumnetworks.com; dkim=none (message not signed) header.d=none;caviumnetworks.com; dmarc=none action=none header.from=caviumnetworks.com; Received: from 1scrb-1.caveonetworks.com (50.233.148.156) by SN1PR07MB2431.namprd07.prod.outlook.com (10.169.127.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13; Thu, 27 Apr 2017 13:47:38 +0000 From: Ashwin Sekhar T K To: jerin.jacob@caviumnetworks.com, jianbo.liu@linaro.org, cristian.dumitrescu@intel.com Cc: dev@dpdk.org, Ashwin Sekhar T K Date: Thu, 27 Apr 2017 06:47:28 -0700 Message-Id: <20170427134728.35392-2-ashwin.sekhar@caviumnetworks.com> X-Mailer: git-send-email 2.13.0.rc1 In-Reply-To: <20170427134728.35392-1-ashwin.sekhar@caviumnetworks.com> References: <20170427134728.35392-1-ashwin.sekhar@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [50.233.148.156] X-ClientProxiedBy: CY4PR02CA0012.namprd02.prod.outlook.com (10.169.188.22) To SN1PR07MB2431.namprd07.prod.outlook.com (10.169.127.143) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: daed0f37-59a5-4544-4cb2-08d48d73f82c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:SN1PR07MB2431; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2431; 3:9iQ8+vrlCw98yxX70LYz7X9+23j2eoU83DWSFc/sLQC8SWlOywFr7ykfeqHshtpCz8Kw/buarq3CB58L90LIxQjBMbsuS64ayHvtG1emMvE/lRRpJaSCehPu92lTcEyjvjj2tU9/B2kr5iMOG08hrznKUYLqU3oNm/i/YD93uTHst83eRDgWT61djqlGOLuHUq7yjI8sZlEgEvK9nYwr+wZMfBg54N827ECaX/D0JFgJTjTnRcouMUCedrJzaaqWWFEr4zPZJ34YqsehsWlP4Hlfc0r+kbpVZRehbHgssyXpyCZllkEZtKBfrNJx9SwaWXhx1GvUnil5V/dfjnbwuQ==; 25:VaOZoeW4SiRSinAPUDyr8ORpbL45NHElZz5m+Sdhn+j3AWwfa6XNZwUh9bMFJlsQFnirtxqLrlDQ/k8ZeNNlEQnANh7IEfuneML8jIdA0UX8itSR5ha2TRey81M6geei7j7RG2HT6WTlaofV3TM+ckq7iaAGJXbEjVLoa30GIAmK3PuhOhSr/MSLtZuNkOgKfIynqzHhCeF4R9Iih0O1mgy6UtLLkOqVhfEc9wsqN4fwrA4iz9DT7CNcQjSTzYLGE69GuQ5z/qOdSajzAa9Ssgef2WNSFVd6UR3MPvx/4VHv++nRiVFc+44GEFcg3zLG5sgZWSIADGGLbpmc9+vOxnKeegoJbSOJksKMpWk/xKYqgbj7ml+Coml9rj/50B0dprXQzyixYWG0ti1nhZW5k1WC4lvI1qYnv+9ZlBOYG1sXkBTm/HQGGcurLScvGYjMAviLf48dqLAlvEWUODdkyQ== X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2431; 31:9gLla1pJcVyk5miNysVRtWFUjw395NHJNh0xn4UiZikqCEXxuGSrcZdydV85Rjt9tj9Bz5ytEjcPoOWvAoFyaqRfj96c5eW4s5xpj/QMxjapK8p5KMLFWALscdvruNbRlouP/g72L/byivKpBYA9nwDn3jf8P/55+YTH66NgWoZO12G84ucCUN8gsBjUt7i1dvey9Ww6lmjO2zK4r6i6aUU1COb4L90Dh2LTGLJ0H5fiBmhHnCEVkcHd9YNi4/OA; 20:ht0Aze8FRnU77njx3Xi0FryOQlmHlZRIbWpbPLuK88KVE1apAF2Y66cBoP6RieYoqNfZW4aOGrR6MvStzVGoPJZ2jRbaawIYKsH/R2ViF+9JEmFFUFMPBF10tv2CbbTbwqxTraDIru0HvIlAAy2YMx1CaQ3vU+at8gqkhGBHwV7SE4pDkRZKjx/WN5NdtYXuT6Edz2V8nhUDDyDObhRw+qd2I/wCgNIUxZxE0HjnktO4Ie1y1oL0bxYnsoJVqjgcmBikijBMj+BjjuxISN2VbXJW0tQ8dMkclaaY8sQLyDE/XqHS76O+Fh8nHTBLJrXny9H9PozKyaCGr3PAJX3STTlXy8PDtMItEyY7oB73e+ILJXSiOK/aCuS/75Xf9P6/g8DSipHeuPOMZ1b4jn4Ui7krPs0roHOzIvyVQ+n3FCaqKUY7F0vUIWkjiDbkT4E47da3Ze5l/ffjioDPdHKnQwe8AHOYAjZNFvV34CBYqpXHpV8cuddTQp0I9jo9FaWpQlnxRPUlX9u6qC3Ta3sfDrIxwSyef6ABx6OVvnx2tm/vUR7PiKK/D0kuVBogyVDlGl9j8hMzcnxjNlI7e4SeplcKQv861yoykXLftzF0RVc= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(6041248)(20161123564025)(20161123555025)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(20161123562025)(6072148); SRVR:SN1PR07MB2431; BCL:0; PCL:0; RULEID:; SRVR:SN1PR07MB2431; X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2431; 4:H8M62snHdy+0Q0AW5e8pzbnBPxwRu/fde361vUU30PXiAwGWP0hOPWj2riDT8nlg+Cj85OKrhuI4IMZIRbTmk3aYIXvqJ86s5Q5viZ4cpHYNwokhx6v+O1OTV6YreXDLL1dWyptauykEU7Fg7fUE1V4hpCVECsAEt63X8TlOdrarQe2AGPBHEWuZltIZug+rrwUAWhtuyBEY7lvJXYlhxBjYaidojuFJeaGbCuWR4M92qmOWMHfpyAaWWpY+K4lavzixehhnf/z0+t74IwSIkqopQL4aqkTgjibVUMBjHJKaxfgi8CVPu6Av6W+c9+yG8fDBQDLZiKPJL/0dJMQwCC0pxE5/enXuKlfaD9y+tXR+/FfPp0yjSjVg7Na6r94qoji3TnFEzstIXvI1CTsI9Si+Puq3YwCfPbUFHjlULG/8PnoBF1RHKnHnm/NRjYzhMpg47pysfExQxjsaZN42jrzWhGNIFRjCAiapmRE7QCGxrbfTSVzKBKzW8OgzN1t7xScvRrGQPZe/7ACvyce1JSQ/sxxGIvE/hm2yWUHct/ltsrQgLgCi19+0VpfNIHWOxa+iyv4mzWic5z4jl+JdBEuno2clPfBa7N5lb1+FOAA5QZ6IPrtdBouUraEm+nJtMoJfz7FZ3fXEkkNus0poAIWplDcsKbSBpaKjaxuTe8OZDQQ+UkzCTNOOAApah2U0 X-Forefront-PRVS: 029097202E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39840400002)(39410400002)(39850400002)(39450400003)(39400400002)(25786009)(4326008)(33646002)(6506006)(6486002)(5003940100001)(53936002)(42882006)(2950100002)(6666003)(1076002)(189998001)(6116002)(3846002)(36756003)(6512007)(5660300001)(66066001)(48376002)(50226002)(50466002)(81166006)(42186005)(110136004)(47776003)(76176999)(50986999)(38730400002)(107886003)(305945005)(2906002)(53416004)(8676002); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR07MB2431; H:1scrb-1.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR07MB2431; 23:fIYCpBNn7uGietV36YZiIy+nLlRpTwSvssKEmZNti?= =?us-ascii?Q?T0XfG54d+EOrWgNvxU9r9mnfbXF+gBsbt4FBpe7wR1naXjR+qYugRWE2mnmW?= =?us-ascii?Q?SVbV9QGZud4J0Lum7D5PsrFmkhNVZT/aALiQKUa+lL+ZJrmqzwPc8rDlMkvb?= =?us-ascii?Q?n2O/2JsTWx7uvpoHaaSaDYxegqoJmaubEgMl1NUiFlBdwavu1Wp7oVU2k2LH?= =?us-ascii?Q?TFAWCEg+B6AFKGxa+9ZDptGa1AWoDnLIoXwQbTwGXwEzfxcsNj3Wi+x3hWpF?= =?us-ascii?Q?qsL6kOfsoFvKO49tkstTOXwzeLqzmwaQ/lhx4s+LAjLW1O9SEXFPnDbE+9Zo?= =?us-ascii?Q?NsqwZf4bvFp/Vbe/xycj4zFrtdZvel8Y0x32DpRzhcPyBfTd/1fOwy1W4lE4?= =?us-ascii?Q?BPl8bGpaY4aAJF0Tj56FnZlkAkqe6GZKZSItah4d6dbLV+l8AydWfu+uRdsy?= =?us-ascii?Q?StD7rTWmUiPaXm8Hd3X8EjzbogKk4Cgrsmbm1kcvG2u68oA5wCJDhIc3eP1K?= =?us-ascii?Q?k3Lq7k7Avr+1kpTdwo6l0lGiVc+VKKgV5RYqGftqRSykQMsbRRoQve/oKqBJ?= =?us-ascii?Q?kw1GEczgGSRVf/D/1prlkTfyqfjwxkEcpIGxVTBgpdMWMZ0uR6FxQ4trBhwc?= =?us-ascii?Q?ervyhqGG03BSzHvlzh8V7521ZylSD1FLlDr5E3bo2VcxvVtcgPqsa1CS2ySU?= =?us-ascii?Q?n7FUPFwtwoD6OHR0tWu+4iZupdxduikbKPUvQYSpzpFoRLufMNwMk8l+kwlh?= =?us-ascii?Q?CvzOf7k6Z1xxRqj8A2uG283xPeWhM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KVl7HADIjVEu7qUAFC+R8ax7pc1B9C7q8yuzA+gnqJSPCgacKXavWOZWAuudS9u16WAB8HPYQ5Dc= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR07MB2431; 7:GYVZLON4K2Bc4ykLcycnXIe7COkbjZjuB+TFzCYyHcRQshBrfxOR66Vu4IbNGIs0BMJ+PkC015rXGq7o1KnNBSjGM8CDtL3OLW9QKr3tWrxeHxjaVKsXUnFYGUuHsZJHGeKMfMlGJOnMXeJN6qn+jsJVC2k8S32JiiCfkA4z3vOGc0VhK4VyZFLSXgWYk6S4uPTYmreAPOMGKl4Om/t9dXIyyuATXuNuf0zjDbMAD0/qHfVueU5nnca5LndObbp6m0taoiAYgJmxztzZsXvc+YEOwUunemK8DjZeFlS6Fuk5oqKyaVgwSrTb/QVcapnQDYbBURsVvbwuYbZlIGZwqQ== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Apr 2017 13:47:38.6717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR07MB2431 Subject: [dpdk-dev] [PATCH 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: Thu, 27 Apr 2017 13:47:41 -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 --- MAINTAINERS | 1 + lib/librte_table/Makefile | 2 +- lib/librte_table/rte_lru.h | 2 + lib/librte_table/rte_lru_arm64.h | 88 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 lib/librte_table/rte_lru_arm64.h diff --git a/MAINTAINERS b/MAINTAINERS index 7d708ae..576d60a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -148,6 +148,7 @@ 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_efd/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 f40cce7..a06a363 100644 --- a/lib/librte_table/Makefile +++ b/lib/librte_table/Makefile @@ -69,7 +69,7 @@ SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_acl.h endif SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_table_hash.h SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru.h -SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru_x86.h +SYMLINK-$(CONFIG_RTE_LIBRTE_TABLE)-include += rte_lru_x86.h rte_lru_arm64.h 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..589a81b --- /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) \ + do { bucket->lru_list = ~0LLU; } while (0) + +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