From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0060.outbound.protection.outlook.com [104.47.41.60]) by dpdk.org (Postfix) with ESMTP id 4B6541B1F5 for ; Sun, 1 Oct 2017 11:30:03 +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=PSU92W/7kbLlOwjTKwBXFpWD0dcgWc3KJCBg+oxhXuY=; b=Vuw8TEccRXC2/p5LNuAnbT4C9hwZSI8MYj6LUgi/JWOihMnTvacYP+1KGIQeshF7VWEY1gF3m7ni1Ey0vEa3uyE1pKWjzaVL17rVmSlSMGjxw7wcjLkuelbsmZYwQL4X6Tg8wrogAjpsOe9ADNz85z4KFXkKPjPy3gOGbtvAHYM= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Sun, 1 Oct 2017 09:29:59 +0000 From: Santosh Shukla To: olivier.matz@6wind.com, dev@dpdk.org Cc: thomas@monjalon.net, jerin.jacob@caviumnetworks.com, hemant.agrawal@nxp.com, Santosh Shukla Date: Sun, 1 Oct 2017 14:59:02 +0530 Message-Id: <20171001092902.10842-9-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171001092902.10842-1-santosh.shukla@caviumnetworks.com> References: <20170907153042.30890-1-santosh.shukla@caviumnetworks.com> <20171001092902.10842-1-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0077.INDPRD01.PROD.OUTLOOK.COM (10.174.208.145) To DM5PR07MB3098.namprd07.prod.outlook.com (10.172.85.8) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bc81e614-b3b6-4b0e-ccd8-08d508aefdfe X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:DM5PR07MB3098; X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 3:zM2tQSQS5yXyqZ+tY6IF3l8g6t91Stydr1uvjrT1oMkVM29niYKkYY8EiF7XsQX4XEsKm5DKa/tjB+5YhfAncV7YsrUe6Y1Zt9G5deqb4rkzm5sVCVdYc13PpF2WmQfuz/LP3md6zMbuRZfzG3PyEBhttg7vh9GvT80GtVGTTLs2pNfAbtfITc5nyj7TpGmJ5UT7Bz9+XjkZYtFSeEVAoBa5G0QqI9BjZgWgFlY/VKTdP5lRAnuyiX89jDfIqcyH; 25:DLPt/u5zrGAmt9DG24Hz3/c+QmOWmeZaKrXZToATlqMW47IzKqe4rjaHmHP+IsRyRCSU+VpSNqJV/9qQTYkLaaZWPHB5U37eyDHfeJvu/kDecX4O1R4Th//Uhq326MGWzbvhVmgJeq2Dzafeo/i6aV/66gtb2p5Q3ckaHR28MvHpHY+Go6KtxFZiGneu8o/QNLXj8JttD8q01MzGt3C7DNo0yXOTigiDLZknege+BraiwktAK56MqX7k7Z5Nxo/Lf8YNykJEkMvQl8FCif6J0uOT+/1R97VOS/zxwKVJR9Gfszv19FE7VJVfmIxuLZp/K+qBk+/VuXQKRxNTvESL2Q==; 31:utJLJF514034Yw3gGslGgOcuBKIIqYERjqbGGxCMBMuR115GlnIk46ozJADDasDXLhVPfpgjJyio7fm6vq1+5UEhwNxYrpWkfS6DVZLY1b+xsUJF5+liU1mfVwznNj047im4pLzEeIYvNEb/QxLcFKPTuPNRsqb6pILkMKAB2z7jDFPEk8ULzMxaKvi8/iuHTRw45VwiamPreLJOA1BGaTOqr//T19CFDlJcyLhePNs= X-MS-TrafficTypeDiagnostic: DM5PR07MB3098: X-Microsoft-Exchange-Diagnostics: 1; DM5PR07MB3098; 20:G+nT2N9dsLUUOczrxRCxlOGL2LVFtUsrlB0ELnneqWMaPyNMSVR3S7lXP+3q1XTUUlAXZvh3dy3YDFZuTtmU9mxPZ00Bx6OgboVx/eQoUobKbh7CL0Z4wOBbu0Pvw4rycrEndiA3H0KTF+fqAvHp5dg581b7oNni/0y2Ych8rP/ao3yzq38LvGzQoqmiQTIDX88pilYbLfkn9r5mHv67ldxcsn9+t/ovDXU/RxW4R6uSAAOo/xluw93ookzlY8Cg+dGZbNht7WWaMM28CRp4AO0h8PRirUrpUtEGW/St0XGPsiQIMCe4xc/eZjyLR1wiJIBrGdjNj3z1bvAvPWBxzc43S30qHk1R1TxFAJ7Er496US7aUN1Id2k5/s1DFzVPOLv2LXCBGtQtT8qaYxtBOnq8yVFu0WTx5L50+uhRoS3DoIZlnPOGF/cY24TcZCEquZmMAz2VuBG2uImhaBUOdf4XerYm7EXXNgHYvqkuk6/1zX8ytbKv8UYpUlDdNod+tCxob3RiWE8n9elqSyKT52KDkY6Bx8aBqYslJPQpYzd6fPhcQwBn/DotMmbPU/GmGqRUsTrfyIeUTJOBNWCy5ghSpRsRymAYfaLR9E7YuaU=; 4:oe8QGnu8HcHCN2iGahq7X6feyurhwnZk9So+2G3dScead4OzqzQCDsXp7HAMKeCi0s5Ynp6R2+f3u7zQNPDFp3uUB7El1IwZeMo1go6q3l/gYh9l+s+RST42IRbzOhPciTnIzdvRq4TUqKTZDoipDViu+GWRV9RLpXT+vS19mxUPeMz3a+YixTAZnWggYAeQhBKPvNs9j125JdJ5cprj9QmqPBpJuEq+cSl0NSbD+7Kkh/ehhtSKm3uHqS7R3cVq 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)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(3002001)(10201501046)(6041248)(20161123558100)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR07MB3098; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR07MB3098; X-Forefront-PRVS: 0447DB1C71 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(6069001)(376002)(346002)(189002)(199003)(101416001)(478600001)(189998001)(106356001)(966005)(50986999)(81166006)(16586007)(81156014)(8676002)(72206003)(68736007)(42882006)(50466002)(8936002)(5660300001)(16526017)(48376002)(8656003)(2950100002)(2906002)(105586002)(66066001)(3846002)(6512007)(1076002)(36756003)(6306002)(47776003)(316002)(76176999)(6116002)(4326008)(97736004)(53936002)(5009440100003)(25786009)(50226002)(6486002)(107886003)(6666003)(5003940100001)(33646002)(6506006)(305945005)(53376002)(7736002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR07MB3098; 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; DM5PR07MB3098; 23:4zwTTJeHK1G8Hnom4lpfZXb+Sa1Fy6qKt47721m+p?= =?us-ascii?Q?J9RCmQA6kvn7ww0+3HFrseXpwUzzx/mBNR5vVeOLUuNgxtB6qVWByGSvsupM?= =?us-ascii?Q?5wdTrui2WswzY9ygTWfPK3rUs+hSbqPXUOmwJ0Jo56t9eEIdO1gtkRZcXKt0?= =?us-ascii?Q?r/HLCtl3/mZUDXhPmg08dP3FGW2ftAyZl25umm3iGUO/W4xLEyJj4Ji3/Cje?= =?us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aYEqiW71NAan4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Oct 2017 09:29:59.4907 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR07MB3098 Subject: [dpdk-dev] [PATCH v7 8/8] mempool: notify memory area to pool 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, 01 Oct 2017 09:30:03 -0000 HW pool manager e.g. Octeontx SoC demands s/w to program start and end address of pool. Currently, there is no such api in external mempool. Introducing rte_mempool_ops_register_memory_area api which will let HW(pool manager) to know when common layer selects hugepage: For each hugepage - Notify its start/end address to HW pool manager. Signed-off-by: Santosh Shukla Signed-off-by: Jerin Jacob --- v6 --> v7: - Incorporated comment nits suggested by Olivier. Refer [1]. [1] http://dpdk.org/dev/patchwork/patch/28468/ v5 --> v6: - Renamed from rte_mempool_ops_update_range to rte_mempool_ops_register_memory_area (Suggested by Olivier) - Now renamed api retuns int (Suggestd by Olivier) - Update API description and Error details very explicitly (Suggested by Olivier) Refer [2] [2] http://dpdk.org/dev/patchwork/patch/28419/ lib/librte_mempool/rte_mempool.c | 5 +++++ lib/librte_mempool/rte_mempool.h | 30 ++++++++++++++++++++++++++++++ lib/librte_mempool/rte_mempool_ops.c | 14 ++++++++++++++ lib/librte_mempool/rte_mempool_version.map | 1 + 4 files changed, 50 insertions(+) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index df9d67ae6..fb49a010d 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -367,6 +367,11 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr, struct rte_mempool_memhdr *memhdr; int ret; + /* Notfiy memory area to mempool */ + ret = rte_mempool_ops_register_memory_area(mp, vaddr, paddr, len); + if (ret != -ENOTSUP && ret < 0) + return ret; + /* create the internal ring if not already done */ if ((mp->flags & MEMPOOL_F_POOL_CREATED) == 0) { ret = rte_mempool_ops_alloc(mp); diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 24195dda0..c69841ec4 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -413,6 +413,12 @@ typedef unsigned (*rte_mempool_get_count)(const struct rte_mempool *mp); typedef int (*rte_mempool_get_capabilities_t)(const struct rte_mempool *mp, unsigned int *flags); +/** + * Notify new memory area to mempool. + */ +typedef int (*rte_mempool_ops_register_memory_area_t) +(const struct rte_mempool *mp, char *vaddr, phys_addr_t paddr, size_t len); + /** Structure defining mempool operations structure */ struct rte_mempool_ops { char name[RTE_MEMPOOL_OPS_NAMESIZE]; /**< Name of mempool ops struct. */ @@ -425,6 +431,10 @@ struct rte_mempool_ops { * Get the mempool capabilities */ rte_mempool_get_capabilities_t get_capabilities; + /** + * Notify new memory area to mempool + */ + rte_mempool_ops_register_memory_area_t register_memory_area; } __rte_cache_aligned; #define RTE_MEMPOOL_MAX_OPS_IDX 16 /**< Max registered ops structs */ @@ -552,6 +562,26 @@ rte_mempool_ops_get_count(const struct rte_mempool *mp); int rte_mempool_ops_get_capabilities(const struct rte_mempool *mp, unsigned int *flags); +/** + * @internal wrapper for mempool_ops register_memory_area callback. + * API to notify the mempool handler when a new memory area is added to pool. + * + * @param mp + * Pointer to the memory pool. + * @param vaddr + * Pointer to the buffer virtual address. + * @param paddr + * Pointer to the buffer physical address. + * @param len + * Pool size. + * @return + * - 0: Success; + * - -ENOTSUP - doesn't support register_memory_area ops (valid error case). + * - Otherwise, rte_mempool_populate_phys fails thus pool create fails. + */ +int +rte_mempool_ops_register_memory_area(const struct rte_mempool *mp, + char *vaddr, phys_addr_t paddr, size_t len); /** * @internal wrapper for mempool_ops free callback. diff --git a/lib/librte_mempool/rte_mempool_ops.c b/lib/librte_mempool/rte_mempool_ops.c index f2af5e5bb..a6b5f2002 100644 --- a/lib/librte_mempool/rte_mempool_ops.c +++ b/lib/librte_mempool/rte_mempool_ops.c @@ -87,6 +87,7 @@ rte_mempool_register_ops(const struct rte_mempool_ops *h) ops->dequeue = h->dequeue; ops->get_count = h->get_count; ops->get_capabilities = h->get_capabilities; + ops->register_memory_area = h->register_memory_area; rte_spinlock_unlock(&rte_mempool_ops_table.sl); @@ -138,6 +139,19 @@ rte_mempool_ops_get_capabilities(const struct rte_mempool *mp, return ops->get_capabilities(mp, flags); } +/* wrapper to notify new memory area to external mempool */ +int +rte_mempool_ops_register_memory_area(const struct rte_mempool *mp, char *vaddr, + phys_addr_t paddr, size_t len) +{ + struct rte_mempool_ops *ops; + + ops = rte_mempool_get_ops(mp->ops_index); + + RTE_FUNC_PTR_OR_ERR_RET(ops->register_memory_area, -ENOTSUP); + return ops->register_memory_area(mp, vaddr, paddr, len); +} + /* sets mempool ops previously registered by rte_mempool_register_ops. */ int rte_mempool_set_ops_byname(struct rte_mempool *mp, const char *name, diff --git a/lib/librte_mempool/rte_mempool_version.map b/lib/librte_mempool/rte_mempool_version.map index 3c3471507..ff86dc9a7 100644 --- a/lib/librte_mempool/rte_mempool_version.map +++ b/lib/librte_mempool/rte_mempool_version.map @@ -46,5 +46,6 @@ DPDK_17.11 { global: rte_mempool_ops_get_capabilities; + rte_mempool_ops_register_memory_area; } DPDK_16.07; -- 2.14.1