From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0077.outbound.protection.outlook.com [104.47.37.77]) by dpdk.org (Postfix) with ESMTP id 9565B37A8 for ; Fri, 20 Jan 2017 15:21:41 +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=GDf1/9AffH/BJSJbZp9V+8grrVepGfm14xwrS9ROxDE=; b=cf/Eafj0kZGfx+xeYhDYHHpXmbS5jCSN78pXo4bDF4FiC8Y2iqO0IqKi0RLvKBe0v/J1RHC4t9s6T4MTGPhCcIgtnDTHwxS4k/Ukv4a0yt9BQRW9ZvfM8g1SK9i1OAGUafs4a5NlvhUaSWdpo2NZpIwI3AC+2n+IU6vro3lIVFg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.860.13; Fri, 20 Jan 2017 14:21:34 +0000 From: To: , CC: , , , Santosh Shukla Date: Fri, 20 Jan 2017 19:50:17 +0530 Message-ID: <1484922017-26030-1-git-send-email-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BMXPR01CA0004.INDPRD01.PROD.OUTLOOK.COM (10.174.214.142) To BN3PR0701MB1717.namprd07.prod.outlook.com (10.163.39.16) X-MS-Office365-Filtering-Correlation-Id: 3f9912f4-dc5e-4107-210f-08d4413fa5f4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BN3PR0701MB1717; X-Microsoft-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9wwe2YZvADQybShQBj+5DLL8cdafQ+iMXtbkkJu0ITYdxF6C216dcg8X3wRkDV0ncTJMKcvLcdh1Pro= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 31:uc3vwm/6MKeRXU65R2avmyYLLG1zy86U+35+/2iVXSI/iJpBQ+C63jngWEL6tGI1lYZCMZDK8oloB4bMjLzDLfXmA/gDVSkK0XHn5+Xu9XbYexG42iFBb4N+o947MqUevmBkLg5p7lRITrTWagCGL8sZpfpmPXMbwK7HgHM97P1GJdF38KdI8D0fww2wIsv9G8Yxn5tn/4kMexcAwVif6rK+X+b8FcUVBakDhFHbRBeWPM2E/505YOssFkxp458F6Gcoz6pAoE+erE42KJA8d9BfuoQQaxnNfMLJoeO+2UI=; 20:egx0HB7AZyW6ox4kFtAtl/yhRvSzhFPxEuXHhOz4Mxe2uqChsf9V5Q2BsUS947kNOTSJ10DmE6OzF03qN/no24rL9p0QdrsqlybneyzDmV81PJx8EAKfCDOy/VXP0/cpbdcVcB/CKLYSKaf78sFy+9IrmKTCt0Vb2gGqLyK5iT33PONikIOkFF5tPoBM6jxYn3KxrhKZ/8tIhc3GXRbZaKmPK6mJFnZURDPQTAadnduyzyWMhpstaQygfszzt2PDYvbKg9bPxlsigTWqsCBZxpdknJZu4AsQTORk9jEuL8Mkplb8hTaNhLoE1cmwOgOdNwWiR3ZVPNpUawst9xIJaESPm847WfcG94WrRY3RKhkMb6DJRyiyGFiwltJCnKPy94uUB/LZAWU+rhBs5mRXoRxY1BhsKnEindx8YXlHAQl+VpE7387lwSW5EQFk0trb0WgYNlMnHt2eUlc1WTsgSy3od0+78ALWH5wZO4fDtuxSCUV4aU/o9k7vR6lh29kx4EpbsTzFalXoNMfLpVJ1Zotfp6tK4eB4rRiaTyi4DUweMxyFrbkLOr8m6Zx45zhvC4mIreqwV1k6WNTu/jNwIeTdCv50DxsqLt7CkiHgsSU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123562025)(20161123555025)(20161123564025)(20161123560025)(6072148); SRVR:BN3PR0701MB1717; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1717; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 4:mqXp57mOMo5UM5Cu3bySbkowjjek5saiyhEH+EdqX4WDCz5zozizztSDZuHZ5hoNwvT10TuLYACZgjbNEaE3zEtKXcInTjI4ASll3T6AwGLd/3SBm67sK5+iZeAn+XcUVa+9YFjsOf+WNE0aNLu2xpt1r5Paxf40LsNz2JOZJTe8qtOjiUoyCZ0+L4TNMtMTyUMLWLRlrmYvc7CrP74xOXqBd8+AeWqEl4ZVCxHoszfEmuYuzIvUIMmO78KkIHDhGHxbXkVOvNze5X90WXmnnOsGXHDeYj/5NGnv6eW1TvXISUIEcvZxHVYYa4tGxfnwUd4kQZ6KqPP3YCwuayarNi4JZgTjRCg3FamikVBnk6FzfVGGulSDdcg0yp3URtGFXjLJWPsPapAxpbaJCg7wBhDLEul9iZYXJpq2xh3YrDn5eYpAQw8wcSPG+Om8QZXlfxu3c1CIFH1GdSueUaMWxABrrrcIDV0xpTXivnKghzjBVX18o+lWKSMp77IuhXAZvkSRhzFL6ZFSu6IBYD4J6FZKDD6vKMuA/xrPhKc/hpSTxnCSuRPE15PcRYMCaRGfEW3WzpWIPX/BtlgClbH0OQ== X-Forefront-PRVS: 01930B2BA8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(39450400003)(199003)(189002)(53936002)(50466002)(42186005)(101416001)(48376002)(33646002)(50986999)(66066001)(5003940100001)(6116002)(3846002)(47776003)(36756003)(575784001)(105586002)(92566002)(2876002)(4326007)(106356001)(2906002)(6512007)(4720700003)(81156014)(8676002)(25786008)(6666003)(50226002)(42882006)(86152003)(54906002)(8656002)(81166006)(5001770100001)(97736004)(5009440100003)(4001430100002)(107886002)(189998001)(68736007)(5660300001)(7736002)(305945005)(6486002)(6506006)(38730400001)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1717; H:localhost.localdomain; 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; BN3PR0701MB1717; 23:hsyOlxugrzljAIRmvEcJ6x1Gvs1+zy7s8Qk/dU7?= =?us-ascii?Q?iLm89z37N0hOppq1ECk5YX1Y3OdPHgOyujXAJFbBN7hCNcQ5WEofwSTXlSZs?= =?us-ascii?Q?ElR9XTvVgSLVgLPv+lu60b6yn1s4nj701XupiTm7x90pVeCeuhJiE4UA+wyf?= =?us-ascii?Q?p+l1WPWJpZX+0gANvXoLiy5o5MmJhW3ysMvvDi1tUSjwPYS9zHJQCPlKOwcR?= =?us-ascii?Q?5ej7lH2eoWO+xScnzE0qU0O79FTCIFbFVJJL4CcNtcJP8lsn2jg1UmQruT7C?= =?us-ascii?Q?WBVI/O8NViV2JsMaxd8YM6YZhAeN7NKiiUNqKwMMgVR1UB8H5+ndWu6SdZ7+?= =?us-ascii?Q?D03mneFGPIm+gfOCyzKAhSUAN8jMc1BR9u+YKwMRTrSrc/0k1ltvn+yUPUTq?= =?us-ascii?Q?+tO/G2pZxw0aVsOyKeKZOMJUN3tA4h9wbFuohcsecd57Asd4mRYpHKVJ+o6g?= =?us-ascii?Q?v2ufpfxy5aJf5t+D3aEAyWsodDTRre8N3Al/zJIGp9lt1QN0zzK5T9Hc5TKm?= =?us-ascii?Q?AyrEG86fG+PMGkVXTAA3vsQ+X3v1notn+8lJun1j6v3lj+OoXAA8bE1naZT4?= =?us-ascii?Q?iQvKZ7efsSLpR3Y5uV8CGxgty6pNr32MEmiRw6LGPOjab78ztSw5aP17039E?= =?us-ascii?Q?LWNA+tTZizheAP4kAUoqJw1B2sF0YcnmHQWrMJ40eCZCx7sOgSi/bL7GGJLm?= =?us-ascii?Q?uJotfe675toGhUMLHu/6buusseGzLQFzBXc6Krygb+ckli74V6FtshzCUChx?= =?us-ascii?Q?CemmteoqGBS3ss0gB6lTa6kO0ZzUGyNPhyhMQoysE6WevtwjaCNX1oVUfOqb?= =?us-ascii?Q?5uY565TYvDhdq4pZNalKIPBicfnbubWcssu/DsovvXXJFat31FmsikgjJndB?= =?us-ascii?Q?d+yMewNti53CMjvsUBWl6EPXBKvkg9dXTUGSyK5+998eu+yBLdgBJmKb7iNF?= =?us-ascii?Q?GE8woCv6mr7fP7Q65FZ3yabBYC6CemUcF3CQ1IuLVD2mRQlRBTSCXu8we242?= =?us-ascii?Q?rflmMoZHRbyro81XSKhQlcTg3iqo3RbsAjyxmG2lANWb5YmqbQDkCbwAJ5A1?= =?us-ascii?Q?sFLyf0dNVbVmeBfv51060He/00e+lXxIEpmrOHxYO/WbKbRu4fxWuRB92oV3?= =?us-ascii?Q?55YpYEYmok2pNxOO30S2rfuKYz4dZexw1WCax56NtjzMUQI0J4BeZzNMaqnU?= =?us-ascii?Q?U3yVZU4kMCR2Ov82ot7KGtfAiD924B+ZuIN4zHM3qR42YmKZuoxWAJghhtPc?= =?us-ascii?Q?YI2qGKSasFgR50i/Xj5/V7vgAxFzmVuXSi52r1Eek3xaBgs4CyoWkIti+WyD?= =?us-ascii?Q?vGw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 6:VNW1Ma7WjEzbIXclUByx+7LB2KJfgvifCOoFSZo10h66JiPHGER9eDQXm2jPDDBU57PBX9WJhNkdR54eX+XT4tGfSFeZaAayLqshOqjQvXLukF266SXckXH0xe2vzPC7TzQHrLmqEx/t/e0axQdeACD02xfqgz4+TaKXxo/wMxIF2Eeil6q+xEXgK0LAhPsnrbg+yoBtKVwYrcYo+815zFmp2h5mNTGAOgZEUTrNGnds52uOXPXKj74xHC6+17NwWmD/lFgnR+fsQ35HY9DwOfmiO5OYan2IsgXOh9k2HA2AOaCr56S5iBqoQA/86tmoe/iFQJ/d1uPLUiOahdOmQ5Vx5Sr61VmMqwpbwMpmP7rNyT3a7NCNfH4pDezP7KbdMHEMwDcldFKNZoQr7LOzA1N1HzR/u/cPVhq0T9C6zF8=; 5:lAu7xBFjWbNxHFmBrokeyuc4wVKTPUZFlnrJelKln2gPFnu42lCMf+S9hwYg0Dk5kNZnfXhWDAo2ZRHaKukmPhVHJEZ+aKRU1QDn6VMZIKMzuzAZPgIQ82GJcMqFBuSP8MwK1sK7DGU6+7bH8DpKqA==; 24:JVXVf0vcCx0YxPhnZg7fKpM7v2oHudB1N/Nh5qzfIzACh1u3WnZQgKCoj1upDtDV3f3R24v+q8kqdjAj8wx68iUbrEi7h4K5ccHHfxNsDoQ= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1717; 7:OVc2fRiRXufVKUNhiL//iW0ugZ2gap2QbNUJPi/SVfyMvLWAgOiMY7kPyNNkzqUDddL5pCa+Xl4YZXS2/moXWObv6Debe3lepuQHX9czrA+MY7cRdaRHNe55zx4GMfwZ45lm2GkxAvS12yoEDAQ/JcKnIgZBREJonBgBTbIJntEDCzia4lrdiIANhCAOj8W+JzEMMCNDHAMpX3ynJFSOJ/UlYtehCqDXAQof5TCBxcL2DJ981Da5Laf9NvkOl+SX1q487yqoumMjyxbH3AjKybik4+U5sYgk+MPj8vQS5oED1JpEojSBUizcGXJnQ3UQrJwSffXG2pkYJLcpwTREmoOp4NTcq+OCwr6JI8wVBN9TD069ZMiHPJtC+nkF2G5liQsO3qNqkH8kZg0woX9WH5suxIv+Gfkw4q/gDvfXuSlABsQcNgPTReE3yJSVFroSIp3YM/8bdo4Q4VK6fLbF2A== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2017 14:21:34.5722 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1717 Subject: [dpdk-dev] [PATCH] mempool: Introduce _populate_mz_range api 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, 20 Jan 2017 14:21:42 -0000 From: Santosh Shukla HW pool manager e.g. Cavium SoC need s/w to program start and end address of pool. Currently there is no such api in ext-mempool. So introducing _populate_mz_range API which will let HW(pool manager) know about hugepage mapped virtual start and end address. Signed-off-by: Santosh Shukla --- lib/librte_mempool/rte_mempool.c | 4 ++++ lib/librte_mempool/rte_mempool.h | 22 ++++++++++++++++++++++ lib/librte_mempool/rte_mempool_ops.c | 17 +++++++++++++++++ lib/librte_mempool/rte_mempool_ring.c | 4 ++++ lib/librte_mempool/rte_mempool_stack.c | 3 ++- 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 1c2aed8..9a39f5c 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -568,6 +568,10 @@ static unsigned optimize_object_size(unsigned obj_size) else paddr = mz->phys_addr; + /* Populate mz range */ + if ((mp->flags & MEMPOOL_F_POOL_CREATED) == 0) + rte_mempool_ops_populate_mz_range(mp, mz); + if (rte_eal_has_hugepages() && !rte_xen_dom0_supported()) ret = rte_mempool_populate_phys(mp, mz->addr, paddr, mz->len, diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index d0f5b27..3ae8aa8 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -387,6 +387,12 @@ typedef int (*rte_mempool_dequeue_t)(struct rte_mempool *mp, */ typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp); +/** + * Set the memzone va/pa addr range and len in the external pool. + */ +typedef void (*rte_mempool_populate_mz_range_t)(struct rte_mempool *mp, + const struct rte_memzone *mz); + /** Structure defining mempool operations structure */ struct rte_mempool_ops { char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */ @@ -395,6 +401,8 @@ struct rte_mempool_ops { rte_mempool_enqueue_t enqueue; /**< Enqueue an object. */ rte_mempool_dequeue_t dequeue; /**< Dequeue an object. */ rte_mempool_get_count get_count; /**< Get qty of available objs. */ + rte_mempool_populate_mz_range_t populate_mz_range; /**< set per pool + memzone info */ } __rte_cache_aligned; #define RTE_MEMPOOL_MAX_OPS_IDX 16 /**< Max registered ops structs */ @@ -438,6 +446,20 @@ struct rte_mempool_ops_table { } /** + * @internal Wrapper for mempool_ops populate memzone's va/pa addr callback. + * + * @param mp + * Pointer to the memory pool. + * + * @param mz + * Pointer to the memory zone. + */ +void +rte_mempool_ops_populate_mz_range(struct rte_mempool *mp, + const struct rte_memzone *mz); + + +/** * @internal Wrapper for mempool_ops alloc callback. * * @param mp diff --git a/lib/librte_mempool/rte_mempool_ops.c b/lib/librte_mempool/rte_mempool_ops.c index 5f24de2..ea79fc1 100644 --- a/lib/librte_mempool/rte_mempool_ops.c +++ b/lib/librte_mempool/rte_mempool_ops.c @@ -85,12 +85,29 @@ struct rte_mempool_ops_table rte_mempool_ops_table = { ops->enqueue = h->enqueue; ops->dequeue = h->dequeue; ops->get_count = h->get_count; + ops->populate_mz_range = h->populate_mz_range; rte_spinlock_unlock(&rte_mempool_ops_table.sl); return ops_index; } +/* + * wrapper to populate mz's pa/va addr range and len info to external + * mempool. HW mempool implementation to cache-in this inforamation + * in their local data structure. + * Note: api always get called before ops_alloc(). + * */ +void +rte_mempool_ops_populate_mz_range(struct rte_mempool *mp, + const struct rte_memzone *mz) +{ + struct rte_mempool_ops *ops; + + ops = rte_mempool_get_ops(mp->ops_index); + return ops->populate_mz_range(mp, mz); +} + /* wrapper to allocate an external mempool's private (pool) data. */ int rte_mempool_ops_alloc(struct rte_mempool *mp) diff --git a/lib/librte_mempool/rte_mempool_ring.c b/lib/librte_mempool/rte_mempool_ring.c index b9aa64d..7d32384 100644 --- a/lib/librte_mempool/rte_mempool_ring.c +++ b/lib/librte_mempool/rte_mempool_ring.c @@ -126,6 +126,7 @@ .enqueue = common_ring_mp_enqueue, .dequeue = common_ring_mc_dequeue, .get_count = common_ring_get_count, + .populate_mz_range = NULL, }; static const struct rte_mempool_ops ops_sp_sc = { @@ -135,6 +136,7 @@ .enqueue = common_ring_sp_enqueue, .dequeue = common_ring_sc_dequeue, .get_count = common_ring_get_count, + .populate_mz_range = NULL, }; static const struct rte_mempool_ops ops_mp_sc = { @@ -144,6 +146,7 @@ .enqueue = common_ring_mp_enqueue, .dequeue = common_ring_sc_dequeue, .get_count = common_ring_get_count, + .populate_mz_range = NULL, }; static const struct rte_mempool_ops ops_sp_mc = { @@ -153,6 +156,7 @@ .enqueue = common_ring_sp_enqueue, .dequeue = common_ring_mc_dequeue, .get_count = common_ring_get_count, + .populate_mz_range = NULL, }; MEMPOOL_REGISTER_OPS(ops_mp_mc); diff --git a/lib/librte_mempool/rte_mempool_stack.c b/lib/librte_mempool/rte_mempool_stack.c index 5fd8af2..6b0b2bd 100644 --- a/lib/librte_mempool/rte_mempool_stack.c +++ b/lib/librte_mempool/rte_mempool_stack.c @@ -141,7 +141,8 @@ struct rte_mempool_stack { .free = stack_free, .enqueue = stack_enqueue, .dequeue = stack_dequeue, - .get_count = stack_get_count + .get_count = stack_get_count, + .populate_mz_range = NULL }; MEMPOOL_REGISTER_OPS(ops_stack); -- 1.7.9.5