From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0082.outbound.protection.outlook.com [104.47.42.82]) by dpdk.org (Postfix) with ESMTP id 988BD1B2E5 for ; Thu, 18 Jan 2018 14:27:58 +0100 (CET) Received: from MWHPR03CA0051.namprd03.prod.outlook.com (10.174.173.168) by BN6PR03MB2691.namprd03.prod.outlook.com (10.173.144.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.407.7; Thu, 18 Jan 2018 13:27:56 +0000 Received: from BY2FFO11OLC008.protection.gbl (2a01:111:f400:7c0c::104) by MWHPR03CA0051.outlook.office365.com (2603:10b6:301:3b::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.407.7 via Frontend Transport; Thu, 18 Jan 2018 13:27:56 +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 BY2FFO11OLC008.mail.protection.outlook.com (10.1.14.255) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Thu, 18 Jan 2018 13:27:54 +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 w0IDRdIn028023; Thu, 18 Jan 2018 06:27:50 -0700 From: Hemant Agrawal To: CC: , , Date: Thu, 18 Jan 2018 18:56:29 +0530 Message-ID: <1516281992-6873-5-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516281992-6873-1-git-send-email-hemant.agrawal@nxp.com> References: <1515996674-26338-1-git-send-email-hemant.agrawal@nxp.com> <1516281992-6873-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131607556759969045; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(346002)(39380400002)(396003)(376002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(53936002)(97736004)(2351001)(356003)(48376002)(305945005)(105606002)(5660300001)(106466001)(50466002)(4326008)(86362001)(8936002)(50226002)(8676002)(81156014)(81166006)(68736007)(498600001)(6666003)(6916009)(2950100002)(85426001)(54906003)(316002)(296002)(16586007)(47776003)(51416003)(76176011)(2906002)(104016004)(36756003)(77096007)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2691; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11OLC008; 1:SePTPyGEcaXKr9eWbWeBqGpkyl0HNwI6FIYrCDtegc4cb16alCCfhCl8EajJViFYRBXJE7xAu/pDYDPHRz9gCJJ2TYhrIbqwiQ1bQyShHPS5ZNOYasGUsdbSASejsUub MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9e25b32d-44f7-478e-5d15-08d55e7748e6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:BN6PR03MB2691; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2691; 3:YyewaPGJO1XoYa9bwFFE5aSRudtyLtEH7eMvErYciSjRly8nyuL/p1HwRSPEB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XPTfmnsbfAD5SsxIZWRfSKbc/YS5mex5OMNYM7X2FybK6dp2BfTk024HTIFz43reKfG5kOf2Ei61a0MfRZq65d/xMi7rHhi1eqawcqaCnpfHXQ1Gl1Va7d3ofu1pee1bewS4Lo4hQderbONzZXweQmuDdQyHyiFb1FyMME9Y5l8Ebe93kZ94Q1HPBFyreU4R9k2VcTWYBdrBVuzNFBKJFXbM8dgPEmagesNIM9aNiEphKw5Yod84LRgt4GqPQFQ= 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)(5005006)(8121501046)(93006095)(93001095)(3002001)(3231023)(2400062)(944501161)(10201501046)(6055026)(6096035)(20161123559100)(20161123556025)(20161123563025)(20161123561025)(20161123565025)(201703131430075)(201703131520075)(201703131433075)(201703131448075)(201703151042153)(201708071742011); SRVR:BN6PR03MB2691; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6PR03MB2691; X-Forefront-PRVS: 05568D1FF7 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2691; 23:KUd05Q9RIr6QHQROX5hBrqFC9CiowCiVfjNRiJgmC?= =?us-ascii?Q?Rgc2nWrbDeYPCcpPADCcsmo6VpjU7HEgry6+sJFWprBQumsNfg38c4RBQuHZ?= =?us-ascii?Q?mFimfF7aDvT3ty1ORgqeO7FeBFoNlSgsCbqpxCZn4QAHvPs4U9aNaD1Dgn6S?= =?us-ascii?Q?QUR22Cjgnki3U0WO1yQVf3Ma9V0iZlhK9Xkoti06Bj7WjLW8YTxJ7txnF/PY?= =?us-ascii?Q?qpTeidC/Zc7ZtCmE2PKXU2TIOXRgIogUfdHid9b0jDKFJBzD+ywbQdKCjTR7?= =?us-ascii?Q?Vg3WUmNJ469Mgxafjqn9Vo4unxil9xjJg/o6OSR3F5lHiLRHBVU/rNhqTJn0?= =?us-ascii?Q?lHOF7db30AJf7JoA83Tl298jMbBkRZ0Yf4FKUmWlkhN2AGsKWpgayzoAO3JE?= =?us-ascii?Q?FR5ICUwC8hA+FbVNocLKflg0hbMwlV6S/citBDwjg8dW8nSM+2TDU+dRUssV?= =?us-ascii?Q?lbML+m7begfRqNAZ5+R9iJ47R5yM83WX01JGo+asgxWLkSJ6jIa9XwOwVnN8?= =?us-ascii?Q?wmOlWtu0nbZipuQKi/0sYOAUTDQAlATw9t+q4RL2kbhRm5vL0tKbXK6+HVKl?= =?us-ascii?Q?AftfWIIAluiYLSzkozh3y0f6S/0tCRcJPPeOdGBwzLDOkGVN9/JKd2gmzty0?= =?us-ascii?Q?xqXmG+o8SCjoXTfqFGA0QrL0zAkKw+RgZeT113AO2TgckcLW80OYLbuS0tyE?= =?us-ascii?Q?0KcIGi4g+IvmaJtSoxSNQjQponCAhnVq1PrLnUHYvWBVx+XPeRfo+C0kJ+WL?= =?us-ascii?Q?siCymD0z/roXxJdBOJkYbLaAsZAjpHjHiF3zSGvbUeU6/GJ5g10XOMlmau/A?= =?us-ascii?Q?Jwy8uCzRXzuTHxSjtPdNhZz6lQRr+CBcJTZEGetgRQCdPM7efqfak51SlZKL?= =?us-ascii?Q?CsMzIYhoEdlCTJPx3iKbnMEmtvakJbLHqNgtrWOHQDd9lunJ8JAoRkAAZ+E4?= =?us-ascii?Q?DLjBbk8wB7S0iXudJTcbf5bzP8t6bH0IVCYxIYerf5uYbDLjcUzVVchgjkZp?= =?us-ascii?Q?yVozYESnU9d5EfRMBCBsGd63DACiIoPW7Uk3KOHG8LLtcx6X7yqZmlhKnl+c?= =?us-ascii?Q?Wz9tJm/BMb9GMYnaHF0lMwxp/CD?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2691; 6:lXskec2KXypo/jhY9oInMrF209rFlClyJN86kSU01b2Qqfv1z80ElycIGWNEV0v9u6UZwdv6aWdV2yi2KTTS3V/SO/LPSyMnPY1JZi3+T2otptlKYwOOTot4HaASxXxQzkgIUe5izU/taExHY2ugQSg/hFYDd6NmCw2hCsD2Ti91TsO3QUOQT8TQYbqXk4K48UJbVJJDLBVwGqs70/iv4XzI6C47I1DRqrMuHN7BYjSk+Y/iFMSYQ8kif2NPu+2BKRB1e0G16Z57xaIKT9tAkEKfIo9lKcQSEOWDI4zYt24wbIaOD8SndeslymhMZca140+btOz3fM3aGLLDNGEQ1N5K4HP89GEYvpXGIKUzPEs=; 5:PPxV9pYpAHKvx7jhmL5WjJyAtASzI91agyenqKCRYWzMKNKruntmvxjO+OmCw1S7LqsPNTTsLwuUC03hHVH+aI42N/L1eHH9LFenU+5Y/COaGUKcvEnh1llMdDJMsIhiW6zuJx/I7a4SOnrZ+GTA/155LV/QhYHhhOlSWsTDeho=; 24:GB7LB69fBpzHKC4v/ljwBgKWnlwZEwtKYAgusaJ3V0wZmBNsGlO/7VY3zVUTXRcrGO7Q78nn8VuL0ELv34TwSy1BZNg/sABL+0Mka5QMDgc=; 7:FsiELKqk9A4eGY2vpDR7hc1Z32HjRi1aO3aw9/ITX7PKDeBIg89gUsfpvagf/LfWFx5J4ALCVtZmXOHo15CttIVKdY41fopZnJ89a2bq4H25DaB588X8KzyyhmEwbGvTb7OVhDaDslD8uDR/qpSooZlOUrjeMHGPXrPotFIUTgRwNLYS7+zdyzuJN8yCv/ndS34z5vS4xFQiTFH89IGEi97Kz9IM5e2B0UVE5BG/Expi04lHMmQOnDq+dNswslcY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jan 2018 13:27:54.0625 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9e25b32d-44f7-478e-5d15-08d55e7748e6 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: BN6PR03MB2691 Subject: [dpdk-dev] [PATCH v3 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: Thu, 18 Jan 2018 13:27: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 a827e6e..4fee7e9 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1089,6 +1089,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