From patchwork Mon Jan 15 06:11:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 124473 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp568738lje; Sun, 14 Jan 2018 22:13:21 -0800 (PST) X-Google-Smtp-Source: ACJfBovsNXNhFm+KA17nqNMziTajxKGwLOnKh7ijdo1DHMwt+APK+6C3QZxR5p9esDB7ixh+Lx/v X-Received: by 10.80.139.155 with SMTP id m27mr14630437edm.98.1515996801809; Sun, 14 Jan 2018 22:13:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515996801; cv=none; d=google.com; s=arc-20160816; b=m2gSF/PR7qyAFtrbnBfRK9Qpygw2trAFQx8fbhgWi0WHJ6p1cYzPpEVuhFSlStXd2D W0BxPvxotA0Ae5Khsig5CC8AaIi2IBVdpFWYBNdhO/BHyAg8nNjD0a9lPKqJll5VCHos izEO0tSOFgi0b4dqdbuwA3uvfPm9OAtbGcrJcdzwvuBEKQFD9753H+LbH99Ngr3hC+6A yshBQEBfubs5TzJHU7oVB2QQCYAmb5uPW4dkjlv3ifIBdRTTu130pnlwmHxqMPCS9YXg lSWciiarUVKcKQpTE3ZDfnouQA6xCnogbjMUIyIEHdc7AOQekkUun1Opalbdc+3zHXOw 512Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:cc:to:from:arc-authentication-results; bh=tv2SU0fSJOQVBEntxKRZ/EarOrsWQeM7RKj3ldngg3w=; b=W9Uz/5bZ8dOzyX9TqGQ9DBKhdYf8VeR3Ubuly4asOzeWJDSzKxF8Ccj/Xu3Q/l+COy c+Dl+gMWsukMgOyE7sXNk5zIHLaO+qzd6i3d4ci9L29NWtjqaQBC9D2leQTkNTLo4EJK x0a1MDFQMa0JEXo/wJwQM8b2RNRrKJGmTKA4EGwOAWD6IW4X/pcgC+RwzqvrJZOkkYCi 8CLHMewUYa6PJ8H/qbfgAvWxN+/n7d4efjd2P0x0oKWeRlhvw0na+vxMjGHUGyLECFy8 87G9ablI3H/vy+IX3dXSruyZvJyOeEz4lOrD2XTR0+M6Hc0RnQA6FMQUhKOzDKY+aCoS dtHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from dpdk.org (dpdk.org. [92.243.14.124]) by mx.google.com with ESMTP id a20si726650edm.487.2018.01.14.22.13.21; Sun, 14 Jan 2018 22:13:21 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) client-ip=92.243.14.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 92.243.14.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0EDB7199B5; Mon, 15 Jan 2018 07:12:39 +0100 (CET) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0064.outbound.protection.outlook.com [104.47.40.64]) by dpdk.org (Postfix) with ESMTP id F3A24A498 for ; Mon, 15 Jan 2018 07:12:35 +0100 (CET) Received: from BLUPR0301CA0034.namprd03.prod.outlook.com (10.162.113.172) by DM5PR03MB2697.namprd03.prod.outlook.com (10.168.197.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Mon, 15 Jan 2018 06:12:34 +0000 Received: from BY2FFO11FD024.protection.gbl (2a01:111:f400:7c0c::186) by BLUPR0301CA0034.outlook.office365.com (2a01:111:e400:5259::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Mon, 15 Jan 2018 06:12:34 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; NXP1.onmicrosoft.com; dkim=none (message not signed) header.d=none;NXP1.onmicrosoft.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD024.mail.protection.outlook.com (10.1.15.213) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Mon, 15 Jan 2018 06:12:33 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w0F6CKAI011776; Sun, 14 Jan 2018 23:12:31 -0700 From: Hemant Agrawal To: CC: , , Date: Mon, 15 Jan 2018 11:41:13 +0530 Message-ID: <1515996674-26338-5-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1515996674-26338-1-git-send-email-hemant.agrawal@nxp.com> References: <1513333483-4372-1-git-send-email-hemant.agrawal@nxp.com> <1515996674-26338-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131604703537009293; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39860400002)(39380400002)(346002)(376002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(85426001)(36756003)(8936002)(86362001)(498600001)(97736004)(77096006)(50226002)(81166006)(81156014)(104016004)(68736007)(8676002)(2950100002)(356003)(53936002)(76176011)(305945005)(316002)(296002)(2351001)(6916009)(48376002)(5660300001)(106466001)(54906003)(105606002)(51416003)(47776003)(4326008)(2906002)(16586007)(50466002)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2697; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD024; 1:iCs5LI/dGU0Xs2yPj84z6PfcFc2p5GK0hdha4sf5ydztOKi6cFBpjwEo1Sz4PzIgnpDtTPURtTXzWxpljnfcKJ+AMd0O5UOIbfKIr7yrdaj46cxo2pl/ciDo6xtUVDas MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fffc6136-2571-4df6-128d-08d55bdef78f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:DM5PR03MB2697; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2697; 3:wIDpJf1L7wyr+lPjMUyyWgHNwmHSjw4apTxUs+79Sme7x6/+GuBtdScxYOmYXvpqUu+ABsRtqaEzqgPWG555yWXVUm0Y+XoJcdWPYsKfH1T0WcLR0mKfAPhBU7spwiSZX5r5/7qW/cGzm8CsylyUSG9kU7hnLUqMSl3N8ZVxkOV+tNcZ73neQRVPH60muuz+TabABvG5nHvmrRGRh1bwLXAa1vdve2d+3Mtxfn7iIMLZ6DK15nI3OPc57w939EaArKjA7pxOQMWLwdr52sVwJq7PQuTRSVclYNGbrHauPXmMBtbaPpJlF+hLzDlBcCL1Eb+YwkRVrxEt0xo0kVHZ58AiKZUdfspgATyjiLbiv8A=; 25:rBduJW22NauWMNiUL0EzSCj+04gSvQMmoLSwU4t6UOV6BaXdrnhMvsmNrY1etFm0e1WH9ZX3mBciuHoMrrhFOpmVcQTh6Ymp/EaKKZMG5EeWGOvJBnHuXChkFapaDcW2ZdMxmSfULcTJA25qElT/GWJXltfC4cXfPOxl0f4GV02wTJ7s+N7nRF7NJR0xFWQ3jaZvWvCWJi2EDn7AJ/Tsg9KMbPj0TbUqyWNYLKLtlEvsU1F7S3ojJp+WbzUGMDU5/e993yt3guZDoKdv+NbOE3cg+nt/WfUDwhN6rBh4r4l03/K2Bb7pCnplzMgMyyMd3I7W7nW6fWECpSCy4mCwHA== X-MS-TrafficTypeDiagnostic: DM5PR03MB2697: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2697; 31:wBp5vuouCbArcvu0l0An6fvhWFMjiqrsRknHUYXhbReclIm9pFbHlxPmkemyZc1vanIAeoSacS8i1EufQbfrDbK8jGcwUiRcDIgsI10kURJ0sZmTupxYP0ExY39ZwxGJro/4HcE16aWfftVhl+oBlr57Tx40fHe9K8oFqr5hHvOIptpO21Y56DId+wC0riUHvJmulldPhwjM5B7WIA7u2C5jLxhFYYPkri57Bl9Lelc=; 4:HlH/468XhKW/GQjBJa2r4gmaU5OAoOkSP/MkVxAxlfGc1lCU29RzoTn0o0WNOuvVRdxA85Kc786TLF/J9hxp/acYfmoECHZ0T5yHGivudS1Ou570U2FxSfcJu5RLX8hQST9OdkEXG/TWYyZ1K9hZNG67LOEoKk1MiXHpJurWhAGEcDfDzIo2LnfqpmzX5iaWtucPtVjWu2d4XOvaqKcsHxjo4EhYt7kuoeYatDvGOtSSJEubF3ZLQpOijLtAa3gwDFh5IJ2V8lWY8VQ2uebkF5JPzClVbLrKG/z7QMAROxKV4khXHnH6dc0INSVfIJ44wTC+YDl+5GXvxaudT/LXc4ks74xWaXNU8wsrKoJ8S5c= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(131327999870524)(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(3231023)(944501161)(93006095)(93001095)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123559100)(201703131430075)(201703131520075)(201703131448075)(201703131433075)(201703151042153)(20161123556025)(20161123565025)(201708071742011); SRVR:DM5PR03MB2697; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2697; X-Forefront-PRVS: 0553CBB77A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2697; 23:blWj0yIlOZ5vS/ohphAEhMM0SJZdI0XHeg6CRkF4/?= odL06DP1BW2IeTsvasF1S/gI+xfwj64dV0Itj8uMHyPjfGwdg6NJcEKLWI74Jf0gA46REP/Py6uiInAbDclv4Ezk/FF3I/O4hg2IhoGeukt9PivcHrT/CpaSn7FvZcFXgptHQM79RyyIBm1dml/IbQ/uEoWAFHLkKougdwGJ/U6OYBGM/jTJlLTp13dIk+Xgf5gljOnwhDDVspv5X/pJDzGea+zwySiDa6PShCDdF4n0rgP+9uGUDri7Njc3vPpfuhj7qHjeV/3ZVHSZPy/rfTM0e/8KdUQ+fuJ/NXaxguO0f+MkoCmTZ//7bV9nPyw+1ndhhWQ2C8MOis1/Vc/vxU04afUhyUf3P0RHYYHarfcLHpw3Nw0FFvnjT3j3TJMUlMRUT709TyQCylcHe0Kx2xiWV66DO6C6i7yd4CdEf42iTQO+uUjsZC8a/rLz8Ap4Oun3v7CaziyQGW+My9NzgL3U/G8TATIa2aIPCvgmm6iDCIffUKJaKdoKmnS0idqgYjrJ46N41cVcPgqhVolDcPjwrds6B78rkOgAm07zqE3AClhjGJQZSxPZQrzGbk1cYWkbd00GZW6HL3nkXoQ5JEFF9emDus/tuQGyEOLpMhhgwLg61ILGOnzQgYELV4cWtspmT/FYX8Lmh2FSWNHJAhsotxEGOVgMT4ZJqRU+AtExXAK105IVgV+EX3P3oT3s18nYsn1UaCoPqcuo4lIkWBAbV5UzZzI5NJ59p6Wgvs8dgFBZrRWPaxDrX7C1d59A8otWcv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hXaw460CcOarv5r91Kcl36lGs6tIlh3ft1fFa5hgrSzeGaEjCfSXkHG+2V0/2+3CvgR9Kgn4k6tTKmh2AYnA0Oo4vnaXHFI6tkuKKbNcTybn1kuJxeunaPnvrC5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2018 06:12:33.4981 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fffc6136-2571-4df6-128d-08d55bdef78f X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2697 Subject: [dpdk-dev] [PATCH v2 4/5] mbuf: pktmbuf pool create helper for specific mempool ops 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Introduce a new helper for pktmbuf pool, which will allow the application to optionally specify the mempool ops name as well. Signed-off-by: Hemant Agrawal --- lib/librte_mbuf/rte_mbuf.c | 23 ++++++++++++++------ lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++ lib/librte_mbuf/rte_mbuf_version.map | 1 + 3 files changed, 60 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index fd3b6f5..482676c 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -186,15 +186,15 @@ rte_mbuf_best_mempool_ops(void) return RTE_MBUF_DEFAULT_MEMPOOL_OPS; } -/* helper to create a mbuf pool */ +/* helper to create a mbuf pool with given mempool ops*/ struct rte_mempool * -rte_pktmbuf_pool_create(const char *name, unsigned n, - unsigned cache_size, uint16_t priv_size, uint16_t data_room_size, - int socket_id) +rte_pktmbuf_pool_create_specific(const char *name, unsigned int n, + unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size, + int socket_id, const char *ops_name) { struct rte_mempool *mp; struct rte_pktmbuf_pool_private mbp_priv; - const char *mp_ops_name; + const char *mp_ops_name = ops_name; unsigned elt_size; int ret; @@ -214,7 +214,8 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, if (mp == NULL) return NULL; - mp_ops_name = rte_mbuf_best_mempool_ops(); + if (mp_ops_name == NULL) + mp_ops_name = rte_mbuf_best_mempool_ops(); ret = rte_mempool_set_ops_byname(mp, mp_ops_name, NULL); if (ret != 0) { RTE_LOG(ERR, MBUF, "error setting mempool handler\n"); @@ -236,6 +237,16 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, return mp; } +/* helper to create a mbuf pool */ +struct rte_mempool * +rte_pktmbuf_pool_create(const char *name, unsigned int n, + unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size, + int socket_id) +{ + return rte_pktmbuf_pool_create_specific(name, n, cache_size, priv_size, + data_room_size, socket_id, NULL); +} + /* do some sanity checks on a mbuf: panic if it fails */ void rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index d26e8cd..f958e3c 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1081,6 +1081,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, int socket_id); /** + * Create a mbuf pool with specific mempool ops + * + * This function creates and initializes a packet mbuf pool. It is + * a wrapper to rte_mempool functions. + * + * @param name + * The name of the mbuf pool. + * @param n + * The number of elements in the mbuf pool. The optimum size (in terms + * of memory usage) for a mempool is when n is a power of two minus one: + * n = (2^q - 1). + * @param cache_size + * Size of the per-core object cache. See rte_mempool_create() for + * details. + * @param priv_size + * Size of application private are between the rte_mbuf structure + * and the data buffer. This value must be aligned to RTE_MBUF_PRIV_ALIGN. + * @param data_room_size + * Size of data buffer in each mbuf, including RTE_PKTMBUF_HEADROOM. + * @param socket_id + * The socket identifier where the memory should be allocated. The + * value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the + * reserved zone. + * @param ops_name + * The mempool ops name to be used for this mempool instead of + * default mempool. The value can be *NULL* to use default mempool. + * @return + * The pointer to the new allocated mempool, on success. NULL on error + * with rte_errno set appropriately. Possible rte_errno values include: + * - E_RTE_NO_CONFIG - function could not get pointer to rte_config structure + * - E_RTE_SECONDARY - function was called from a secondary process instance + * - EINVAL - cache size provided is too large, or priv_size is not aligned. + * - ENOSPC - the maximum number of memzones has already been allocated + * - EEXIST - a memzone with the same name already exists + * - ENOMEM - no appropriate memory area found in which to create memzone + */ +struct rte_mempool * +rte_pktmbuf_pool_create_specific(const char *name, unsigned int n, + unsigned int cache_size, uint16_t priv_size, uint16_t data_room_size, + int socket_id, const char *ops_name); + +/** * Register the platform supported pktmbuf HW pool * * @param pool ops name diff --git a/lib/librte_mbuf/rte_mbuf_version.map b/lib/librte_mbuf/rte_mbuf_version.map index b8e258f..9b53502 100644 --- a/lib/librte_mbuf/rte_mbuf_version.map +++ b/lib/librte_mbuf/rte_mbuf_version.map @@ -41,5 +41,6 @@ DPDK_18.02 { rte_mbuf_platform_mempool_ops; rte_mbuf_register_platform_mempool_ops; + rte_pktmbuf_pool_create_specific; } DPDK_16.11;