From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0041.outbound.protection.outlook.com [104.47.34.41]) by dpdk.org (Postfix) with ESMTP id 573C2325B for ; Mon, 4 Dec 2017 14:23:02 +0100 (CET) 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=GVYktRn7GIBJ1in4SVG8/4PM1/MILgwCSQBqncWpIwk=; b=MdM5ERECZ+oHLLRDpo+uikSxpVlb1RiJbNsIJ5dqpE/w/eu5Uxysm7jXoLhwD3gpGzHhrrfsAtNvSDK09Ek35fhMz4/fVTVs6rKJiBoC8c7lvewfIpcVgvqXJJ8AAUWLvzevU1CDc7HHphgvP7YbbVHBXo6jWSe1xKTkEsDmP34= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from Pavan-LT.caveonetworks.com (111.93.218.67) by CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.282.5; Mon, 4 Dec 2017 13:22:56 +0000 From: Pavan Nikhilesh To: cristian.dumitrescu@intel.com, stephen@networkplumber.org, ktraynor@redhat.com Cc: dev@dpdk.org, Pavan Nikhilesh Date: Mon, 4 Dec 2017 18:52:29 +0530 Message-Id: <20171204132231.29975-1-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <1504032378-5483-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1504032378-5483-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: DM5PR13CA0042.namprd13.prod.outlook.com (10.168.240.156) To CY4PR07MB3461.namprd07.prod.outlook.com (10.171.252.142) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 1055e87e-4b5e-4c3e-f9a5-08d53b1a22ad X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603286); SRVR:CY4PR07MB3461; X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 3:AXEk8wCOuE2JwnNwVDQjdhomUJOl0reFEOt82QyPq9Lrj0NkxQ+LW5EFORc7mazqom1TZmAB9wqB2M2wSR+iX1idG1S9K86l/1QDn4/SmoieVxTnPkKFPlik/RpyKKxWPC5tI982xmrHsBpq7y6B9pe+KVGoKEr9fAS+gE8m5WQSmpbwyoOxqDel2dZnaufVPAWGBQN/USWp77Zez9yzybPTs4MV/KZqgHNDm91+0PiAI+vds1CxjdWh6BRgyedk; 25:inzYo01nZ0sdf0X/Ua9L851cOsRkMYSWzR0SV7CZEGGxrUkemzZwG2ISgvX+fAc8drpJoxM5LFcQg3Iw/VvGwQdylLzyYvjofU09SvHAiQDEAivx6iazHgeCLUxEAtZLyI3jYXhX5da3qi7czvPJrKBQCrdixZ0jPwYygksdujaR26LWMcHVpOF1huMpqrb6lDijVTZXGrBDndXAfLytRiiiMVLkpjVHpW7aMAl/Ibn+wxC9r2jvu1fYwFxxt/wgPBl01fb5lUjOfpJrfuVUglR9WT19GYPIrj81Pchcw+lpBDk9ZiOrTr4M0xspyOhag9f+gd3Z4n7tue4TiuJUNg==; 31:USagmQclMNyLO7j5QqhkbYSZYyAhbxM5xq23VI6+qX9WlLjYg5tR6JifEM9jBMHg2LJDjVJCqSUu0GsYfs1dKhzcvGQ57Xo9L33Teb6Q5vc880Wruh2iVME+mzTPuiPr0I9msOgbXEGUbywLiH5wRC3PwtfNbze2qZ4S0oBLpyK41HygVKBy73t4PNk6Myx+WLhqY1u9BlVCPdAHyZizs3vvgXJL1bzxjCvEfD8BlBE= X-MS-TrafficTypeDiagnostic: CY4PR07MB3461: X-Microsoft-Exchange-Diagnostics: 1; CY4PR07MB3461; 20:elLzokxC1jygHydGexITPaGiafAQUkkI6FJkrdrAhHVSTOViQ77J91zlBkdfK5zr9rbKVuXE/b4RJbHO+aMNfrugabx6HG1/ldTOTAxXlsa5bO2JPEEaCYE6pNG3iUu46ysV4EAWLE1aFcQqUj6XbJBi+lLmMDy/MyKSgqlOfHxQfH4cIE1WnZPyQun7ffkp7Yzurc7JGWmVQJG/RIpVIfPMFgkv30x6VM7Pbw8+6DflsdMaqORFq3DbVlWiF66GgSpV4WU4DeIYShUuxE9rJxpj7c8fzPbQeMN+aXMpm695zcHgGxMMOPGMDZf4lh4wcjlE9SRyUizXVkULFvgIxQ6q38ra6sa9/Vf7MfEJM1Mdd8eiWPD5YP46sVhZRs2JU0d/N6hqF50gZub4QByrVpKrYMHQsZ6cD9B9laoTD6xotZ/Tb7hR04Tyxa3h6238Gz3D6SCSN8oDTohqkl8AJCy1mD7qqP01ZchSoneYdT1gvg3hwkUqaTyU6uZ5AACU9Y8+Sv6If7bprPyakKd/w21HYV1DWYUMenZI+Ck0EXVXAJBuTH++2f6mNCXQsjz1N9sS38He9pWbJDFc8MCoBUsz9QLsKAHmmYGjwoG9/nA=; 4:ciTLMng7uWqkwAVKAPcP7PqWWJSPPo3lflpgmb84vEofcNXP2DXdLFvSgB+W4MnMu3epSEcycGxcwDFfK54JT8CWnIcbYBAhooj29BzQUfyUQ/Jexg+gTWva4F3g4fBQI64mZh2CrQ7ayRAy067Jfh7xLv9j4Tga3mEeMyHbgYxDNvOo5M5+Es/yOG7JWbi2luLIisyeZAcHKhI1/ZCY2F+VXJF0C0eCjk/4vrJnYACUO1XYdWNts57kVxW8JnZlm5kOvQrXWolUqhpsZZBii60HrJaO/vr9hkv55iR7EtzoEmDZusDkAAKrtJ2nfxrL X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040450)(2401047)(8121501046)(5005006)(10201501046)(3231022)(3002001)(93006095)(6041248)(20161123555025)(20161123562025)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(6072148)(201708071742011); SRVR:CY4PR07MB3461; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR07MB3461; X-Forefront-PRVS: 051158ECBB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(366004)(189002)(199003)(76176011)(48376002)(72206003)(3846002)(50466002)(2950100002)(42882006)(7736002)(52116002)(6666003)(51416003)(6116002)(6512007)(16586007)(16526018)(53936002)(101416001)(69596002)(68736007)(33646002)(107886003)(5009440100003)(316002)(305945005)(1076002)(97736004)(5660300001)(4326008)(53416004)(575784001)(8936002)(189998001)(2906002)(105586002)(106356001)(6486002)(81166006)(81156014)(8676002)(478600001)(6506006)(36756003)(25786009)(50226002)(66066001)(47776003)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR07MB3461; H:Pavan-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR07MB3461; 23:QTEnpaWFV0/7NMX2IQEOG9ppC+kqIfavPYho4AHx7?= =?us-ascii?Q?NIFcqkJQv0FX6BORpdjhMdRBe4t83PN4b9/PTbpSSBPeedqqbmbZP3VCLgJJ?= =?us-ascii?Q?1DxTDPGJ3SGe+WRGqU1cHjUOoY/W89vY6P3dcIJtXhAK2wdyhPE3Pw8uwTuG?= =?us-ascii?Q?2u7xUzSaHehlKDd3Sl0iqjhB7kvb4yHApqE97Kwx3W8r9hJ22VmkxjsU0RX6?= =?us-ascii?Q?mmSq9jEm+oQCgnIaxRXe/yKfJGjkSOpf2V14OBLRpyvDsUwoTQNWz6uW46Aq?= =?us-ascii?Q?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CSF+LPrQFcnnKD2SSxHFYn7ZJ9Fo8w3qNdvn+cRAqPwqAe3WugmIGSDHcumtR3E5HOqhY3ec89JoHwWntoWZElRHNGAuOJGg5PJ3pofuge SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2017 13:22:56.1370 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1055e87e-4b5e-4c3e-f9a5-08d53b1a22ad X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR07MB3461 Subject: [dpdk-dev] [PATCH v7 1/3] eal: introduce integer divide through reciprocal 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: Mon, 04 Dec 2017 13:23:02 -0000 In some use cases of integer division, denominator remains constant and numerator varies. It is possible to optimize division for such specific scenarios. The librte_sched uses rte_reciprocal to optimize division so, moving it to eal/common would allow other libraries and applications to use it. Signed-off-by: Pavan Nikhilesh --- v7 changes: - reworked u64 division (follows same flow as 32bit). - addressed review comments from v6 (Undo cosmetic changes to 32bit division) v6 changes: - remove cache alignment from rte_reciprocal_u{32/64}structures as they would be embedded in other structures. v5 changes: - fix test print strings v4 changes: - minor fix for test cases - fix u32 divisor generation v3 changes: - fix x86_32 compilation issue - fix improper licence in test v2 changes: - fix compilation issues with .map files - add test cases for correctness and performance - remove extra licence inclusion - fix coding style issues lib/librte_eal/bsdapp/eal/Makefile | 1 + lib/librte_eal/common/Makefile | 1 + lib/{librte_sched => librte_eal/common/include}/rte_reciprocal.h | 0 lib/{librte_sched => librte_eal/common}/rte_reciprocal.c | 0 lib/librte_eal/linuxapp/eal/Makefile | 1 + lib/librte_eal/rte_eal_version.map | 7 +++++++ lib/librte_sched/Makefile | 2 -- lib/librte_sched/rte_sched.c | 2 +- 8 files changed, 11 insertions(+), 3 deletions(-) rename lib/{librte_sched => librte_eal/common/include}/rte_reciprocal.h (100%) rename lib/{librte_sched => librte_eal/common}/rte_reciprocal.c (100%) diff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile index afa117de4..b0442a75d 100644 --- a/lib/librte_eal/bsdapp/eal/Makefile +++ b/lib/librte_eal/bsdapp/eal/Makefile @@ -84,6 +84,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_elem.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_heap.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_keepalive.c SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_service.c +SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_reciprocal.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_cpuflags.c diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile index 9effd0d45..ed0d3f80b 100644 --- a/lib/librte_eal/common/Makefile +++ b/lib/librte_eal/common/Makefile @@ -44,6 +44,7 @@ INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h INC += rte_malloc.h rte_keepalive.h rte_time.h INC += rte_service.h rte_service_component.h INC += rte_bitmap.h rte_vfio.h +INC += rte_reciprocal.h GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h diff --git a/lib/librte_sched/rte_reciprocal.h b/lib/librte_eal/common/include/rte_reciprocal.h similarity index 100% rename from lib/librte_sched/rte_reciprocal.h rename to lib/librte_eal/common/include/rte_reciprocal.h diff --git a/lib/librte_sched/rte_reciprocal.c b/lib/librte_eal/common/rte_reciprocal.c similarity index 100% rename from lib/librte_sched/rte_reciprocal.c rename to lib/librte_eal/common/rte_reciprocal.c diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile index 5a7b8b2ac..ce65d5ccc 100644 --- a/lib/librte_eal/linuxapp/eal/Makefile +++ b/lib/librte_eal/linuxapp/eal/Makefile @@ -91,6 +91,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_elem.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_heap.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_keepalive.c SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_service.c +SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_reciprocal.c # from arch dir SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_cpuflags.c diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map index f4f46c1be..d8b968c5c 100644 --- a/lib/librte_eal/rte_eal_version.map +++ b/lib/librte_eal/rte_eal_version.map @@ -200,6 +200,13 @@ DPDK_17.11 { } DPDK_17.08; +DPDK_18.02 { + global: + + rte_reciprocal_value; + +} DPDK_17.11; + EXPERIMENTAL { global: diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile index 04785f720..535b23d76 100644 --- a/lib/librte_sched/Makefile +++ b/lib/librte_sched/Makefile @@ -54,10 +54,8 @@ LIBABIVER := 1 # all source are stored in SRCS-y # SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_sched.c rte_red.c rte_approx.c -SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_reciprocal.c # install includes SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_sched_common.h rte_red.h rte_approx.h -SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_reciprocal.h include $(RTE_SDK)/mk/rte.lib.mk diff --git a/lib/librte_sched/rte_sched.c b/lib/librte_sched/rte_sched.c index 7252f850d..35c5c3cde 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -43,11 +43,11 @@ #include #include #include +#include #include "rte_sched.h" #include "rte_sched_common.h" #include "rte_approx.h" -#include "rte_reciprocal.h" #ifdef __INTEL_COMPILER #pragma warning(disable:2259) /* conversion may lose significant bits */ -- 2.14.1