From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0046.outbound.protection.outlook.com [104.47.42.46]) by dpdk.org (Postfix) with ESMTP id 58CCF7CBD for ; Sun, 3 Sep 2017 14:37:08 +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=fVydKCZUOHRIXuYgHrRrRyec65VCVDSy87ilzeY1h8U=; b=bF0RxiyWq9OiNU8PUsayzzFLQLSxQh7oKA37TLWlGuGnx7epspfdkGM2L4uCaMAINKOt0V697GwpNoBWoKibmYf79sTYob71EE3P1t/EKt63lFLM8r9aeuU3nw0F8PzDoA0fzoj2Dc9m/UKbscAf/ZfyhD9pS/lQOS0/ie2+Veg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Pavan.Bhagavatula@cavium.com; Received: from localhost.localdomain (103.16.71.101) by BN6PR07MB3457.namprd07.prod.outlook.com (10.161.153.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.13.10; Sun, 3 Sep 2017 12:37:05 +0000 From: Pavan Nikhilesh To: dev@dpdk.org Cc: cristian.dumitrescu@intel.com, stephen@networkplumber.org, Pavan Nikhilesh Date: Sun, 3 Sep 2017 18:06:28 +0530 Message-Id: <1504442189-4384-2-git-send-email-pbhagavatula@caviumnetworks.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504442189-4384-1-git-send-email-pbhagavatula@caviumnetworks.com> References: <1504442189-4384-1-git-send-email-pbhagavatula@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [103.16.71.101] X-ClientProxiedBy: SG2PR0601CA0005.apcprd06.prod.outlook.com (10.170.128.15) To BN6PR07MB3457.namprd07.prod.outlook.com (10.161.153.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 639ca773-0c08-4daf-8591-08d4f2c87cc0 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:BN6PR07MB3457; X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 3:gQBhKmzU3/s3820WdA6eE/gDzKuY8ROC5LNRTRHmPAIm5Wvcxcd7zf2u4nm081XB9kFicG79ckUSQZKGJL74nA99O38lbvWZL9KIOepBUyWPf72XhYOq7SWbJ6S7FcjviSPOBl38rnj6ZyFbHmvWpLsqz9xi+WA4lOHXkUkoUc2Lyaoe5CLYB4+xumZyGLxFx1VfO7AArdhugpRLBlR2Ma4bzo9jk0MF+SkeriUWUo5yU2VrubGEZEluSkp7mD8c; 25:iv4AVohIQ66NtTeFhVpLnIyBVNaHKuKoYGO/Dsjd6T05xF6Grk2BD5VPqJZuHK2qyO3w+0F5K+Njc2LK7eZnB+TeyyWbqIYSNHMQGgIMGP2ZTyOUGZ+SbZ0svayF+9dQzxvkv/JpZtfZFfypca6gGwGJpcbdht56odxUETQOFcagfVcDEphdAZ4+utY3TRC8kNOYtOr1bHHF7u/TAlxQJwDcf9KQqwlqsDokQCYvz9lZwWMPrBpBvnpTxA2ciglxyS2/WGtWir1NwrqvjlEHngU34kPWwkYdy3Tv2zNHiWn3d2Qy36k6HdKmL7YeubEnwVkCXfEBIAeTO7oBOFuQfg==; 31:xJtH+vXBZbk0sEQbURkvnkB2c4vLq0f6kPobqS4+Lw0oPefG7Uhs1J/K73OpWCi0wm+DjDFI3PbfuyVJ5P5JqMNMLnLrFXweRnaZJx6+pdR8wHGgf4HZPqxpoHWhlIPZ/b/p2diW7z+KEIc5dECh3d/TOBPywgKeTiBp9qEArWsMHkaBZyJpPQT+LZqtHDh9vtyNKaeVk8dmuEACsoZESxGAQLmoP770c2pyfxfpOPI= X-MS-TrafficTypeDiagnostic: BN6PR07MB3457: X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 20:HtTfodmnP9yaOGU/gGUAOfILqFKt10I+ItNzpkj6PgwvNP6iS1JR6tzXvyBh7i92fWLFxYSfy6pwrZnejDoE3dYTdIVGTML1+ArsjfcUprqOtJMd+I8Smf3TRTueWdYaePIq4JPe04YIf7VCRxwI+q/ic/mc5evWArAnzG5ome9swSgUwbVx8QRgX0dfvS42fXHRo+zddO8rs08xYLz4m8bQb0+2+jCScAS3caI/5ZEyDA0FEm1QCIj1/70jV5egqdq4dumGQjeVu6vD+T3fs5/wvqA6BM/tuP3MlABYnJ+yho6nbXf8afDnR9yrVcmeqmZk/hOvW/I8DAo1CS9y7IPnj48oYQAvWE7rl1gshymCqrDH5ldQBggIDZBGK9qrbn93Ud6NOYlsqomW+4Bd3o8F2YsJbm3LlnyDs/GBsoVR694ahFmTTjtNvkpnRxSokto6aEaLkKtTcm8y/TrPJ9FQA0KAjRlIzAQP81UOSTSBYnIq99ebJN11EnpmeiXsDWhJvIrRsnXuAE2OflS1mVB2oe1XAzVXAOvL7PvVrK5IhSWiSetFkorz/rjrpIyx7bdVelmgU34pqN6vlfmDgVxcUZ6W32x9T1HRovcymR0=; 4:RC1a2Y9QdkJRRg3+D+EgJ9LprLeoZqqDk6+kCaAITUr4uIAIT/QPzmab87LIoMByeasNbriSWBdF+OWVZMIDDPU5KGlV3PjHcY6qyx1DHLJUP4GtcenJbXUof0biYXv+HQCGrLHPKPyK2XmgTuiNt2WTJU3QLv1KdsRD6LciQHNKIxPgiwp8VZD/AcXa8ZZYxNcO6prQKxtCaSOxl9e0q5jUtU0229uQMtmSdA0wYdl6UTZWAo2kK65/rzllM+CB 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)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(6041248)(20161123555025)(20161123560025)(20161123562025)(20161123564025)(20161123558100)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR07MB3457; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR07MB3457; X-Forefront-PRVS: 041963B986 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(189002)(199003)(107886003)(5003940100001)(6116002)(3846002)(2906002)(189998001)(5660300001)(575784001)(110136004)(48376002)(53936002)(6512007)(6306002)(97736004)(50466002)(33646002)(66066001)(2351001)(106356001)(2361001)(105586002)(36756003)(76176999)(6506006)(50986999)(42186005)(47776003)(101416001)(478600001)(6486002)(25786009)(81156014)(50226002)(68736007)(8936002)(305945005)(72206003)(8676002)(81166006)(966005)(7736002)(6666003)(42882006)(2950100002)(6916009)(4326008)(42262002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR07MB3457; H:localhost.localdomain; 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; BN6PR07MB3457; 23:3ViCFjER1Ch1w3GR0SOWyYjSNboHe5C0ynY/ADZGl?= =?us-ascii?Q?huxVXBQGgLUvSquASI6L+49CTfIV3Wc2TJkjltRJArXxD+6hfnYpRGZe3kQy?= =?us-ascii?Q?p2x1KJpqIRaN8eAwUV/y+iAzj0l3qwl2vfQFnu/mLn+RPP+8KZo5vbM9X2hu?= =?us-ascii?Q?OpslwElM0xLbSOA7b+WJ6rzg3wf7gwEsRLDWWnxtxFDUJPruOLHrueGBfJas?= =?us-ascii?Q?BdSfX43DcT8jcQml9euYj9nwf9RS1F79QB3YQjhkMseQLrfieK0dEBDhqqFx?= =?us-ascii?Q?Kr+hnJwBlL/yf8FdW1HlOTse98M2w1tqINgqBaxdHqTCoTImHSrg7dD7OHV1?= =?us-ascii?Q?oEY96BEFCP2s6zJ6/zFf4K+R/wYs7sdGNZOsgTAbGKBKwbipKu7qmzINgt1Y?= =?us-ascii?Q?R3BbEv2GKR/mQ/6V1wlsVYv5u3UP5Yg9TMBKpzdRdRizGG8Kd5Ty5++nC4RK?= =?us-ascii?Q?h2TRb8nly6xjtkpcejXGAimDlHeNzk5TzkAr6kM6GxudWci87YC9QtdQfqeX?= =?us-ascii?Q?2XxsPrGGSDctGSk+Y3kiF78QWgI28kCfN4V/9r8ldsRLa80mLo04M0duenfh?= =?us-ascii?Q?jET8MYjypsqftE8cIoYQKa7c1cOE40QlDsbckr5/BLv5JfefiTKe43mJS4mz?= =?us-ascii?Q?Y/dpLyTPjQQ0giaOdlqySB+LGkNYu7udv43e3dDj50/reTxPedqDeOZZUbWG?= =?us-ascii?Q?7FTFF9uWvJoW+AHt+ZOmimB75VioB90PlfjC+rINf5KGDk8lGAFxzQRM9p0x?= =?us-ascii?Q?lElX4q4QUqsBSx5Tqqi3TdibQedK2xZy8yAAoe/qpXgJsXGWDPmxyXbT9Eis?= =?us-ascii?Q?TKobpefa6WAZrtcfiPMMi6ndq8b3N0QIDQXzUjZk0iEta7CF7buv98fBV0FD?= =?us-ascii?Q?GfzQT2Z5jYPzudIje9osheQVvwLE4PV9DzDA12+juQ3c6P6fVPFsMBS3jxnB?= =?us-ascii?Q?ngj2JlalWTQUIqHg/jip99DQ/5wIO5dQIZgEBLbwuKqQIMTSP7KWJ4FBUs0S?= =?us-ascii?Q?flw9xCy5rRrzPdJWtWXRXsAgdbR50KWpMQi1QBrRCpie+cCzQPJ6DneNhuEQ?= =?us-ascii?Q?wu+/Ak2yILSKbGfc51mrlbVH13LitCHHTJ+tEt686OQMmNkcXWHv7QmuFQ2X?= =?us-ascii?Q?c61SOZRu1TiGYYDIZqM1vpyoUVs8cwKR5QPu+mDSCnE+YT/gSRe0cAXWnRDt?= =?us-ascii?Q?8QQCJUF7Y15c7kcbddmMBbi9vi97zvSLQzP?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR07MB3457; 6:3d5fSE6XScobKTUn/Wlcupl9osjK6fPz25ldVviPAmOuImioAcM0Obz2QIXGj3hU46RNVrV7frRRrgeWoNJglZGoozDOXxFIME43n1x3EcrdEO5cjbQTgy5Syf1tWSRaXWt2BxzMzSknjl4SUkZ++rTrgI5byZE/AtoIF1oigcQHoFjTzsWC29FhMG4tFBlQa0htF/1atHwBcR7VS+F2oHwVD/AzD+G303o09m3GrBZizZvJqJxd2LSzuHHC03VismCr8YUDq3VxEiO1bFWDE/vffxjJ3pENwxZ/EQ21k0Q6RTkvLuboq08TWXeb/qbMasoZzWNiOZAE/bk6bkYF/Q==; 5:/RoNydJ8a9DqluwXQFmNXW3fvJ4g7aDYxH/9IFpUX83njG9TMZJeceDEF+d0v0jiHl2X5ZV2wRO454GdQjfAR2D6WNlxXiusiPPTrx0dLCUn+RVV/5NFsGlE+328qXlbCCXJh6GS46jgrkPpdC1GPQ==; 24:fuv18AR8rl/IyJuzTkevA1uy/qkJWHe1rOLI5SiCbxA8GNyndtIv/Dr7m+nZhyoJj2nHXm6UqAREyl13++4sBPF/W5Zauije7EN757RBUc0=; 7:Ng4d05aHVK3SF9yRLYj3KjN/RfBOyHH/yGhoeqTx/lJEpJITxTfOWnPLb8Mju9CC8g8SmVyZpMum427RNlw6DoBDSbEX7ZoO6DD29twmIWMiKAZQASkWDdBnkkqCBWSietLkMtSKmu4nGSk15Pw67nDMxWEzBBaozMmDOwOGzNQ6FVhQeWK6jY88kEJO4iE7So1xXj1M7o3cAjTNdV8IJWb8EXzDgNFtq0QLkxX2i7s= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Sep 2017 12:37:05.0830 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR07MB3457 Subject: [dpdk-dev] [PATCH v3 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: Sun, 03 Sep 2017 12:37:09 -0000 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 | 111 ++++++++++++++++++++-- lib/librte_eal/common/rte_reciprocal.c | 120 +++++++++++++++++++++--- 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, 222 insertions(+), 28 deletions(-) diff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map index d0bda66..5fd6101 100644 --- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map +++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map @@ -242,6 +242,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..801d1c8 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; -}; +} __rte_cache_aligned; + +/** + * Unsigned 64-bit divisor structure. + */ +struct rte_reciprocal_u64 { + uint64_t m; + uint8_t sh1; +} __rte_cache_aligned; +/** + * 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 = (((uint64_t)a * R->m) >> 32); + + return (t + ((a - t) >> R->sh1)) >> R->sh2; +} + +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) { - uint32_t t = (uint32_t)(((uint64_t)a * R.m) >> 32); + uint64_t q = mullhi_u64(R->m, a); + uint64_t t = ((a - q) >> 1) + q; - return (t + ((a - t) >> R.sh1)) >> R.sh2; + return t >> R->sh1; } -struct rte_reciprocal -rte_reciprocal_value(uint32_t d); +/** + * 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..5d7e367 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,21 +49,120 @@ 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; ++m; R.m = m; - R.sh1 = RTE_MIN(l, 1); - R.sh2 = RTE_MAX(l - 1, 0); + R.sh1 = l > 1 ? 1 : l; + R.sh2 = (l - 1 > 0) ? l - 1 : 0; + + 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 65117cb..63ff2b8 100644 --- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map +++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map @@ -247,6 +247,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