From patchwork Fri Jan 19 16:33:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 125201 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp390798ljf; Fri, 19 Jan 2018 09:25:27 -0800 (PST) X-Google-Smtp-Source: ACJfBot1QtYqX9IxLlH9KIt4hRiK3DtVnfrMAaMm9tHi7otmRyxP/Ze8idRF8TgnUPq+0WqCCfMH X-Received: by 10.28.237.23 with SMTP id l23mr9126194wmh.113.1516382727153; Fri, 19 Jan 2018 09:25:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516382727; cv=none; d=google.com; s=arc-20160816; b=yb306orzegVqrrxII4Boq+2zNvtq7p7kC56MIbuCT1uQX0dNLfW0IqdJwvpSOaSnOO 8IAzOWdjSwANBEHFILqQ2vNkTDtxYkGJQpX/n+HAOy/JcsrHlKiN4VWh/FFgtOfThuZi +WC5XaWr7iZsb0y0jqp4g5VMLGw/pGzRVm8JRzKOn5URYafeuAvHN7L3oA1eIfVhS8PA 6liCBG2cnqFewnVdkJJIUzqYEw9Dr4XSLvYKK4XWWEhyy2+GwCn8cVFMn9XSYwrrnmUd eZa+R969jv9eERs/M7l3MlNTiiTIy6coDZzlcjJ0ZpF6OouRSgy9dGeDCmNnJ96+Ypx4 mZlQ== 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=jLoB6fWv91cZ3/FMvVblYbkW4gw7GfXvSxnrtPwQNA0=; b=mkLb13Imcj5eYJgYBUj62K2X0Jinq4AceCg0duSyqtZBYnZgzdZ6R/a2YC+9uP3QgH 83sDZFxHtxdqZHqfIfuDLKKOA4++zPlaUtvrT8KW0Vf0vzjE6U2hXGP8JH10olx11+e3 MbUlBEmFI7X7Gy6x5V7XtUzCQuXzpRUzVUKtR4RFrKQ7jFDWGrsYSs7UuLJzxpGUShRS TDUvE66Bqo+Lry2qXpHOeSF59a0gGdVh55Q2n28QItTfkP4nAhKiijtZbsHJloC2Nen4 I3DAjxNYJafe1XC8+1wkMtQr3jVbyjTL688GJ8bw9vEwwvmTR6PXSiH1sOeOQsuPOmm4 jpjA== 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 n18si1164464wmh.43.2018.01.19.09.25.26; Fri, 19 Jan 2018 09:25:27 -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 0AFF11B33B; Fri, 19 Jan 2018 18:25:06 +0100 (CET) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0047.outbound.protection.outlook.com [104.47.41.47]) by dpdk.org (Postfix) with ESMTP id 049C61B309 for ; Fri, 19 Jan 2018 18:24:58 +0100 (CET) Received: from CY4PR03CA0108.namprd03.prod.outlook.com (10.171.242.177) by BN3PR03MB2355.namprd03.prod.outlook.com (10.166.74.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Fri, 19 Jan 2018 17:24:57 +0000 Received: from BN1AFFO11OLC002.protection.gbl (2a01:111:f400:7c10::160) by CY4PR03CA0108.outlook.office365.com (2603:10b6:910:4d::49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Fri, 19 Jan 2018 17:24:57 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; dpdk.org; dkim=none (message not signed) header.d=none;dpdk.org; 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 BN1AFFO11OLC002.mail.protection.outlook.com (10.58.53.73) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Fri, 19 Jan 2018 17:24:55 +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 w0JGZ6aC016753; Fri, 19 Jan 2018 09:35:16 -0700 From: Hemant Agrawal To: CC: , , Date: Fri, 19 Jan 2018 22:03:56 +0530 Message-ID: <1516379639-25586-5-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516379639-25586-1-git-send-email-hemant.agrawal@nxp.com> References: <1516281992-6873-1-git-send-email-hemant.agrawal@nxp.com> <1516379639-25586-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131608562971496517; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(39380400002)(39860400002)(346002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(50466002)(81156014)(76176011)(2906002)(36756003)(6666003)(51416003)(4326008)(53936002)(2950100002)(105606002)(498600001)(6916009)(106466001)(50226002)(316002)(107886003)(77096007)(81166006)(68736007)(8676002)(5660300001)(2351001)(8936002)(16586007)(47776003)(97736004)(48376002)(104016004)(356003)(86362001)(85426001)(305945005)(26005)(54906003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2355; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC002; 1:KW5VDfrU9U+NeAkYhMtUGmeKtgZbmD2+6h2ihvX3nM7I3dxobS1jmGkWBrQUvi08hrkhqCbVthXENIDA1Bu8X5HyM3J33WpwswpFzLobzhTSgu+/q7fSQ+mq1GThhQP1 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3d3e70ac-2df5-46fe-6ee5-08d55f618fc5 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BN3PR03MB2355; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 3:teQuqW0Xqk/wE2zBh1dKHpnB8oWMIXDYoAoht+rF4lWicB6540roeb7JDdp6pw0Knf0/vJmm+7V2aMLvAKlcsnTYHiFunmh7W3VXaeHYhF05X/0iZ36ZE4o0QXwmbkqMrzq30omiJKqHHimk+ASzxN8e34CAjRwvjeTwwt1NsoFEhWZVZemczEjGAtMLXuNoR1jplB5uFYglxnCWkH/ib/y04WkSB0U+hIRfhU3TE5Ibe98VlKQ5VO21wBYjkFJO5oOTYIq026mk5Hsyoz/MS6lcKyyqMTh8J+yIII0dyrAsS5w1E3kG4HmPSNi0FvZqO2oCDBAmLWNvVfnpsTQGllfC4r6MJm+ONcrnzOrkJGI=; 25:7TXkO7ngj+SCN7E9JyIGMGW6syAI30ehTUM8gkGzkAexrXEXeKVbT4p3FlOh6YvrtxZBZXnQfj+FJq674Uml1xSnBoiCFSAOzWOdaYD65Dpm+UZqWvCxd3JB1o7ml+IhGeBPWK7s/WZHMHQmwZ3ec3efMTAZoWAHyZ97v5JDs+j8cArwgYz2btZfTW9JT11Pk7WVrgM/4nOYY21BgxjCyasyOpwP/c6MmiIUy8vQ7cLyzXjjRCidCms1qoDAXCiOQAAfEi9KZLGk+qGjT3g1ka64n60lTA/sxAqLY6ODbSyqfumozPSXnNrq5k3X0c58xSNqf2cflAYNW/uvFEvXMA== X-MS-TrafficTypeDiagnostic: BN3PR03MB2355: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 31:Vvc21OocQgHX5E4LCtgorTTmtydra++NoUgSwigOwrJv75N26E9MTqmuuGjN0VUApwT9E+odwfMNz6gNcQHVX6e9dO6eWqaeSkRbGhsVBmZPRkleWuerLPpPRAm+QO/j8LCmQYm2Vm1wdo2F9uwKN0nQmAi/vaRBWdQcY71o4lINoNFKOEKzsGVaPERpEzJOds6HyhEw7iSI70VwjWNF5TPMGZx0Gw0eDOowCvVAUpY=; 4:sa+1f53tvor7eUW+6vu62nTajWy0l8OTlWuT+X8aTpj/PV799C4Wl61ELp+Jqnzm5+F9bKmyXtwWBdx+pTX/xrWeCxunKhMIWn+ChqQLQqzymuXNPAaJVbZMCPXy2/gUnQWS1FOzkbY2xB7c/1dCBdzjIMWNZlw3Kr+3Y60Gn64Kll5boLo8/cGMlNveQj5YAoKDhQ7D9M5dZ9NQGyrbCUTG+tSIF8oMZvJu/43lH7isrcLEhwGcqBrIdFalTIDDgO0zEweCxf/K4mxDU1N3dRW5bOQSboI7cCc/Y72SumLjhVmBekivCs5KRGRwAhD3gD/Yu9hM7ltLacq4MD4ZcBbgpS6MBGVpCcroa1uF+Ic= 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)(10201501046)(3231023)(2400080)(944501161)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123556025)(20161123563025)(20161123565025)(20161123561025)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123559100)(201708071742011); SRVR:BN3PR03MB2355; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN3PR03MB2355; X-Forefront-PRVS: 0557CBAD84 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2355; 23:U6QKk5plJTj84rAELGW1O5o2FGgIJbqLVnoYirxi+?= e7YY3Wn7yFD3UCJmhXnxbslNhYo6axX+KczEILmd01R+3c/MjUtmrJY1fsjpIc1VUTuyyzOo3fIvJ3AbeZpxUTLkpqu1OGBaQoG021GtBjeT+BCBRy3F9LaWhGUse1w5YJHDzurRALqShlPczIhBYcq8o3ev7vQ9sPqDoH+uYHTTWWexRJsHacqJ9O6vSrT6zkPgV7AXtN/Tp8PjbEzvVSObmh/x6Lco0RcbY5q+Khrdz+75nNuROSdrZWzNuhAeTe9xXM5go00SihS5vzhXpxVUleGhtMBo0jBF57d0NvzqC4Yq2EfHo3akq0QKcYf2O7+QNdYMdkGbJUsJdAc7rUQN765MZMDsyyRb6glW792TzIuYu7DSuFN2kSW68dTYGYsAG7NYT2OzZ5R+1/Cvl9ByCEzZhfJPVVdBHC94Zf7bwU1xE1YjCGIuXUn+UjnG2DphK/SauRpWK3HOLrUeS/fbCX+akW9k5lAhbgxVMjBqG2q1sl9zWcTNA5F4z0ftt/lLMwZERija3lb0F8zjAXqS3M6ELNd0697DMJGOa2Pu+2BpVchSTAg61DX2rUtaCqhyivxUdVRYoKMFRcREgKKpImBhCOi7uybCwNjOyRLHwoZk01yPZMdbG3GDbVaS933Q2ZdfcV8kNvTGwx8dN8mVODSmcVS5V+oe1oZ0/H+9fReXroBKCe/eBpBzIX2q4SWaa5K0kR/Ykf7pC2oEBGQLrRkMc+Avne46Q0kX7eLLK/aEPwg8AVqt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aKdqwvxJhE8RL3fkZQ1uNbSMhgN2f+jnKGPPnfZdOrljxi46XoFhmP+VdbutJ8XG/4Y8RBaQjchqdBcctWuHYy2h8aVeizC9ZyDi0jg4Y0AZDlOCW9W13h01LpF2yhgxQyxK92NZ5PzWrHDMGgQ2YIs SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2018 17:24:55.0436 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3d3e70ac-2df5-46fe-6ee5-08d55f618fc5 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: BN3PR03MB2355 Subject: [dpdk-dev] [PATCH v4 4/7] 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 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 6 deletions(-) -- 2.7.4 diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 0c4d374..a256b42 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -149,15 +149,15 @@ rte_pktmbuf_init(struct rte_mempool *mp, m->next = NULL; } -/* helper to create a mbuf pool */ +/* Helper to create a mbuf pool with given mempool ops name*/ 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_by_ops(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; @@ -177,7 +177,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"); @@ -199,6 +200,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_by_ops(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 a594e47..e25b030 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1103,6 +1103,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, int socket_id); /** + * Create a mbuf pool with a given mempool ops name + * + * 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_by_ops(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); + +/** * Get the data room size of mbufs stored in a pktmbuf_pool * * The data room size is the amount of data that can be stored in a