From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0051.outbound.protection.outlook.com [104.47.40.51]) by dpdk.org (Postfix) with ESMTP id 0D92758CD for ; Fri, 20 Jan 2017 16:14:29 +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=4h7VcMx4mJMFCioooCH5qqOKpSgjRuZyVxyuPg1/YWY=; b=UkaXUBUl5doBwuGv2P5byWgWJY4yDc7PQVtMdw+HxP+052o567yPgROWT/f1vR/S+3l5uGDYIaIS3H9YHGTQydzHuHIExqMSIx+T7sX0VQ5/d57unRhsi+m6rwP1SKBMcfC4bFLVuhb9QfXtoNOGFgwelUOvQCqQSnZqs6CrcAo= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Santosh.Shukla@cavium.com; Received: from localhost.localdomain (111.93.218.67) by BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.845.12; Fri, 20 Jan 2017 15:14:25 +0000 From: To: , CC: , , , Santosh Shukla Date: Fri, 20 Jan 2017 20:43:41 +0530 Message-ID: <1484925221-18431-1-git-send-email-santosh.shukla@caviumnetworks.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1484922017-26030-1-git-send-email-santosh.shukla@caviumnetworks.com> References: <1484922017-26030-1-git-send-email-santosh.shukla@caviumnetworks.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: MA1PR01CA0011.INDPRD01.PROD.OUTLOOK.COM (10.164.117.18) To BY1PR0701MB1721.namprd07.prod.outlook.com (10.162.111.140) X-MS-Office365-Filtering-Correlation-Id: 0102116c-8e53-4e83-661b-08d4414706ce X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 3:peswUldSX9NyExSbjhILpM0n2S7ghDmOE1foHqPzjPzPLMjX7xF8ciziAxEpbWhv7T1VVZDQSbyYW0cqmgOmeWagOt1EhaxCLy8PsTlWEiXDa+JEupDoH79RIgbFNAGNSTkJTRVfotvRUJkfbDQG64Fu1kfxCv56dd26Za6xvLU+o/gXp3EKqmZDPmJJFkK/PnMf7XECqOmj1mHn0cWQIBDooj6nugDj+ORT6OiTUEU9kG0yQV8UJuYMsb/1uR+6h4EiPc8w+CaqYqeCc2rkjg==; 25:reYoxneyySMt2rO0pkGxHBDF6ibrOqlh0ao7TZTJqNrBSCgsgjnq7IDN/bovLK0KVqCNmZEfmdaIPj6jHLGbDjsfD76jb1ugt/olBnjvdgXxfzT4ynCIQwtJZseYeuk9aRhzqedgPhwdlmK2INCFUnyMCE7n8xMTpll9s62iMl+A+agNiIaN8y1drBF6OI68KblC4o1ixNgJOQg9N6BrbW63jhORw/FGps0nYh1H7Sv2Wqum944BkLnrOBZ/MBzqhyMTMmQmgnpdRJBbPhMBCxlQcI+QeDywgttBV/HTsDMxIwmH0Ar26av/3RMvQBKypY7sVNJdOqU7IBEA8gJIoc8N9Qs8ljVTKMEsSDPANOHwg12Y1MKKDMhWHTg6a1/MHfzifB/Z5m/rgyII+RX7nHFzNc4U2k9euCASTfGNac20ROkOD/r509QFCMflGvPWIERxTYPw6K9i3Xq1wKKyXg== X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 31:KjsZDePhzgnL51wwQuGHPrYd1I50xqNrOfKRA32ZFeCb5LhogssSlPIIlep2Ea471HmVw0VaQ1eruAWlTsJH3PenYCHddre6gmGi18VLME5h0m2x93/hKunLkNoc632BwpYoZm6pJpynRFvIito3fLfZ9qHOklEq3yjz9UasI40m3E7GguiyuNCHe36mIKTvNbCtyUeEcnV+HWmc5Ov4866dbgNi7J8lg4VwsEGYMW8e4xT02lmppxawMSDvprMHX0Lbr8Yb792zNhZpZEzYHA==; 20:q5Az8jCDW+wtElx4NdiD6EECrrz5q6J5zqiCS4oTptGPCINFb8z06azFsO55coit99w1MS1EofeMsBd83dlfA87o7Kdzhc2iWv5gqAHA3loHP6DKQZRmQWJG25spMcxLevWhCEkqULbmeUYt3uHQdtgeyheDQ+yq1bz6PhJOd0d7PYFwp/p1RPhYlEMIRu/6KYQl4/NGO10RjBKhd6Dew/1sl/D5D8N6eSdzh1UJZ0NAVXllAFQX44SU/AdenY2ZKia9FkdiDfkml2sDSFN09luhOMzsSOYbiKgrZ13GD1BR+87ElSeDllPuiBzspW4GAWMhIKUjPB519ztWr0MjaTNM2VVCvAbucbjl1srh/WXh67aOXGyh+t0kmWWxXh7CEKo+p6ggRNYUddBA+e0hpYTYigVwmMI/aKsdAmzNvP+cezYmQFTJGJ5rjxtotwDbm7elUQGNSvbCYbcrV5ChBOpgs1q6EN3067uSxcO+wn7CW5ZQKxyAIlB+rrlYsQpmOdZrZib2zx0L/0IIfKmXyoYGqDC49t5EdZg/jXMIwdCHnjYT3O4sly5LDub2P0P49T9Jy81az6pAf0NEa/TGXe7tmpXw9HJFR/uLbclI+GY= 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:BY1PR0701MB1721; BCL:0; PCL:0; RULEID:; SRVR:BY1PR0701MB1721; X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 4:XY0Rmv8WAm4PCxy8YdsRdOT7pVrOJ4ZfOjT4FtSGvgXyAIe40aGHfUIAdfynl3dL8mCc0zq/vBKA+gu1L9Y3wehX9W/8GcmBfZZQDGZBNW6jy8gJhNzi4f0b/rUsJuta+/ywVbnQEVdh6SlL3VzIQcA6Z/79dpy0ugdJc/R+pKP7qaIGPXb0ivK722VQBp0etTaaBrU0dWiKWsDTTFZ3zmPKkx7doDgS8JqdxGNRiycq9un/e8P/S43DjXyE2zOdZAwp3BRZa/PuDzOb03jA8zvEc3z//KFiJwnDU8JGappMlwH1Gi2wYQ6mZNtZtSNJ3HHq3Jp2wTB+sSQKsp0vVJPAznqEGtOZ5C1cY6WLmcUl2ktFrRy2HgMScN7NP+4g2IxCNPEQuuH6H5xLfLDT40Z9vbYO/XaD9HYAfxWQmMutHchd2ddgaHbYi0NBOxpfJTbo8lW4IpYCctSPNQP046AGOj0G3+nQswl4VIG0C8Et8BEuzeTzZLKutmjjGSNSX0+pPbqxVd+wcBPozNrG8XHCMrCKscwH0/q47Ysm53v4478VPE6FfsLJ1fnjSULWpMdGUZfdLjbR7ayIx9egqA== X-Forefront-PRVS: 01930B2BA8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(39450400003)(189002)(199003)(101416001)(97736004)(92566002)(50986999)(76176999)(6116002)(47776003)(5001770100001)(6506006)(189998001)(66066001)(107886002)(3846002)(25786008)(2876002)(105586002)(8676002)(8656002)(42186005)(38730400001)(4326007)(2906002)(6486002)(81166006)(81156014)(68736007)(50226002)(106356001)(54906002)(86152003)(36756003)(5009440100003)(5660300001)(575784001)(33646002)(4001430100002)(305945005)(53936002)(7736002)(42882006)(2950100002)(5003940100001)(4720700003)(48376002)(50466002)(6666003)(6512007)(7099028); DIR:OUT; SFP:1101; SCL:1; SRVR:BY1PR0701MB1721; 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; BY1PR0701MB1721; 23:UqnLArAqKgnLzMcwK0bJo7O1sodAJySOuZPy2BV?= =?us-ascii?Q?q/UErdDKDKR881JB6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Z7AS2noN2aLiW4ngW8SoZqUwtU8qyz0sOu34VSEbTuNw==; 24:+VSHCAQbGx9l2shgNtdIGDCVEeZjz1PyL8xhVAKSUOEyoKDJWWU4gQGvuvbDpKhQ5YQVKhKN/M1qJ2SKa5vBtLyxiea9p2xAZ6DclfRusT8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY1PR0701MB1721; 7:CN9yY2mrrFp6czXuW615C7GhgfzQrwxXcPGzcvyA2ygfXZpEjAPRKcxO0Gtu7FEs7t0OUI9aB8uUV3+cCEnz3qdYxsa+Oa1RJoElA5W9BNqj3gwt9Nzz2RJbClqj90k2MIpLPETOzLG9RL5Yt86X0J4Pu5y81mLBVSlX/BYATKhP6fq0XRXFhGo4ycdERZTtyD6+f3Nc1qhhjUVpzNl+ycN3AaClwF2+Oc9cw0o2jjI6W9DCp862vsMzxaJsWL1JGYZESQyYXK3R0IYWFd9ZzYmx3A5wRTwdhnSVvaUOwn52msKS0cX3l3ctvIYuge69wyKM7Ed6ybpZkK6+YsLpIwg+27be7l8m3PqzeD6olkWsM47L9/QNyTYx4K/E3Iglg2dGp7clzWuqHtTrqg8coOBbJcFsEKK4k6kXj2zD05uRQ1uuhL93+MepvvdI2UST3quOGMiznZCsUC1tMWuHtg== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2017 15:14:25.0602 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0701MB1721 Subject: [dpdk-dev] [PATCH v2] 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 15:14:30 -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 --- v1-->v2: - added ops->populate_mz_range NULL check - Removed return ops->populate_mz_range; As function is void. lib/librte_mempool/rte_mempool.c | 4 ++++ lib/librte_mempool/rte_mempool.h | 22 ++++++++++++++++++++++ lib/librte_mempool/rte_mempool_ops.c | 18 ++++++++++++++++++ lib/librte_mempool/rte_mempool_ring.c | 4 ++++ lib/librte_mempool/rte_mempool_stack.c | 3 ++- 5 files changed, 50 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..6c2bc7b 100644 --- a/lib/librte_mempool/rte_mempool_ops.c +++ b/lib/librte_mempool/rte_mempool_ops.c @@ -85,12 +85,30 @@ 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); + if (ops->populate_mz_range) + 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