From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Content-Type: text/plain 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/v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UnQWS1FOzkbY2xB7c/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+?= =?us-ascii?Q?e7YY3Wn7yFD3UCJmhXnxbslNhYo6axX+KczEILmd01R+3c/MjUtmrJY1fsjp?= =?us-ascii?Q?Ic1VUTuyyzOo3fIvJ3AbeZpxUTLkpqu1OGBaQoG021GtBjeT+BCBRy3F9LaW?= =?us-ascii?Q?hGUse1w5YJHDzurRALqShlPczIhBYcq8o3ev7vQ9sPqDoH+uYHTTWWexRJsH?= =?us-ascii?Q?acqJ9O6vSrT6zkPgV7AXtN/Tp8PjbEzvVSObmh/x6Lco0RcbY5q+Khrdz+75?= =?us-ascii?Q?nNuROSdrZWzNuhAeTe9xXM5go00SihS5vzhXpxVUleGhtMBo0jBF57d0Nvzq?= =?us-ascii?Q?C4Yq2EfHo3akq0QKcYf2O7+QNdYMd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l2MguQ88p2RKZi6EovLPDvOTeqTL9bQp24FdQ3dZgT+mELZ/1VER0d8vGmr1sq2xaHotSfHlJ/9PTJLl0wOXXN65kgg26dVnnubNoskI4T0cwlC2vsCDK8CVKqZEy1gcKxCbTl5THmJr2w9hcTRLfoDK7oZSZeivmKpiBQaNkw2jk3DF2N4vWFvAQXdCETvv1zWv19H15YvLc=; 5:Y0kugkguvrOUQr+X1m8bB2DllIlNUMrkBsh+k/jjVKWv7onKufqfV//ysQ8XiIkPPNQBKMJI+DsOtb9HbwbplI/2XbLGnexSevX3Sr7d9afG2B06fbpADgjfIfCVNl25eDtzm2O/bB5nAsUjbxntjjdUS75RoLpf9Fr8VUuVi9o=; 24:ws7gMPIn6K9Q+KX3ZIgRKktPIIKNkp0zEyPDAE1YN2r039JQOX5BGqNAQyXsNSQrVBTvlzQprM5HRPb4L4V4sExg2Kn8tN09bnqWlwpZJvM=; 7:/WSrcr9kB6wPl7YtJezlL4PIWavzJh92Vhqu+tTecpI3fTA7LeiPou22gfXulLUgdkqLnvkz823j/Iqo+dpfpZ+wtzMQQmLRAUvzsfsTJaKdqwvxJhE8RL3fkZQ1uNbSMhgN2f+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: , X-List-Received-Date: Fri, 19 Jan 2018 17:24:59 -0000 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(-) 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 -- 2.7.4