From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0077.outbound.protection.outlook.com [104.47.37.77]) by dpdk.org (Postfix) with ESMTP id F1A141B1A2 for ; Sat, 20 Jan 2018 08:25:01 +0100 (CET) Received: from BN6PR03CA0084.namprd03.prod.outlook.com (10.164.122.150) by DM5PR03MB2699.namprd03.prod.outlook.com (10.168.197.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.428.17; Sat, 20 Jan 2018 07:25:00 +0000 Received: from BN1BFFO11FD031.protection.gbl (2a01:111:f400:7c10::1:178) by BN6PR03CA0084.outlook.office365.com (2603:10b6:405:6f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.428.17 via Frontend Transport; Sat, 20 Jan 2018 07:25:00 +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 BN1BFFO11FD031.mail.protection.outlook.com (10.58.144.94) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.428.12 via Frontend Transport; Sat, 20 Jan 2018 07:24:57 +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 w0K6GGgg024888; Fri, 19 Jan 2018 23:16:27 -0700 From: Hemant Agrawal To: CC: , , Date: Sat, 20 Jan 2018 11:45:05 +0530 Message-ID: <1516428908-5430-5-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516428908-5430-1-git-send-email-hemant.agrawal@nxp.com> References: <1516379639-25586-1-git-send-email-hemant.agrawal@nxp.com> <1516428908-5430-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131609067001570039; (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)(39860400002)(396003)(39380400002)(346002)(2980300002)(1110001)(1109001)(339900001)(199004)(189003)(81166006)(81156014)(2906002)(305945005)(8936002)(356003)(8676002)(50226002)(68736007)(336011)(97736004)(5660300001)(36756003)(50466002)(6916009)(316002)(76176011)(48376002)(51416003)(6666003)(2950100002)(16586007)(54906003)(47776003)(2351001)(86362001)(104016004)(105606002)(106466001)(4326008)(107886003)(53936002)(85426001)(498600001)(77096007)(26005); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2699; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD031; 1:z/LkUJAobfIz5x05RI/n28TotR8mzZ/5krdLMGe4kZyQS+BIANeVWHIdGrO+6FX1nyYuFj09zpqie44P9RgBiueRjNmmTmBR2PSruB31WDtRici8XuDK6sYoaKSPbojC MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0ceebc27-4905-416f-0196-08d55fd6ea4e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(5600026)(4604075)(2017052603307); SRVR:DM5PR03MB2699; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2699; 3:VcVnUzEERs1RkyXSBLjwM2ugL2BMVzoduTG8be5RNKDnR5Vho7kIwoeejwTpC0y3GmQEL9Y6Zdw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makkCWew4SwjylStlbVymmbq9cYf3eF/lBayHqppmmf2DXbWxGy89hkbaPevaCSX13Fw7v2LIBecaRNb1NxfnugYa8gk2oOX7bqoN/fVGYXmOHvEpy6DGgi1U54pEEwwDykDkwzop9GXqwiYty3+mbMeeZRtiXQr+Spmfbiquu9X2701P7phuHmwWMWKs1p5yhyc4dKdI9G9cgfQXC31qRS1lYKH/hvyOqFteUPb1GIduveSo= 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)(93006095)(93001095)(3002001)(3231023)(2400081)(944501161)(10201501046)(6055026)(6096035)(20161123563025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703151042153)(20161123556025)(20161123561025)(20161123559100)(201708071742011); SRVR:DM5PR03MB2699; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM5PR03MB2699; X-Forefront-PRVS: 0558D3C5AC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2699; 23:40zRf9fa+ecSzqBGGNuHGuVbZ847qs0VgoaaTXTLi?= =?us-ascii?Q?JOySk5MZg/3q3GC87KRoyLsv0RjLSUsyRnz093D/00Hs+N0K1uJMqGo3oX7w?= =?us-ascii?Q?oeGXT4OJz2Mdx0zJcPzfa7wIuOcEcwewB1iKMalIRf7jQ2YQFAeWG0CK411L?= =?us-ascii?Q?pvSTdNu5nkwAyAjha8FkMR5Fa9Sl3tzb4oghquOmUUip12+pnju2IRa0p3Ca?= =?us-ascii?Q?x0KFRr05jayVkLmujadiMcUNaQUUn+XaxxuoYHemYhRQPzboNgH9SPo/8GIZ?= =?us-ascii?Q?FneclkNJSFMqLvaM5e53yMjIoMYI++bfPrhpQfgAhOtknIgxah7fXkPJUYNf?= =?us-ascii?Q?R9h/EJvlV33oIf+OieZF8FMND4M6bFeQ35Sb3psRH7LYSfh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UHaFR5hOLO3dk1jrZbH0hV7CvTgZpOpAAIf+t/JQT0omvN9q3DSDVaE/Cf8OI9e85soM2GzvczKLJwxxW2zA2L1DOdAkXnD2KgGhAOD06nSNnY/oWr1sOMNiE4bTfMffpyHS2T6z7FMqmvxXSnIOSUMR06z2Slc2INgo+hXR447qDUXNYIs2H3zyFg/8WeLgWfXEWNKKkAHLSVaV8p3jICH8pbo=; 5:fmKiQ8gWvfFgHQ5SJhN+k32vGK6mdBEQZHn2kre0mC+0lRrOV37t5UBieWsjJLwtNzjn7lHQTOKO5ZF/BvUTw7tvSk0ibskXnwuJhk9gSmkjXwYd0oVi6WofOY6LTT/Ad9BjJM0OBXWtnpJj3oQ+fzIWoPRNBlIggumPx8zkjQA=; 24:cKaiXUIWZ3h2t2ecjnNGjCn71rc65ojN1QQ9H5Hq/KKEfeT/nhUO9mDPfmNAeMgmSsxcvMEUT1ALRZtfcNzCjPQ4LMc3qRhMfm03pTlojRU=; 7:u/m5KztrBwhOr4gxTYN2QSRctu/+cRs0X1GcGrm5Ke3Wc3kpg4DcJOdkRxfa12kYssEzUxIFB0DNHwiCzir58QVywYtrxGxzxCV0Eb9YtofGQ16KeyytmSU0Wu8y8k1dfEEDEMPNpqx86MhsUsVb1mPAMDQI5wBwwBthr3tK2SFwzN93xgtjXaJc7pf9q79MnkkEhehvMrF8gBDi9GYJg+EX1GuCqOEO1g7ZA/13Zxg5+K6ueb28f6gl3hIgjuEp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jan 2018 07:24:57.5361 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0ceebc27-4905-416f-0196-08d55fd6ea4e 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: DM5PR03MB2699 Subject: [dpdk-dev] [PATCH v5 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: Sat, 20 Jan 2018 07:25:02 -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