From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0057.outbound.protection.outlook.com [104.47.40.57]) by dpdk.org (Postfix) with ESMTP id 672151B356 for ; Fri, 22 Dec 2017 12:31:15 +0100 (CET) Received: from BN6PR03CA0001.namprd03.prod.outlook.com (10.168.230.139) by BN3PR03MB2354.namprd03.prod.outlook.com (10.166.74.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.345.14; Fri, 22 Dec 2017 11:31:13 +0000 Received: from BN1AFFO11OLC004.protection.gbl (2a01:111:f400:7c10::135) by BN6PR03CA0001.outlook.office365.com (2603:10b6:404:23::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.345.14 via Frontend Transport; Fri, 22 Dec 2017 11:31:13 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.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 BN1AFFO11OLC004.mail.protection.outlook.com (10.58.53.75) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.302.6 via Frontend Transport; Fri, 22 Dec 2017 11:30:58 +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 vBMBV9U3029645; Fri, 22 Dec 2017 04:31:10 -0700 From: Hemant Agrawal To: , CC: , , Hemant Agrawal Date: Fri, 22 Dec 2017 17:00:11 +0530 Message-ID: <1513942211-8314-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131584158590712369; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(336005)(7966004)(39380400002)(376002)(346002)(39860400002)(396003)(2980300002)(1110001)(1109001)(339900001)(189003)(199004)(86362001)(8656006)(110136005)(81166006)(8676002)(54906003)(105606002)(305945005)(81156014)(53936002)(8936002)(48376002)(50466002)(104016004)(68736007)(50226002)(51416003)(97736004)(2906002)(85426001)(6306002)(5660300001)(356003)(4326008)(316002)(498600001)(966005)(53376002)(47776003)(16586007)(106466001)(77096006)(36756003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2354; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11OLC004; 1:++T4H4+WY8aS9eDfVTkyVZlNP90ZZVTfGY7TMRMoT5/A1H2LqbQK18JqWzJJnf0eBkDNG0FsYL252grIW5VqDN4HeuxLQo5mcI3uq7Gk5+aTkQNPUJyp8g7F8djfXWbw MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 832304f6-9254-4408-3a31-08d5492f7955 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:BN3PR03MB2354; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2354; 3:SytrNjz6C74583stgBQVAZiD+4eWLBxDd3po4pPduz86ngA6WR/tMowd/m5Xw/n5gGhBzXhhiLelsx28csc03SzfXoDy3mNwYmo9d1PyVc7IeQ7slDV4XWeuU9Ank4AmQu5s3c/rj43V4Vpf2edVcMZEUinOme3moiaAptBuIc0VykZDYqacAj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MRNTbRIrwF7bSCnmZ56LIynTvpQrAPROQiTscT9I42JRvxtmT8qGVqVB4pHeXg24Njaq+lplt7KHDYTqEjjVRcuHZ/h+E/oBEgUxsTklJpaU= 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)(3002001)(93006095)(93001095)(10201501046)(3231023)(6055026)(6096035)(20161123556025)(20161123559100)(20161123563025)(20161123561025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123565025)(201708071742011); SRVR:BN3PR03MB2354; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN3PR03MB2354; X-Forefront-PRVS: 05299D545B X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2354; 23:ywzV2VzPb9drpfbd8Pm+4iB3aWSZpp5LjC2TCZXot?= =?us-ascii?Q?sUcnis5ZnyjcXtixlKItLXn54UXYl35YpMowI2ew2IVVTu4EO96Rt2PbZZ8U?= =?us-ascii?Q?dD0m7+JG1FGe6ce1rrOPKHH++I9UkrSR+tS/F3EHgOFZ3Rn7VdwEDUy2gGdi?= =?us-ascii?Q?YdPSSohxaGdt45oenAVosD5K1SffAdtJyquDyJaYbP1aE8ToZA6ZCWRAbkdk?= =?us-ascii?Q?jFDyFaB1oqD511FtTNQ9zge6+rHIR/bBmy+BQ9qbWaR/lOnXGfm49ycYDAID?= =?us-ascii?Q?KKW8y1Bgg17OVJFK+wkUHUK8WZWPvU+8X8NGU2tZPRCj2T/5mHND8bqAeshU?= =?us-ascii?Q?guPTfjcX8myUDq4HbckbeY7QE2GcLxczwGByR+8GZizkdBQjJbbScl5jZKRw?= =?us-ascii?Q?/+e0usp03+5CeH4pTv8yrkMgxNR0utxvwukTJbyOFdPrhGuLKQOHrEP2nv8K?= =?us-ascii?Q?gCyagLtuLHD/aWyKUvyBn99QgU3SyAGS50Hr1ZedBsALabgZi6QrG8SK3VNI?= =?us-ascii?Q?eQltcRDI1tdsdaPznvu+a6Go9bFwwtVRye6xMlR/AI77H8JaEZ+XCIkfiRzo?= =?us-ascii?Q?KHeykmqiGZw0NzbgyOZt9DyhObLGlDbfN0baIiLMI995vhucIBOzTcU3U+Bw?= =?us-ascii?Q?h/Gpe34zQUP/W131t/OX+x6qSYKKDENsjrHWLawKUhUmi1JdxBzBAU0y+4hp?= =?us-ascii?Q?b+PXZceo4g3QQ+tYo/W2cKGPmGpM7X750rsA/SXbZ5Ifb9istMaE+citz+Rg?= =?us-ascii?Q?UfsRulIYgef1oPIFhSGChAnDrKQD6QqDovvprR0JNCR2nLKLB5eERY6VSoYs?= =?us-ascii?Q?W7647xLpkvoy7krw3wsWzImUazRZGjZ7Qmm5b/v6xOYHL7tk7D3r3AE7tCA7?= =?us-ascii?Q?3SCXAWrOPlhY66TG+IZTC+NrkzG2y5LZZPyJkXP13WbVz/5k+wbXA2O1Igig?= =?us-ascii?Q?y3rVmi0jnzyvR7sYDD4Sqme6P2/+KK5+z3DxkBaZesGici0HHZngeKnVsNyu?= =?us-ascii?Q?sbdqRddzStAgmxzAbmGfJPoPDcqMorVqK+iLn67LvxJIkVV0zVELNAhxTR25?= =?us-ascii?Q?+VQSPfDlucL7hCSvTmoe5OD9950?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2354; 6:bHdgPwfPr4uC1tOUfwjf8r2HrkU52jewnihxpaBkfBf1j2CRP3Cfn6DuWqUqCgLWiMVwAp1n3w7wQf06wiQOx6Z9QGdvQEAye3P8HsEWDbcIGhzJ2kPrFg/uTW/znuM4NqyaI9Wh1ftxKfklqDskPCDzbCWk2DL0WNSkA9XcTnOL7WGfTIGuYbXFCs/591IArnsFXeBgP/XsKvwEtBC7sXa67MOz6AFg0DXgKPGoDv2rgWFZSk23i0dFR6MVQie09iOemztG20K8DQwCUHo2nedQbFErRQ5ZElzpf7iWLYNEFE/WmZEGiwGdOqsztyqFHvIY34v2GBTqraNg08UuvQ8YxCNS3A/Vn+bK8mA1LUI=; 5:wT7m60y43RK3X3b2EghRSN3k6k6QgyfL9kOf0zIo2vyDxqxMBJm9UDmQacuCSazz0bdQzWSjMNRl/ywIr/VNGaGpzr1o4mtWTqFE+l+9IFvzXDF82fgY94ZEanxMLmCmNfMBXU+k1wE1GEo2TguZMlAMs0db3RXM06gfx94MrhA=; 24:X2514V4NtTtxiVCxFE3iZZuGVY5fQWsVLda8qSIY1Tdod2TckhEIwqk2hahQFW5erR35oGsZkuZQU1zXf8Q9WEKYx0bIIYqTp2GGyzrjmVk=; 7:dPQigM2Df8Q/lweI4rAXQm6FBGbDur3jHcoE5KkaO4wOKcB1HzjpoeGgZzU3yBwfVuPcF54QDv7qzzQ9S3uOlCVKhKMf9Ezca2IMIr2EqAsxBPv4CkQqjKn0iiKHtPZRl3vJNGa+kPsveRyEPUYcvuQIhupCRwWAeD5AQnORGt+ZB842s0k0dQlKgnGVUPX2EWlfujzwPATkvUqJoFCe7RsKLtzWd1s0vacsBUPyOa6bUaewJQyRFYduTkHBtZgU SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Dec 2017 11:30:58.8528 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 832304f6-9254-4408-3a31-08d5492f7955 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: BN3PR03MB2354 Subject: [dpdk-dev] [PATCH] 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, 22 Dec 2017 11:31:16 -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 --- This change was discussed in the "doc: announce ABI change for pktmbuf pool create API" http://dpdk.org/dev/patchwork/patch/32306/ lib/librte_mbuf/rte_mbuf.c | 24 ++++++++++++++++++------ lib/librte_mbuf/rte_mbuf.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 6 deletions(-) diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 7543662..9cc861b 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -148,15 +148,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*/ 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_specific(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; @@ -176,7 +176,9 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, if (mp == NULL) return NULL; - mp_ops_name = rte_eal_mbuf_default_mempool_ops(); + if (!mp_ops_name) + mp_ops_name = rte_eal_mbuf_default_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"); @@ -198,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_specific(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 ce8a05d..d4681fd 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1081,6 +1081,48 @@ rte_pktmbuf_pool_create(const char *name, unsigned n, int socket_id); /** + * Create a mbuf pool with specific mempool ops + * + * 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_specific(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