From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0062.outbound.protection.outlook.com [104.47.34.62]) by dpdk.org (Postfix) with ESMTP id 6944FFE5 for ; Wed, 6 Sep 2017 12:22:41 +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=iejXsblL6K4xtmvx2Qezd18+XxWIzi3R+5s4Rx9v3js=; b=M8FOiu6wdqGnAz66dbh7fxNVH/sHc6et/EOKGipPDhyQBIbzQPyTD4mPk4gbiKxWOteUpV9FuOBk7I0d/PIeXYKyoXORByfeaoYyvfE8czhyHjOqp7rrAqFO2/v9w5y2RyfMMns+poyMXNzVfilA2xLFtieDokr4/bsnDa1gdb0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from PBHAGAVATULA-LT.caveonetworks.com (111.93.218.67) by DM5PR07MB3465.namprd07.prod.outlook.com (10.164.153.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Wed, 6 Sep 2017 10:22:38 +0000 From: Pavan Nikhilesh To: cristian.dumitrescu@intel.com, stephen@networkplumber.org Cc: dev@dpdk.org, Pavan Bhagavatula Date: Wed, 6 Sep 2017 15:51:33 +0530 Message-Id: <1504693294-2100-2-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504693294-2100-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1504693294-2100-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0105.INDPRD01.PROD.OUTLOOK.COM (10.174.56.149) To DM5PR07MB3465.namprd07.prod.outlook.com (10.164.153.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0687f231-0804-40fb-e5ac-08d4f51133ec X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(300000502095)(300135100095)(22001)(2017030254152)(300000503095)(300135400095)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:DM5PR07MB3465; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3465; 3:IGWbBQBeehFJXMI7pJveRy9FaWTmalDCYgawMPgKfYAzsvNfOwePgAfWYxPoyHDiza8pTSKwnPtRgpiRqFIGCpQiW91Ibvv7iycFxdGRDIxezGXiKraGaPB873z2WKp6lf2Hw4TpzmoppDG5k5cxI7SBsoLzp+oWTM2rdTA0pcYzLI+Ng0aZOQlgX5mpRh5xS+g+mE7J0YfjfSLLSHKYxM6wWZZJzxIb/liUXtMrB2xVxm+fbnCU7/BjZ538L3H2; 25:b8mGhjEljqDsW5WwE16PSyXgNCS6tCFuxES6iHJp0bvJm8M26+RoVVCWZlP5ERBRrFC0m0TEXMN5r/mZjxjWn44Rw3vIn9DmInVn+x5vfaUnOnTGVnts1envI/PYfucapWwy5BJWXLSq3S6f8oFO8z7Qnux7H2w43I+t/G9BV3XcgLFxPEAE6n+5FMbwBZOPfwHAmKrC1UpxuQRUL5CWzsw5tbFbiVU3SS38APJ0esQAro/6q5xDnuZXhZfD2VMCHEKwhrjtW3tFV+ExRj+KhNGGjLwfqseY9NfxD/Bx5TSkRHx/CVy2Il4Uqi91NKTnhfh2cA96DwD7vdssfrMZLw==; 31:XdTzCCA80Kqdkrn1KxaqsEuBUPpJcTp4N4mARskQFmXwtrpq7JlXLDL6GyFdbybspkHBuzIQQ8+dKHulhxAF5bRTzr0lJ61agGKgbaH+iZXcl10U5ZNlLGQqSzgffiQbDZaNQDhxZwN6+k40ieo6i7a5ca3MGFRLs8CYGpVUhoAJGcIXlvh3mMdl9wnNYp0zNt2k6a+o+D7J+hWFilZF6IlONqFtPBFtk90oWrL+ByA= X-MS-TrafficTypeDiagnostic: DM5PR07MB3465: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3465; 20:DqE2Kn2OiF6KFBOi47xxpAjoWLjhdV56k7hqG9l02TnKEocP3DecasFVwynmuHiEdOcBz9i+NcQ6S813jv6oS6MpvO5VC0t5vNdS7/nyTYMWLzUzV44b+8U6MZLWZ2nW8X4TRWr7th3scYtoUqs0QhvPJ/w5Rci69CewWOCbBBrUcpBE7Kls3uhwXeQ+tHXDReJBPA3sRRyRqsvDey2hM6ePlLGn46PzhqLX0WaBNunoqWjgfA12XtzFxwjqhY61pKU2epmx6O40+7q9wxi1Apje7GzTlXspEReU9ug3lRGJu4/pmS0Bo3i5Y0oJAiUWAmUhHbuiQ8RPmKqa3+ZcHyRNcPtLBeqi8U5NQmg0W4THqWcKl2FYqU/5GS5IzZfXe1B1fCCuehCsLIDigLWEoP8KKu2SA4Ap9k9IBEjqwh7DYSei0MxntcXl77kyzXW9wFrurxapUJd37+SRdq46cav3UyXkYSCaOfvHb4BOg6PJnXGwI4Z5iWDiqUxF+JfwiibqTVlC7SFlQN832nDhsH8VehSO5hQ416Ih1PHAbwDf5Ao2s8SLmn3s/01QGLvJo66pFzBH8diJZNq+JxxvzNKuH31RE8otiBAiBxct2sA=; 4:flSRCtYQnvSIHFTSlIql4o/HNQ/7Z+AxqCT3kfH+kGqwh1WUULEf0qBfTr227Ua2tJtuCtl9CO893Owjw3LSFv9YvDZrEsQTg8t0P1f8P+9BkJ3vBRG/vRkVMrttU/+ZXkenbDNvUEhrV7ybJV+hJmmZQe065dg5SIPjqwja/A5ig+JsagcYQ6cd3hUSFTX+OQ3LJHqrYaYnBl0aPLrMn633c+gbusm92vhVnvkJCBHzJe1C4RzluKTtJPf9ZFXU X-Exchange-Antispam-Report-Test: UriScan:; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(100000703101)(100105400095)(93006095)(3002001)(10201501046)(6041248)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123564025)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3465; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3465; X-Forefront-PRVS: 0422860ED4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(199003)(189002)(101416001)(5003940100001)(2906002)(25786009)(76176999)(50986999)(189998001)(4326008)(5660300001)(33646002)(966005)(106356001)(8936002)(42186005)(3846002)(81156014)(6116002)(72206003)(53416004)(81166006)(8676002)(105586002)(42882006)(50226002)(6666003)(36756003)(2950100002)(48376002)(68736007)(5009440100003)(66066001)(7736002)(69596002)(50466002)(6512007)(478600001)(107886003)(110136004)(6486002)(6506006)(47776003)(97736004)(53936002)(6306002)(305945005)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3465; H:PBHAGAVATULA-LT.caveonetworks.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; DM5PR07MB3465; 23:uoUmxBtjqjvaIiMPgb9pZLcTls8giiqkpOkkOmMFD?= =?us-ascii?Q?ZVh1itkSlIltdZG/pp8Zr7AoxbOqQ02m7Msh/3FVpSKOYuli8nNxD/5ZyO6S?= =?us-ascii?Q?ctd2W/bhjT1+Ss6WAb6MVSVDdZU0KlrOhaLrzwPv/GJB87gChELa8N/4wFrb?= =?us-ascii?Q?w3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xf4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2017 10:22:38.4244 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3465 Subject: [dpdk-dev] [PATCH v6 2/3] eal: add u64 bit variant for 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: Wed, 06 Sep 2017 10:22:41 -0000 From: Pavan Bhagavatula Currently, rte_reciprocal only supports unsigned 32bit divisors. This commit adds support for unsigned 64bit divisors. Rename unsigned 32bit specific functions appropriately and update librte_sched accordingly. Signed-off-by: Pavan Nikhilesh --- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 3 +- lib/librte_eal/common/include/rte_reciprocal.h | 109 ++++++++++++++++++++-- lib/librte_eal/common/rte_reciprocal.c | 116 +++++++++++++++++++++--- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 3 +- lib/librte_sched/Makefile | 4 +- lib/librte_sched/rte_sched.c | 9 +- 6 files changed, 219 insertions(+), 25 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index 90d7258..59a85bb 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -241,6 +241,7 @@ EXPERIMENTAL { DPDK_17.11 { global: - rte_reciprocal_value; + rte_reciprocal_value_u32; + rte_reciprocal_value_u64; } DPDK_17.08; diff --git a/lib/librte_eal/common/include/rte_reciprocal.h b/lib/librte_eal/common/include/rte_reciprocal.h index b6d752f..85599e6 100644 --- a/lib/librte_eal/common/include/rte_reciprocal.h +++ b/lib/librte_eal/common/include/rte_reciprocal.h @@ -22,22 +22,117 @@ #ifndef _RTE_RECIPROCAL_H_ #define _RTE_RECIPROCAL_H_ -#include +#include -struct rte_reciprocal { +/** + * Unsigned 32-bit divisor structure. + */ +struct rte_reciprocal_u32 { uint32_t m; uint8_t sh1, sh2; }; +/** + * Unsigned 64-bit divisor structure. + */ +struct rte_reciprocal_u64 { + uint64_t m; + uint8_t sh1; +}; + +/** + * Divide given unsigned 32-bit integer with pre calculated divisor. + * + * @param a + * The 32-bit dividend. + * @param R + * The pointer to pre calculated divisor reciprocal structure. + * + * @return + * The result of the division + */ static inline uint32_t -rte_reciprocal_divide(uint32_t a, struct rte_reciprocal R) +rte_reciprocal_divide_u32(uint32_t a, struct rte_reciprocal_u32 *R) { - uint32_t t = (uint32_t)(((uint64_t)a * R.m) >> 32); + uint32_t t = (((uint64_t)a * R->m) >> 32); - return (t + ((a - t) >> R.sh1)) >> R.sh2; + return (t + ((a - t) >> R->sh1)) >> R->sh2; } -struct rte_reciprocal -rte_reciprocal_value(uint32_t d); +static inline uint64_t +mullhi_u64(uint64_t x, uint64_t y) +{ +#ifdef __SIZEOF_INT128__ + __uint128_t xl = x; + __uint128_t rl = xl * y; + + return (rl >> 64); +#else + uint64_t u0, u1, v0, v1, k, t; + uint64_t w1, w2; + uint64_t whi; + + u1 = x >> 32; u0 = x & 0xFFFFFFFF; + v1 = y >> 32; v0 = y & 0xFFFFFFFF; + + t = u0*v0; + k = t >> 32; + + t = u1*v0 + k; + w1 = t & 0xFFFFFFFF; + w2 = t >> 32; + + t = u0*v1 + w1; + k = t >> 32; + + whi = u1*v1 + w2 + k; + + return whi; +#endif +} + +/** + * Divide given unsigned 64-bit integer with pre calculated divisor. + * + * @param a + * The 64-bit dividend. + * @param R + * The pointer to pre calculated divisor reciprocal structure. + * + * @return + * The result of the division + */ +static inline uint64_t +rte_reciprocal_divide_u64(uint64_t a, struct rte_reciprocal_u64 *R) +{ + uint64_t q = mullhi_u64(R->m, a); + uint64_t t = ((a - q) >> 1) + q; + + return t >> R->sh1; +} + +/** + * Generate pre calculated divisor structure. + * + * @param d + * The unsigned 32-bit divisor. + * + * @return + * Divisor structure. + */ +struct rte_reciprocal_u32 +rte_reciprocal_value_u32(uint32_t d); + +/** + * Generate pre calculated divisor structure. + * + * @param d + * The unsigned 64-bit divisor. + * + * @return + * Divisor structure. + */ +struct rte_reciprocal_u64 +rte_reciprocal_value_u64(uint64_t d); #endif /* _RTE_RECIPROCAL_H_ */ diff --git a/lib/librte_eal/common/rte_reciprocal.c b/lib/librte_eal/common/rte_reciprocal.c index 7ab99b4..2024e62 100644 --- a/lib/librte_eal/common/rte_reciprocal.c +++ b/lib/librte_eal/common/rte_reciprocal.c @@ -31,18 +31,13 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include -#include - -#include - -#include "rte_reciprocal.h" +#include /* find largest set bit. * portable and slow but does not matter for this usage. */ static inline int -fls(uint32_t x) +fls_u32(uint32_t x) { int b; @@ -54,14 +49,14 @@ fls(uint32_t x) return 0; } -struct rte_reciprocal -rte_reciprocal_value(uint32_t d) +struct rte_reciprocal_u32 +rte_reciprocal_value_u32(uint32_t d) { - struct rte_reciprocal R; + struct rte_reciprocal_u32 R; uint64_t m; int l; - l = fls(d - 1); + l = fls_u32(d - 1); m = ((1ULL << 32) * ((1ULL << l) - d)); m /= d; @@ -72,3 +67,102 @@ rte_reciprocal_value(uint32_t d) return R; } + +/* Code taken from Hacker's Delight: + * http://www.hackersdelight.org/HDcode/divlu.c. + * License permits inclusion here per: + * http://www.hackersdelight.org/permissions.htm + */ +static inline uint64_t +divide_128_div_64_to_64(uint64_t u1, uint64_t u0, uint64_t v, uint64_t *r) +{ + const uint64_t b = (1ULL << 32); /* Number base (16 bits). */ + uint64_t un1, un0, /* Norm. dividend LSD's. */ + vn1, vn0, /* Norm. divisor digits. */ + q1, q0, /* Quotient digits. */ + un64, un21, un10, /* Dividend digit pairs. */ + rhat; /* A remainder. */ + int s; /* Shift amount for norm. */ + + /* If overflow, set rem. to an impossible value. */ + if (u1 >= v) { + if (r != NULL) + *r = (uint64_t) -1; + return (uint64_t) -1; + } + + /* Count leading zeros. */ + s = __builtin_clzll(v); + if (s > 0) { + v = v << s; + un64 = (u1 << s) | ((u0 >> (64 - s)) & (-s >> 31)); + un10 = u0 << s; + } else { + + un64 = u1 | u0; + un10 = u0; + } + + vn1 = v >> 32; + vn0 = v & 0xFFFFFFFF; + + un1 = un10 >> 32; + un0 = un10 & 0xFFFFFFFF; + + q1 = un64/vn1; + rhat = un64 - q1*vn1; +again1: + if (q1 >= b || q1*vn0 > b*rhat + un1) { + q1 = q1 - 1; + rhat = rhat + vn1; + if (rhat < b) + goto again1; + } + + un21 = un64*b + un1 - q1*v; + + q0 = un21/vn1; + rhat = un21 - q0*vn1; +again2: + if (q0 >= b || q0*vn0 > b*rhat + un0) { + q0 = q0 - 1; + rhat = rhat + vn1; + if (rhat < b) + goto again2; + } + + if (r != NULL) + *r = (un21*b + un0 - q0*v) >> s; + return q1*b + q0; +} + +struct rte_reciprocal_u64 +rte_reciprocal_value_u64(uint64_t d) +{ + struct rte_reciprocal_u64 R; + + const uint32_t fld = 63 - __builtin_clzll(d); + + if ((d & (d - 1)) == 0) { + R.m = 0; + R.sh1 = (fld - 1) | 0x40; + } else { + uint64_t rem; + uint64_t multiplier; + uint8_t more; + + multiplier = divide_128_div_64_to_64(1ULL << fld, 0, d, &rem); + multiplier += multiplier; + + const uint64_t twice_rem = rem + rem; + if (twice_rem >= d || twice_rem < rem) + multiplier += 1; + more = fld; + R.m = 1 + multiplier; + R.sh1 = more | 0x40; + } + + R.sh1 &= 0x3F; + + return R; +} diff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map index 2070cba..2671627 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -246,6 +246,7 @@ EXPERIMENTAL { DPDK_17.11 { global: - rte_reciprocal_value; + rte_reciprocal_value_u32; + rte_reciprocal_value_u64; } DPDK_17.08; diff --git a/lib/librte_sched/Makefile b/lib/librte_sched/Makefile index 569656b..a2fd6f3 100644 --- a/lib/librte_sched/Makefile +++ b/lib/librte_sched/Makefile @@ -54,6 +54,8 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_SCHED) += rte_sched.c rte_red.c rte_approx.c # install includes -SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h rte_sched_common.h rte_red.h rte_approx.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include := rte_sched.h rte_bitmap.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_sched_common.h rte_red.h +SYMLINK-$(CONFIG_RTE_LIBRTE_SCHED)-include += rte_approx.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 3b8ccaa..7bb6d51 100644 --- a/lib/librte_sched/rte_sched.c +++ b/lib/librte_sched/rte_sched.c @@ -228,7 +228,7 @@ struct rte_sched_port { uint64_t time_cpu_cycles; /* Current CPU time measured in CPU cyles */ uint64_t time_cpu_bytes; /* Current CPU time measured in bytes */ uint64_t time; /* Current NIC TX time measured in bytes */ - struct rte_reciprocal inv_cycles_per_byte; /* CPU cycles per byte */ + struct rte_reciprocal_u32 inv_cycles_per_byte; /* CPU cycles per byte */ /* Scheduling loop detection */ uint32_t pipe_loop; @@ -677,7 +677,7 @@ rte_sched_port_config(struct rte_sched_port_params *params) cycles_per_byte = (rte_get_tsc_hz() << RTE_SCHED_TIME_SHIFT) / params->rate; - port->inv_cycles_per_byte = rte_reciprocal_value(cycles_per_byte); + port->inv_cycles_per_byte = rte_reciprocal_value_u32(cycles_per_byte); /* Scheduling loop detection */ port->pipe_loop = RTE_SCHED_PIPE_INVALID; @@ -2147,8 +2147,9 @@ rte_sched_port_time_resync(struct rte_sched_port *port) uint64_t bytes_diff; /* Compute elapsed time in bytes */ - bytes_diff = rte_reciprocal_divide(cycles_diff << RTE_SCHED_TIME_SHIFT, - port->inv_cycles_per_byte); + bytes_diff = rte_reciprocal_divide_u32( + cycles_diff << RTE_SCHED_TIME_SHIFT, + &port->inv_cycles_per_byte); /* Advance port time */ port->time_cpu_cycles = cycles; -- 2.7.4