From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0071.outbound.protection.outlook.com [104.47.41.71]) by dpdk.org (Postfix) with ESMTP id C9AD7A48D for ; Mon, 22 Jan 2018 16:03:20 +0100 (CET) Received: from BLUPR0301CA0038.namprd03.prod.outlook.com (10.162.113.176) by CY4PR03MB2695.namprd03.prod.outlook.com (10.173.43.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Mon, 22 Jan 2018 15:03:19 +0000 Received: from BN1BFFO11OLC001.protection.gbl (2a01:111:f400:7c10::1:186) by BLUPR0301CA0038.outlook.office365.com (2a01:111:e400:5259::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Mon, 22 Jan 2018 15:03:19 +0000 Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1BFFO11OLC001.mail.protection.outlook.com (10.58.145.12) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Mon, 22 Jan 2018 15:03:19 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id w0MDqVQR020039; Mon, 22 Jan 2018 06:52:41 -0700 From: Hemant Agrawal To: CC: , , Date: Mon, 22 Jan 2018 19:21:20 +0530 Message-ID: <1516629083-13967-5-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516629083-13967-1-git-send-email-hemant.agrawal@nxp.com> References: <1516428908-5430-1-git-send-email-hemant.agrawal@nxp.com> <1516629083-13967-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131611069994473137; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.158.2; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(346002)(396003)(376002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(86362001)(81156014)(81166006)(104016004)(106466001)(356003)(8676002)(2351001)(8936002)(6666003)(105606002)(54906003)(48376002)(6916009)(68736007)(16586007)(316002)(50466002)(51416003)(53936002)(50226002)(76176011)(2906002)(69596002)(2950100002)(305945005)(107886003)(77096007)(336011)(4326008)(6346003)(26005)(36756003)(97736004)(498600001)(47776003)(5660300001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2695; H:az84smr01.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11OLC001; 1:FVMna18P75U2hVZlySvSll/i58U2FZoOYeXzhv51hA2oWEoT1LRlJ9FS3aXSY2+jwJaYIDztgsZ7WN1WT1N71nQtg8TC1uJ1F6HrTKdQu9/w4D1O6ppfu7uS93bhdrqm MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9b277973-e001-4090-3553-08d561a945fc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:CY4PR03MB2695; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2695; 3:OJBXkAPY0QZwXi+lqIORj5qNdYgDxr2MYYtClOLO8uX69WaS7y4GOiKxec+lXQcLakikjY5nCwd2g1Tz3lrfJEgnyqZULnBSgBAbAY7aBsOhRTej576ftjC27o8L7vg+U6000BBIEKQz7iGEqToHDq6CtUcPCADi58HIITqQ3qGBriGBIKRUnQs9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aB85IGGeX46ultUCuTIM5IYBEJDvu6hUxyzQ+0COqLKwbhSNx5VL6IMwE/aetOky3YQHxF+PAo8wYkRbN2uT0EdZq/0aLPFTs3k0JZoIHmNBvWNUEESM= 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)(3231023)(2400081)(944501161)(93006095)(93001095)(3002001)(10201501046)(6055026)(6096035)(20161123559100)(20161123565025)(20161123563025)(20161123561025)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703151042153)(201708071742011); SRVR:CY4PR03MB2695; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CY4PR03MB2695; X-Forefront-PRVS: 0560A2214D X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2695; 23:4KQGvU6CajctqPIg0STzkIqAVtJch1LdFp0KtKwtS?= =?us-ascii?Q?Lo4OjY+Y7anY5yXIxi7Z0a+8HaeNDXdyDq0hi5odyHBUSxWUdp7/Psa8b1sU?= =?us-ascii?Q?1q0mnT25WoBduLpSijbFuiyk0OItSqdesiAeZnA0wtZZHTwax8dMNL6G1i7M?= =?us-ascii?Q?QChYWW3TGQRokw/r59IkWV8Umnmzm9eqHKUOtM59lDKrd2kY2MJxaodqCTS3?= =?us-ascii?Q?GjOqBaI+QccjjsIyvXJYwuPtJ8m80EgIdrBePDng1aL7lbwwoDLi34nUmvtv?= =?us-ascii?Q?ljIAO9U7ZxLhdY13i+qRXzX/hdflKFjqEY3BJ09/qjp6/jElSpYRmkjyJFT2?= =?us-ascii?Q?qAhdhZZnfIbxoAQ8XIQtF9GsUoTYRrLMVT/0Ey2fOMps/omOSE0pporopKFa?= =?us-ascii?Q?qN9Zw8SQwrR+ZvjTlfwW3zGD8JFVU7u4YzwQxT8xXozAUtHzUXngp2jvR5CN?= =?us-ascii?Q?Yvhlc3M7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cj2E9WV+tz+mZ31kywWnEqYj9Qe14uSmqxkRgwvSR5BgCDhytA2wF5iWn2xNP9Nn82bV9cl8dvaeei0iGbAYJA1PqkTE3U4mcuf9a6Yj9pRYNE9CRsq6O971V7XClKRi3t33z3gNALyc2dshw=; 5:w53gtH/GrxM4RrabLWKzPZO4AN76rK6IQphTh7dFtvzhTV+J0V/Kne0Uz2zbzg+lHXp4UeZXhThLva/SsdCou0/RfTDdiOAk1otPvp0XxBYgD3wHZzVqLOS1ZPDTSqqv1nveRuyMYa3CArhpU8HBLHaa5JPiGC/uNtHMuaQCItU=; 24:9MNf+Pj4rorxw0EIg6JaW4cV/AZmvicbkTznDYLn/69ilK06AhypT/ZJL7vovZbV56COetcBHXiFmawBYVuxJMAzROm+VO7otmquR4AZCMc=; 7:qKpkzw4vG6sbOfIA+6sFgyoQBwFAffDfIydwMOSVJuSmNQQOwgzl8QAtPH86fMp7NkH8Fpxz9bmwa6Q5I5o0NmA2lh6cKLCyGG9qvV7TXpxdl2S8m22x3B/ErdHTOyz/pPN/vTQgE17NC7lssLTDkDkby1KejVZBOv2GNw+61V7PFV0/hg0I9L/8O5HOpIA7x4DJ/GR36T1M6MC8yXmSFsm5AY/2JWNTWHj26qtzmRdpUipEEyRHLoWvpWnCB1WF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2018 15:03:19.1977 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9b277973-e001-4090-3553-08d561a945fc X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2695 Subject: [dpdk-dev] [PATCH v6 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: Mon, 22 Jan 2018 15:03:21 -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 Acked-by: Olivier Matz --- 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