From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0052.outbound.protection.outlook.com [104.47.37.52]) by dpdk.org (Postfix) with ESMTP id 5A2E82BA1 for ; Tue, 14 Feb 2017 17:26:19 +0100 (CET) Received: from CY1PR03CA0034.namprd03.prod.outlook.com (10.174.128.44) by BY2PR0301MB0728.namprd03.prod.outlook.com (10.160.63.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Tue, 14 Feb 2017 16:26:15 +0000 Received: from BL2FFO11OLC006.protection.gbl (2a01:111:f400:7c09::192) by CY1PR03CA0034.outlook.office365.com (2603:10b6:600::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16 via Frontend Transport; Tue, 14 Feb 2017 16:26:14 +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;nxp.com; dkim=none (message not signed) header.d=none; 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 BL2FFO11OLC006.mail.protection.outlook.com (10.173.160.95) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.904.16 via Frontend Transport; Tue, 14 Feb 2017 16:26:14 +0000 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v1EGQAUv026047; Tue, 14 Feb 2017 09:26:11 -0700 From: Hemant Agrawal To: , CC: Hemant Agrawal Date: Wed, 15 Feb 2017 03:30:16 +0530 Message-ID: <1487109616-28153-1-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1484896280-18814-1-git-send-email-hemant.agrawal@nxp.com> References: <1484896280-18814-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131315631743889916; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(336005)(39400400002)(39840400002)(39410400002)(39450400003)(39380400002)(39850400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(626004)(50466002)(2950100002)(48376002)(77096006)(5660300001)(53936002)(8656002)(47776003)(551984002)(38730400002)(85426001)(105606002)(50986999)(92566002)(76176999)(33646002)(68736007)(5003940100001)(189998001)(97736004)(86362001)(50226002)(305945005)(36756003)(106466001)(104016004)(8676002)(81156014)(2906002)(356003)(81166006)(8936002)(4326007)(81003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0728; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC006; 1:9tRY5iOlNABNbVjKesqVU4E2g+MD7ViLmN0L779uYpVz5ols4bjyQvCYGEGBegt6+SNJvV53XGT9Z8au0wsD8NUCCRf5hkdkffCRsNHIfqurpIgxmcN9moSzRPevYqBxOk8WLbtVlAdLS18m74qvJBmgmXH74xn9DLUG68Y5KoosPGBlnPS/Yx4iBK2VIeBA5MFPvM9pK3dI0EakCC4wBA4IbNRW00hP86tKG+UG3lrNbaogNBnPIxJmuJh6tVeIlvTGb2pvrLN/VHhpWi8pqztruSKmVkoasww1RBt0ViJ3fo7hXogC6otC0IeMxxNpRDbGbBQJGaoczfcNDQytl8NrikZxWgGkIfTs+HicSDYI3JljNbC29la4FiwDOk5ewPdw68uz6z0ZzHqTGbKEppLM44+74DuSzkDsqa0NWCMk5H/0CI4cCfvlGArVXJaIzTS+wJmDJGEEqPmaFXfbeKottzYSAgmMHYPOYbk14OduMO9/q+CZhGD7CqaX9UIvkLOgFH+LVQ7Yu9ImdLvtaQS9yJII7Z7LTvwQcpb4nuselpfP+qvwQUd0nskD/AeukoHigVQ4f0UrxHjbPmiuCUrGbwbO2AsKSPJWPZPKBy0jwSMNDYlZffH7mJvOeiWY5FOoeQPVJ1NpVmYVTUB9DdRWhYD4Qgn4zdtXwp7xdvpFJ0Q/xeGFE5LZjFoCIkIEPRNZ6h4co/Lvq2qyxCZsZA== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: f5318a78-8b0a-49b3-909f-08d454f63201 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:BY2PR0301MB0728; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 3:Gqe9t42wew1RuouumdhepsO05n/sD8PM657f3ugUHmtM0I4ZNLZq4doFdXtBjt0qJlXW7ecUZrJpJamEYAL64q5i7xI3WYv4CksQoidx82zGZnIpVWlCv7P8bqAMmlthzJAxBR8gYEs9hrlQE9jnjNTYi+xmHjtilFmYkzcSobfu37r++1nxFjMqdsBkZcnLzwphf3p07ttVd18mqXKHuw3BjoxD1TqunU/aZzzjH79UUkwQrKpMlzTD27D3m+PbyGZCgnDddjy21CO0h4n463oHv5Z4aWJMkfIyUrdKOq3f80oS7mKfIFpSjTWHqoWEcBWe4c/TuMx0VpAz0uwF8mmBhb2vxEMz9KpptC8hXh0AmEdLGKe3f9IAu4tEltKI; 25:sGUSQnCEM8NYe+zxQljoygoa3vczWYxTu5Z2GygtFiURzyWCJt7Ir/hOhSSnbbR+d1DnQwBhuHeoE0O3OuVyzLdZo+KAG0P15GiKWkI6xK6AuYxda6A3VYzFDZPUuuxpReq0DlUZpsDtE9ueP04FXjIhXa54T/w3Mu+MfbUzBodcCS35kF94dApOABny4PKRfxHDXvElYutaUC79xuWKWl+/da5rZQIM1vOexXN6OG9//5xe/eAkx5IWmzf6ETLU5gac1rkglQKUmADaO2aDEZXAHqXiSW/xFfUu4YhVnOdP2iZRHkpx0LDJCRYurWLvJ8HXSQS51CmrDbe/Tu9O2cy4M1XCfK76bXmcs7U+wdQ24QDDY8pDHREi4fQ7o5wwkF792Ri0F5KZBw8E0b5Jy+aqwnum54ibr1eN7fh2zvYtCNRQsoYGvAAvVnqDwWIz+7xqcGBfO4lM3kpPqY/4QA== X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 31:a9lacZ/wSpOOJlnRo05zD9cXras6FACdAbsHn5I5NyJwQ5OKpdYk+tqxOX31gZyy5pb7z3VIDmmS00g5zHH6Y2nTI7X3VDj1AKM+z2fjqnbdLefjqZTJg4e5xzVspQBSDdtM/i9VjFgHimzsrbRdeeiWS7KJshQqCc2YprTdJNa6Ln+4zsm33gWgM6/YoiG5DiU4lsN4obDcFSahNkUbNiA88TVwNrfhC8Co9gjKpmJ+zQTEvoYqO1C5V3kGFZPHU+Q1zZgTpcA1T677c0jRbw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(788757137089); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13023025)(13017025)(13015025)(5005006)(8121501046)(13024025)(13018025)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123565025)(20161123559025)(20161123556025); SRVR:BY2PR0301MB0728; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR0301MB0728; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0728; 4:Lz8A9TMIjakESI9L9sUk0Qd7rjTPeeiSpHvRakTvJLqPGCIg5swmIwsn14NxFyOaT8QBB0T+uJwNhZM+KVlZ/txdXoXYo4b/dUgsjghYkXEcqIe4MMi6CJDhnMG+stPQnzwLi5Uy0u02ay7OolsoNIyDisnSzRmq17rzSPYSiEuHiPl6B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Nq89/u4lvUwEcW7nh20bUdTeVFZ7rfYeIsgvsgBNCUOPZh4yCsNLfI2j9U6ZRcp/Kmg9ur+5B5i5Q6jTg5zdssuwhHtP43oLnYEjTxVisNdDTWGFrFeXJ3NWDrlrRXyusGZw8uio9O8J9Pm40/U14ObOVCVvZSORJV/BhWLIl4H2I7YYqE99QJN6HAcQHvxHdIKTchzxNpuwGCxgk9xLPI/3LTynZCdhVb5v9/0rp1S6VYGVnGL63pZjTIp3SK/5fuSlgGpnFJReM6llob3t2wWcg/3QssmSt7VDb5+9WlZPJf+ocGi3sQuDHUG/pHwcpdsmbZA9E7tx0iNuAtg6Ut4V/Q0lBKm3ST+eiNujqOmBTuc3xhSbT5yQDFx/kUIu5AtsQQQBUNKtEMJGMvw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Feb 2017 16:26:14.2017 (UTC) 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: BY2PR0301MB0728 Subject: [dpdk-dev] [PATCH v3] mbuf: use pktmbuf helper to create the pool 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: Tue, 14 Feb 2017 16:26:20 -0000 When possible, replace the uses of rte_mempool_create() with the helper provided in librte_mbuf: rte_pktmbuf_pool_create(). This is the preferred way to create a mbuf pool. This also updates the documentation. Signed-off-by: Olivier Matz Signed-off-by: Hemant Agrawal --- v3: * removing changes from ip_reassembly app v2: * removing compilation error from ip_reassmebly * fix minor patch apply warnings --- app/test/test_link_bonding_rssconf.c | 11 ++++---- doc/guides/sample_app_ug/ipv4_multicast.rst | 12 ++++---- doc/guides/sample_app_ug/l2_forward_job_stats.rst | 33 ++++++++-------------- .../sample_app_ug/l2_forward_real_virtual.rst | 26 +++++++---------- doc/guides/sample_app_ug/ptpclient.rst | 11 ++------ doc/guides/sample_app_ug/quota_watermark.rst | 26 ++++++----------- drivers/net/bonding/rte_eth_bond_8023ad.c | 13 ++++----- examples/ip_pipeline/init.c | 18 ++++++------ examples/multi_process/l2fwd_fork/main.c | 13 +++------ examples/tep_termination/main.c | 16 +++++------ lib/librte_mbuf/rte_mbuf.c | 7 +++-- lib/librte_mbuf/rte_mbuf.h | 29 +++++++++++-------- 12 files changed, 90 insertions(+), 125 deletions(-) diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c index 34f1c16..9034f62 100644 --- a/app/test/test_link_bonding_rssconf.c +++ b/app/test/test_link_bonding_rssconf.c @@ -67,7 +67,7 @@ #define SLAVE_RXTX_QUEUE_FMT ("rssconf_slave%d_q%d") #define NUM_MBUFS 8191 -#define MBUF_SIZE (1600 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_SIZE (1600 + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 @@ -536,13 +536,12 @@ struct link_bonding_rssconf_unittest_params { if (test_params.mbuf_pool == NULL) { - test_params.mbuf_pool = rte_mempool_create("RSS_MBUF_POOL", NUM_MBUFS * - SLAVE_COUNT, MBUF_SIZE, MBUF_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, - NULL, rte_pktmbuf_init, NULL, rte_socket_id(), 0); + test_params.mbuf_pool = rte_pktmbuf_pool_create( + "RSS_MBUF_POOL", NUM_MBUFS * SLAVE_COUNT, + MBUF_CACHE_SIZE, 0, MBUF_SIZE, rte_socket_id()); TEST_ASSERT(test_params.mbuf_pool != NULL, - "rte_mempool_create failed\n"); + "rte_pktmbuf_pool_create failed\n"); } /* Create / initialize ring eth devs. */ diff --git a/doc/guides/sample_app_ug/ipv4_multicast.rst b/doc/guides/sample_app_ug/ipv4_multicast.rst index 72da8c4..2c50a4f 100644 --- a/doc/guides/sample_app_ug/ipv4_multicast.rst +++ b/doc/guides/sample_app_ug/ipv4_multicast.rst @@ -145,12 +145,12 @@ Memory pools for indirect buffers are initialized differently from the memory po .. code-block:: c - packet_pool = rte_mempool_create("packet_pool", NB_PKT_MBUF, PKT_MBUF_SIZE, 32, sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, rte_socket_id(), 0); - - header_pool = rte_mempool_create("header_pool", NB_HDR_MBUF, HDR_MBUF_SIZE, 32, 0, NULL, NULL, rte_pktmbuf_init, NULL, rte_socket_id(), 0); - clone_pool = rte_mempool_create("clone_pool", NB_CLONE_MBUF, - CLONE_MBUF_SIZE, 32, 0, NULL, NULL, rte_pktmbuf_init, NULL, rte_socket_id(), 0); + packet_pool = rte_pktmbuf_pool_create("packet_pool", NB_PKT_MBUF, 32, + 0, PKT_MBUF_DATA_SIZE, rte_socket_id()); + header_pool = rte_pktmbuf_pool_create("header_pool", NB_HDR_MBUF, 32, + 0, HDR_MBUF_DATA_SIZE, rte_socket_id()); + clone_pool = rte_pktmbuf_pool_create("clone_pool", NB_CLONE_MBUF, 32, + 0, 0, rte_socket_id()); The reason for this is because indirect buffers are not supposed to hold any packet data and therefore can be initialized with lower amount of reserved memory for each buffer. diff --git a/doc/guides/sample_app_ug/l2_forward_job_stats.rst b/doc/guides/sample_app_ug/l2_forward_job_stats.rst index 2444e36..15743e6 100644 --- a/doc/guides/sample_app_ug/l2_forward_job_stats.rst +++ b/doc/guides/sample_app_ug/l2_forward_job_stats.rst @@ -193,36 +193,25 @@ and the application to store network packet data: .. code-block:: c /* create the mbuf pool */ - l2fwd_pktmbuf_pool = - rte_mempool_create("mbuf_pool", NB_MBUF, - MBUF_SIZE, 32, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, + MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, + rte_socket_id()); if (l2fwd_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); The rte_mempool is a generic structure used to handle pools of objects. -In this case, it is necessary to create a pool that will be used by the driver, -which expects to have some reserved space in the mempool structure, -sizeof(struct rte_pktmbuf_pool_private) bytes. -The number of allocated pkt mbufs is NB_MBUF, with a size of MBUF_SIZE each. -A per-lcore cache of 32 mbufs is kept. +In this case, it is necessary to create a pool that will be used by the driver. +The number of allocated pkt mbufs is NB_MBUF, with a data room size of +RTE_MBUF_DEFAULT_BUF_SIZE each. +A per-lcore cache of MEMPOOL_CACHE_SIZE mbufs is kept. The memory is allocated in rte_socket_id() socket, but it is possible to extend this code to allocate one mbuf pool per socket. -Two callback pointers are also given to the rte_mempool_create() function: - -* The first callback pointer is to rte_pktmbuf_pool_init() and is used - to initialize the private data of the mempool, which is needed by the driver. - This function is provided by the mbuf API, but can be copied and extended by the developer. - -* The second callback pointer given to rte_mempool_create() is the mbuf initializer. - The default is used, that is, rte_pktmbuf_init(), which is provided in the rte_mbuf library. - If a more complex application wants to extend the rte_pktmbuf structure for its own needs, - a new function derived from rte_pktmbuf_init( ) can be created. +The rte_pktmbuf_pool_create() function uses the default mbuf pool and mbuf +initializers, respectively rte_pktmbuf_pool_init() and rte_pktmbuf_init(). +An advanced application may want to use the mempool API to create the +mbuf pool with more control. Driver Initialization ~~~~~~~~~~~~~~~~~~~~~ diff --git a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst index cf15d1c..8a65be1 100644 --- a/doc/guides/sample_app_ug/l2_forward_real_virtual.rst +++ b/doc/guides/sample_app_ug/l2_forward_real_virtual.rst @@ -207,31 +207,25 @@ and the application to store network packet data: /* create the mbuf pool */ - l2fwd_pktmbuf_pool = rte_mempool_create("mbuf_pool", NB_MBUF, MBUF_SIZE, 32, sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, SOCKET0, 0); + l2fwd_pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, + MEMPOOL_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, + rte_socket_id()); if (l2fwd_pktmbuf_pool == NULL) rte_panic("Cannot init mbuf pool\n"); The rte_mempool is a generic structure used to handle pools of objects. -In this case, it is necessary to create a pool that will be used by the driver, -which expects to have some reserved space in the mempool structure, -sizeof(struct rte_pktmbuf_pool_private) bytes. -The number of allocated pkt mbufs is NB_MBUF, with a size of MBUF_SIZE each. +In this case, it is necessary to create a pool that will be used by the driver. +The number of allocated pkt mbufs is NB_MBUF, with a data room size of +RTE_MBUF_DEFAULT_BUF_SIZE each. A per-lcore cache of 32 mbufs is kept. The memory is allocated in NUMA socket 0, but it is possible to extend this code to allocate one mbuf pool per socket. -Two callback pointers are also given to the rte_mempool_create() function: - -* The first callback pointer is to rte_pktmbuf_pool_init() and is used - to initialize the private data of the mempool, which is needed by the driver. - This function is provided by the mbuf API, but can be copied and extended by the developer. - -* The second callback pointer given to rte_mempool_create() is the mbuf initializer. - The default is used, that is, rte_pktmbuf_init(), which is provided in the rte_mbuf library. - If a more complex application wants to extend the rte_pktmbuf structure for its own needs, - a new function derived from rte_pktmbuf_init( ) can be created. +The rte_pktmbuf_pool_create() function uses the default mbuf pool and mbuf +initializers, respectively rte_pktmbuf_pool_init() and rte_pktmbuf_init(). +An advanced application may want to use the mempool API to create the +mbuf pool with more control. .. _l2_fwd_app_dvr_init: diff --git a/doc/guides/sample_app_ug/ptpclient.rst b/doc/guides/sample_app_ug/ptpclient.rst index 6e425b7..823f83b 100644 --- a/doc/guides/sample_app_ug/ptpclient.rst +++ b/doc/guides/sample_app_ug/ptpclient.rst @@ -171,15 +171,8 @@ used by the application: .. code-block:: c - mbuf_pool = rte_mempool_create("MBUF_POOL", - NUM_MBUFS * nb_ports, - MBUF_SIZE, - MBUF_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), - 0); + mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NUM_MBUFS * nb_ports, + MBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id()); Mbufs are the packet buffer structure used by DPDK. They are explained in detail in the "Mbuf Library" section of the *DPDK Programmer's Guide*. diff --git a/doc/guides/sample_app_ug/quota_watermark.rst b/doc/guides/sample_app_ug/quota_watermark.rst index c56683a..633a30f 100644 --- a/doc/guides/sample_app_ug/quota_watermark.rst +++ b/doc/guides/sample_app_ug/quota_watermark.rst @@ -254,32 +254,24 @@ It contains a set of mbuf objects that are used by the driver and the applicatio .. code-block:: c /* Create a pool of mbuf to store packets */ - - mbuf_pool = rte_mempool_create("mbuf_pool", MBUF_PER_POOL, MBUF_SIZE, 32, sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, rte_socket_id(), 0); + mbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL, 32, 0, + MBUF_DATA_SIZE, rte_socket_id()); if (mbuf_pool == NULL) rte_panic("%s\n", rte_strerror(rte_errno)); The rte_mempool is a generic structure used to handle pools of objects. -In this case, it is necessary to create a pool that will be used by the driver, -which expects to have some reserved space in the mempool structure, sizeof(struct rte_pktmbuf_pool_private) bytes. +In this case, it is necessary to create a pool that will be used by the driver. -The number of allocated pkt mbufs is MBUF_PER_POOL, with a size of MBUF_SIZE each. +The number of allocated pkt mbufs is MBUF_PER_POOL, with a data room size +of MBUF_DATA_SIZE each. A per-lcore cache of 32 mbufs is kept. The memory is allocated in on the master lcore's socket, but it is possible to extend this code to allocate one mbuf pool per socket. -Two callback pointers are also given to the rte_mempool_create() function: - -* The first callback pointer is to rte_pktmbuf_pool_init() and is used to initialize the private data of the mempool, - which is needed by the driver. - This function is provided by the mbuf API, but can be copied and extended by the developer. - -* The second callback pointer given to rte_mempool_create() is the mbuf initializer. - -The default is used, that is, rte_pktmbuf_init(), which is provided in the rte_mbuf library. -If a more complex application wants to extend the rte_pktmbuf structure for its own needs, -a new function derived from rte_pktmbuf_init() can be created. +The rte_pktmbuf_pool_create() function uses the default mbuf pool and mbuf +initializers, respectively rte_pktmbuf_pool_init() and rte_pktmbuf_init(). +An advanced application may want to use the mempool API to create the +mbuf pool with more control. Ports Configuration and Pairing ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 2f7ae70..7b863d6 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -888,8 +888,8 @@ RTE_ASSERT(port->tx_ring == NULL); socket_id = rte_eth_devices[slave_id].data->numa_node; - element_size = sizeof(struct slow_protocol_frame) + sizeof(struct rte_mbuf) - + RTE_PKTMBUF_HEADROOM; + element_size = sizeof(struct slow_protocol_frame) + + RTE_PKTMBUF_HEADROOM; /* The size of the mempool should be at least: * the sum of the TX descriptors + BOND_MODE_8023AX_SLAVE_TX_PKTS */ @@ -900,11 +900,10 @@ } snprintf(mem_name, RTE_DIM(mem_name), "slave_port%u_pool", slave_id); - port->mbuf_pool = rte_mempool_create(mem_name, - total_tx_desc, element_size, - RTE_MEMPOOL_CACHE_MAX_SIZE >= 32 ? 32 : RTE_MEMPOOL_CACHE_MAX_SIZE, - sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, - NULL, rte_pktmbuf_init, NULL, socket_id, MEMPOOL_F_NO_SPREAD); + port->mbuf_pool = rte_pktmbuf_pool_create(mem_name, total_tx_desc, + RTE_MEMPOOL_CACHE_MAX_SIZE >= 32 ? + 32 : RTE_MEMPOOL_CACHE_MAX_SIZE, + 0, element_size, socket_id); /* Any memory allocation failure in initalization is critical because * resources can't be free, so reinitialization is impossible. */ diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index d46bd36..c7f9470 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -329,16 +329,14 @@ struct app_mempool_params *p = &app->mempool_params[i]; APP_LOG(app, HIGH, "Initializing %s ...", p->name); - app->mempool[i] = rte_mempool_create( - p->name, - p->pool_size, - p->buffer_size, - p->cache_size, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - p->cpu_socket_id, - 0); + app->mempool[i] = rte_pktmbuf_pool_create( + p->name, + p->pool_size, + p->cache_size, + 0, /* priv_size */ + p->buffer_size - + sizeof(struct rte_mbuf), /* mbuf data size */ + p->cpu_socket_id); if (app->mempool[i] == NULL) rte_panic("%s init error\n", p->name); diff --git a/examples/multi_process/l2fwd_fork/main.c b/examples/multi_process/l2fwd_fork/main.c index 2d951d9..b34916e 100644 --- a/examples/multi_process/l2fwd_fork/main.c +++ b/examples/multi_process/l2fwd_fork/main.c @@ -77,8 +77,7 @@ #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 #define MBUF_NAME "mbuf_pool_%d" -#define MBUF_SIZE \ -(RTE_MBUF_DEFAULT_DATAROOM + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE #define NB_MBUF 8192 #define RING_MASTER_NAME "l2fwd_ring_m2s_" #define RING_SLAVE_NAME "l2fwd_ring_s2m_" @@ -989,14 +988,10 @@ struct l2fwd_port_statistics { flags = MEMPOOL_F_SP_PUT | MEMPOOL_F_SC_GET; snprintf(buf_name, RTE_MEMPOOL_NAMESIZE, MBUF_NAME, portid); l2fwd_pktmbuf_pool[portid] = - rte_mempool_create(buf_name, NB_MBUF, - MBUF_SIZE, 32, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), flags); + rte_pktmbuf_pool_create(buf_name, NB_MBUF, 32, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (l2fwd_pktmbuf_pool[portid] == NULL) - rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); + rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); printf("Create mbuf %s\n", buf_name); } diff --git a/examples/tep_termination/main.c b/examples/tep_termination/main.c index bd1dc96..20dafdb 100644 --- a/examples/tep_termination/main.c +++ b/examples/tep_termination/main.c @@ -68,7 +68,7 @@ (nb_switching_cores * MBUF_CACHE_SIZE)) #define MBUF_CACHE_SIZE 128 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE RTE_MBUF_DEFAULT_BUF_SIZE #define MAX_PKT_BURST 32 /* Max burst size for RX/TX */ #define BURST_TX_DRAIN_US 100 /* TX drain every ~100us */ @@ -1199,15 +1199,13 @@ static inline void __attribute__((always_inline)) MAX_SUP_PORTS); } /* Create the mbuf pool. */ - mbuf_pool = rte_mempool_create( + mbuf_pool = rte_pktmbuf_pool_create( "MBUF_POOL", - NUM_MBUFS_PER_PORT - * valid_nb_ports, - MBUF_SIZE, MBUF_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + NUM_MBUFS_PER_PORT * valid_nb_ports, + MBUF_CACHE_SIZE, + 0, + MBUF_DATA_SIZE, + rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index 72ad91e..3fb2700 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -62,7 +62,7 @@ /* * ctrlmbuf constructor, given as a callback function to - * rte_mempool_create() + * rte_mempool_obj_iter() or rte_mempool_create() */ void rte_ctrlmbuf_init(struct rte_mempool *mp, @@ -77,7 +77,8 @@ /* * pktmbuf pool constructor, given as a callback function to - * rte_mempool_create() + * rte_mempool_create(), or called directly if using + * rte_mempool_create_empty()/rte_mempool_populate() */ void rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg) @@ -110,7 +111,7 @@ /* * pktmbuf constructor, given as a callback function to - * rte_mempool_create(). + * rte_mempool_obj_iter() or rte_mempool_create(). * Set the fields of a packet mbuf to their default values. */ void diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index ce57d47..fd5d32a 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -44,6 +44,13 @@ * buffers. The message buffers are stored in a mempool, using the * RTE mempool library. * + * The preferred way to create a mbuf pool is to use + * rte_pktmbuf_pool_create(). However, in some situations, an + * application may want to have more control (ex: populate the pool with + * specific memory), in this case it is possible to use functions from + * rte_mempool. See how rte_pktmbuf_pool_create() is implemented for + * details. + * * This library provides an API to allocate/free packet mbufs, which are * used to carry network packets. * @@ -812,14 +819,14 @@ static inline void __attribute__((always_inline)) * This function initializes some fields in an mbuf structure that are * not modified by the user once created (mbuf type, origin pool, buffer * start address, and so on). This function is given as a callback function - * to rte_mempool_create() at pool creation time. + * to rte_mempool_obj_iter() or rte_mempool_create() at pool creation time. * * @param mp * The mempool from which the mbuf is allocated. * @param opaque_arg * A pointer that can be used by the user to retrieve useful information - * for mbuf initialization. This pointer comes from the ``init_arg`` - * parameter of rte_mempool_create(). + * for mbuf initialization. This pointer is the opaque argument passed to + * rte_mempool_obj_iter() or rte_mempool_create(). * @param m * The mbuf to initialize. * @param i @@ -893,14 +900,14 @@ void rte_ctrlmbuf_init(struct rte_mempool *mp, void *opaque_arg, * This function initializes some fields in the mbuf structure that are * not modified by the user once created (origin pool, buffer start * address, and so on). This function is given as a callback function to - * rte_mempool_create() at pool creation time. + * rte_mempool_obj_iter() or rte_mempool_create() at pool creation time. * * @param mp * The mempool from which mbufs originate. * @param opaque_arg * A pointer that can be used by the user to retrieve useful information - * for mbuf initialization. This pointer comes from the ``init_arg`` - * parameter of rte_mempool_create(). + * for mbuf initialization. This pointer is the opaque argument passed to + * rte_mempool_obj_iter() or rte_mempool_create(). * @param m * The mbuf to initialize. * @param i @@ -915,7 +922,8 @@ void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg, * * This function initializes the mempool private data in the case of a * pktmbuf pool. This private data is needed by the driver. The - * function is given as a callback function to rte_mempool_create() at + * function must be called on the mempool before it is used, or it + * can be given as a callback function to rte_mempool_create() at * pool creation. It can be extended by the user, for example, to * provide another packet size. * @@ -923,8 +931,8 @@ void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg, * The mempool from which mbufs originate. * @param opaque_arg * A pointer that can be used by the user to retrieve useful information - * for mbuf initialization. This pointer comes from the ``init_arg`` - * parameter of rte_mempool_create(). + * for mbuf initialization. This pointer is the opaque argument passed to + * rte_mempool_create(). */ void rte_pktmbuf_pool_init(struct rte_mempool *mp, void *opaque_arg); @@ -932,8 +940,7 @@ void rte_pktmbuf_init(struct rte_mempool *mp, void *opaque_arg, * Create a mbuf pool. * * This function creates and initializes a packet mbuf pool. It is - * a wrapper to rte_mempool_create() with the proper packet constructor - * and mempool constructor. + * a wrapper to rte_mempool functions. * * @param name * The name of the mbuf pool. -- 1.9.1