From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by dpdk.org (Postfix) with ESMTP id DEB62C392 for ; Wed, 22 Apr 2015 11:57:51 +0200 (CEST) Received: by wizk4 with SMTP id k4so171116865wiz.1 for ; Wed, 22 Apr 2015 02:57:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NXtojJYCZ9w4kKl8A4WG78jWgvoD/CfVqlbXLdBA4qA=; b=hb1Nh70ndWYv+hHshdMWyLMhdy+1Ec6mJT1JASg2wjp6IOYExuDFfO2Pjtdgz/4sm0 lVlnF2k+yvXfY6FiWrBfouM40y1HpvuMQ6yr92Y2gvAosEdTXs0N/fA4Jx+UOhmqB2gh a7D0CSXKJnUSUPok9SIT/CQ6+p3aeqExTNnjNAgEkRU4tYtnOmTT2Z1Ce01qoMHCiDsM 3p9JUhcYGu/bkxpnIx4Jedpn47DJTCQigpO2jaPJQqaqHCEBwW/DZcBk1qY/BTbqTcfd ONLdaYL+z40RLDMfRqiDnCzIAw+6HvFZdwDXMzxhfRuKwDCYYg0hilQemk2jUlP9Zr1Z C9sQ== X-Gm-Message-State: ALoCoQnsjNzJH3fhZUUUDaAWVO+FOAwND2m0ly1QbpnnAWtq6FzjWSHF0k1W8SouOsn/CtiZOo+c X-Received: by 10.194.172.130 with SMTP id bc2mr298585wjc.85.1429696670719; Wed, 22 Apr 2015 02:57:50 -0700 (PDT) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id yr1sm6570006wjc.37.2015.04.22.02.57.49 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 22 Apr 2015 02:57:50 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Date: Wed, 22 Apr 2015 11:57:24 +0200 Message-Id: <1429696650-9043-8-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1429696650-9043-1-git-send-email-olivier.matz@6wind.com> References: <1429610122-30943-1-git-send-email-olivier.matz@6wind.com> <1429696650-9043-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v6 07/13] apps: use rte_pktmbuf_pool_create to create mbuf pools X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Apr 2015 09:57:52 -0000 When it's possible, use the new helper to create the mbuf pools. Most of the patch is trivial, except for the following files that have some specifics (indirect mbufs): - ip_fragmentation - ip_pipeline - ipv4_multicast - vhost Signed-off-by: Olivier Matz Acked-by: Neil Horman --- app/test-pipeline/init.c | 15 ++-------- app/test-pmd/testpmd.c | 19 ++++++------- app/test/test_distributor.c | 10 ++----- app/test/test_distributor_perf.c | 10 ++----- app/test/test_kni.c | 16 +++-------- app/test/test_link_bonding.c | 10 +++---- app/test/test_link_bonding_mode4.c | 12 +++----- app/test/test_mbuf.c | 22 +++++---------- app/test/test_pmd_perf.c | 11 +++----- app/test/test_pmd_ring.c | 10 ++----- app/test/test_reorder.c | 10 ++----- app/test/test_sched.c | 16 ++--------- app/test/test_table.c | 9 ++---- app/test/test_table.h | 3 +- examples/bond/main.c | 10 ++----- examples/distributor/main.c | 11 +++----- examples/dpdk_qat/main.c | 10 ++----- examples/exception_path/main.c | 14 ++++------ examples/ip_fragmentation/main.c | 18 ++++-------- examples/ip_pipeline/init.c | 32 ++++------------------ examples/ipv4_multicast/main.c | 23 ++++++---------- examples/kni/main.c | 12 +++----- examples/l2fwd-ivshmem/host/host.c | 10 ++----- examples/l2fwd-jobstats/main.c | 10 ++----- examples/l2fwd/main.c | 11 ++------ examples/l3fwd-acl/main.c | 11 +++----- examples/l3fwd-power/main.c | 11 +++----- examples/l3fwd-vf/main.c | 12 +++----- examples/l3fwd/main.c | 10 +++---- examples/link_status_interrupt/main.c | 10 ++----- examples/load_balancer/init.c | 12 ++------ examples/load_balancer/main.h | 4 +-- .../client_server_mp/mp_server/init.c | 10 ++----- examples/multi_process/symmetric_mp/main.c | 10 +++---- examples/netmap_compat/bridge/bridge.c | 12 +++----- examples/packet_ordering/main.c | 11 +++----- examples/qos_meter/main.c | 7 ++--- examples/qos_sched/init.c | 10 ++----- examples/qos_sched/main.h | 2 +- examples/quota_watermark/include/conf.h | 2 +- examples/quota_watermark/qw/main.c | 7 ++--- examples/rxtx_callbacks/main.c | 11 +++----- examples/skeleton/basicfwd.c | 13 ++------- examples/vhost/main.c | 24 +++++----------- examples/vhost_xen/main.c | 11 +++----- examples/vmdq/main.c | 11 +++----- examples/vmdq_dcb/main.c | 10 ++----- lib/librte_pmd_bond/rte_eth_bond_alb.c | 16 +++++------ 48 files changed, 180 insertions(+), 391 deletions(-) diff --git a/app/test-pipeline/init.c b/app/test-pipeline/init.c index 05f4503..db2196b 100644 --- a/app/test-pipeline/init.c +++ b/app/test-pipeline/init.c @@ -85,8 +85,7 @@ struct app_params app = { .ring_tx_size = 128, /* Buffer pool */ - .pool_buffer_size = 2048 + sizeof(struct rte_mbuf) + - RTE_PKTMBUF_HEADROOM, + .pool_buffer_size = 2048 + RTE_PKTMBUF_HEADROOM, .pool_size = 32 * 1024, .pool_cache_size = 256, @@ -144,16 +143,8 @@ app_init_mbuf_pools(void) { /* Init the buffer pool */ RTE_LOG(INFO, USER1, "Creating the mbuf pool ...\n"); - app.pool = rte_mempool_create( - "mempool", - app.pool_size, - app.pool_buffer_size, - app.pool_cache_size, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), - 0); + app.pool = rte_pktmbuf_pool_create("mempool", app.pool_size, + app.pool_cache_size, 0, app.pool_buffer_size, rte_socket_id()); if (app.pool == NULL) rte_panic("Cannot create mbuf pool\n"); } diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index 1f2445e..83a3d74 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -406,11 +406,11 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, #ifdef RTE_LIBRTE_PMD_XENVIRT rte_mp = rte_mempool_gntalloc_create(pool_name, nb_mbuf, mb_size, - (unsigned) mb_mempool_cache, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socket_id, 0); + (unsigned) mb_mempool_cache, + sizeof(struct rte_pktmbuf_pool_private), + rte_pktmbuf_pool_init, NULL, + rte_pktmbuf_init, NULL, + socket_id, 0); @@ -423,12 +423,9 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, rte_pktmbuf_init, NULL, socket_id, 0); else - rte_mp = rte_mempool_create(pool_name, nb_mbuf, mb_size, - (unsigned) mb_mempool_cache, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socket_id, 0); + /* wrapper to rte_mempool_create() */ + rte_mp = rte_pktmbuf_pool_create(pool_name, nb_mbuf, + mb_mempool_cache, 0, mbuf_seg_size, socket_id); #endif diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c index 9e8c06d..ad46987 100644 --- a/app/test/test_distributor.c +++ b/app/test/test_distributor.c @@ -500,7 +500,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p) worker_idx = 0; } -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) static int test_distributor(void) @@ -528,12 +528,8 @@ test_distributor(void) const unsigned nb_bufs = (511 * rte_lcore_count()) < BIG_BATCH ? (BIG_BATCH * 2) - 1 : (511 * rte_lcore_count()); if (p == NULL) { - p = rte_mempool_create("DT_MBUF_POOL", nb_bufs, - MBUF_SIZE, BURST, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + p = rte_pktmbuf_pool_create("DT_MBUF_POOL", nb_bufs, BURST, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (p == NULL) { printf("Error creating mempool\n"); return -1; diff --git a/app/test/test_distributor_perf.c b/app/test/test_distributor_perf.c index 31431bb..f04cb15 100644 --- a/app/test/test_distributor_perf.c +++ b/app/test/test_distributor_perf.c @@ -209,7 +209,7 @@ quit_workers(struct rte_distributor *d, struct rte_mempool *p) worker_idx = 0; } -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) static int test_distributor_perf(void) @@ -240,12 +240,8 @@ test_distributor_perf(void) const unsigned nb_bufs = (511 * rte_lcore_count()) < BIG_BATCH ? (BIG_BATCH * 2) - 1 : (511 * rte_lcore_count()); if (p == NULL) { - p = rte_mempool_create("DPT_MBUF_POOL", nb_bufs, - MBUF_SIZE, BURST, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + p = rte_pktmbuf_pool_create("DPT_MBUF_POOL", nb_bufs, BURST, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (p == NULL) { printf("Error creating mempool\n"); return -1; diff --git a/app/test/test_kni.c b/app/test/test_kni.c index 608901d..506b543 100644 --- a/app/test/test_kni.c +++ b/app/test/test_kni.c @@ -47,8 +47,7 @@ #define NB_MBUF 8192 #define MAX_PACKET_SZ 2048 -#define MBUF_SZ \ - (MAX_PACKET_SZ + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM) #define PKT_BURST_SZ 32 #define MEMPOOL_CACHE_SZ PKT_BURST_SZ #define SOCKET 0 @@ -118,17 +117,10 @@ test_kni_create_mempool(void) mp = rte_mempool_lookup("kni_mempool"); if (!mp) - mp = rte_mempool_create("kni_mempool", + mp = rte_pktmbuf_pool_create("kni_mempool", NB_MBUF, - MBUF_SZ, - MEMPOOL_CACHE_SZ, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, - NULL, - rte_pktmbuf_init, - NULL, - SOCKET, - 0); + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, + SOCKET); return mp; } diff --git a/app/test/test_link_bonding.c b/app/test/test_link_bonding.c index 8c24314..674d8dd 100644 --- a/app/test/test_link_bonding.c +++ b/app/test/test_link_bonding.c @@ -75,8 +75,7 @@ ETH_TXQ_FLAGS_NOXSUMSCTP | ETH_TXQ_FLAGS_NOXSUMUDP | \ ETH_TXQ_FLAGS_NOXSUMTCP) -#define MBUF_PAYLOAD_SIZE (2048) -#define MBUF_SIZE (MBUF_PAYLOAD_SIZE + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE (250) #define BURST_SIZE (32) @@ -280,10 +279,9 @@ test_setup(void) nb_mbuf_per_pool = RTE_TEST_RX_DESC_MAX + DEF_PKT_BURST + RTE_TEST_TX_DESC_MAX + MAX_PKT_BURST; if (test_params->mbuf_pool == NULL) { - test_params->mbuf_pool = rte_mempool_create("MBUF_POOL", nb_mbuf_per_pool, - 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("MBUF_POOL", + nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE, + rte_socket_id()); TEST_ASSERT_NOT_NULL(test_params->mbuf_pool, "rte_mempool_create failed"); } diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 02380f9..590daad 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -65,9 +65,7 @@ #define RX_RING_SIZE 128 #define TX_RING_SIZE 512 -#define MBUF_PAYLOAD_SIZE (2048) -#define MBUF_SIZE (MBUF_PAYLOAD_SIZE + sizeof(struct rte_mbuf) + \ - RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE (250) #define BURST_SIZE (32) @@ -390,11 +388,9 @@ test_setup(void) if (test_params.mbuf_pool == NULL) { nb_mbuf_per_pool = TEST_RX_DESC_MAX + DEF_PKT_BURST + TEST_TX_DESC_MAX + MAX_PKT_BURST; - test_params.mbuf_pool = rte_mempool_create("TEST_MODE4", - nb_mbuf_per_pool, MBUF_SIZE, MBUF_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, - socket_id, 0); + test_params.mbuf_pool = rte_pktmbuf_pool_create("TEST_MODE4", + nb_mbuf_per_pool, MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE, + socket_id); TEST_ASSERT(test_params.mbuf_pool != NULL, "rte_mempool_create failed\n"); diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c index 1ff66cb..4774263 100644 --- a/app/test/test_mbuf.c +++ b/app/test/test_mbuf.c @@ -61,7 +61,7 @@ #include "test.h" -#define MBUF_SIZE 2048 +#define MBUF_DATA_SIZE 2048 #define NB_MBUF 128 #define MBUF_TEST_DATA_LEN 1464 #define MBUF_TEST_DATA_LEN2 50 @@ -73,7 +73,6 @@ #define REFCNT_MAX_TIMEOUT 10 #define REFCNT_MAX_REF (RTE_MAX_LCORE) #define REFCNT_MBUF_NUM 64 -#define REFCNT_MBUF_SIZE (sizeof (struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define REFCNT_RING_SIZE (REFCNT_MBUF_NUM * REFCNT_MAX_REF) #define MAKE_STRING(x) # x @@ -622,12 +621,10 @@ test_refcnt_mbuf(void) /* create refcnt pool & ring if they don't exist */ if (refcnt_pool == NULL && - (refcnt_pool = rte_mempool_create( - MAKE_STRING(refcnt_pool), - REFCNT_MBUF_NUM, REFCNT_MBUF_SIZE, 0, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, - SOCKET_ID_ANY, 0)) == NULL) { + (refcnt_pool = rte_pktmbuf_pool_create( + MAKE_STRING(refcnt_pool), + REFCNT_MBUF_NUM, 0, 0, 0, + SOCKET_ID_ANY)) == NULL) { printf("%s: cannot allocate " MAKE_STRING(refcnt_pool) "\n", __func__); return (-1); @@ -764,13 +761,8 @@ test_mbuf(void) /* create pktmbuf pool if it does not exist */ if (pktmbuf_pool == NULL) { - pktmbuf_pool = - rte_mempool_create("test_pktmbuf_pool", NB_MBUF, - MBUF_SIZE, 32, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - SOCKET_ID_ANY, 0); + pktmbuf_pool = rte_pktmbuf_pool_create("test_pktmbuf_pool", + NB_MBUF, 32, 0, MBUF_DATA_SIZE, SOCKET_ID_ANY); } if (pktmbuf_pool == NULL) { diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index d6a4a45..49a494d 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -47,7 +47,7 @@ #define NB_ETHPORTS_USED (1) #define NB_SOCKETS (2) #define MEMPOOL_CACHE_SIZE 250 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define MAX_PKT_BURST (32) #define RTE_TEST_RX_DESC_DEFAULT (128) #define RTE_TEST_TX_DESC_DEFAULT (512) @@ -289,12 +289,9 @@ init_mbufpool(unsigned nb_mbuf) if (mbufpool[socketid] == NULL) { snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); mbufpool[socketid] = - rte_mempool_create(s, nb_mbuf, MBUF_SIZE, - MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socketid, 0); + rte_pktmbuf_pool_create(s, nb_mbuf, + MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE, + socketid); if (mbufpool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", diff --git a/app/test/test_pmd_ring.c b/app/test/test_pmd_ring.c index 7490112..53897f7 100644 --- a/app/test/test_pmd_ring.c +++ b/app/test/test_pmd_ring.c @@ -48,7 +48,7 @@ static struct rte_mempool *mp; #define RING_SIZE 256 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 512 static int @@ -406,12 +406,8 @@ test_pmd_ring_pair_create_attach(void) static int test_pmd_ring(void) { - mp = 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); + mp = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (mp == NULL) return -1; diff --git a/app/test/test_reorder.c b/app/test/test_reorder.c index 61cf8d3..91fbe9a 100644 --- a/app/test/test_reorder.c +++ b/app/test/test_reorder.c @@ -50,7 +50,7 @@ #define REORDER_BUFFER_SIZE 16384 #define NUM_MBUFS (2*REORDER_BUFFER_SIZE) #define REORDER_BUFFER_SIZE_INVALID 2049 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) struct reorder_unittest_params { struct rte_mempool *p; @@ -351,12 +351,8 @@ test_setup(void) /* mempool creation */ if (test_params->p == NULL) { - test_params->p = rte_mempool_create("RO_MBUF_POOL", NUM_MBUFS, - MBUF_SIZE, BURST, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + test_params->p = rte_pktmbuf_pool_create("RO_MBUF_POOL", + NUM_MBUFS, BURST, 0, MBUF_DATA_SIZE, rte_socket_id()); if (test_params->p == NULL) { printf("%s: Error creating mempool\n", __func__); return -1; diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 60c62de..c7239f8 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -86,8 +86,7 @@ static struct rte_sched_port_params port_param = { }; #define NB_MBUF 32 -#define MAX_PACKET_SZ 2048 -#define MBUF_SZ (MAX_PACKET_SZ + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SZ (2048 + RTE_PKTMBUF_HEADROOM) #define PKT_BURST_SZ 32 #define MEMPOOL_CACHE_SZ PKT_BURST_SZ #define SOCKET 0 @@ -100,17 +99,8 @@ create_mempool(void) mp = rte_mempool_lookup("test_sched"); if (!mp) - mp = rte_mempool_create("test_sched", - NB_MBUF, - MBUF_SZ, - MEMPOOL_CACHE_SZ, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, - NULL, - rte_pktmbuf_init, - NULL, - SOCKET, - 0); + mp = rte_pktmbuf_pool_create("test_sched", NB_MBUF, + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, SOCKET); return mp; } diff --git a/app/test/test_table.c b/app/test/test_table.c index c3093cc..de6c27d 100644 --- a/app/test/test_table.c +++ b/app/test/test_table.c @@ -89,15 +89,10 @@ app_init_mbuf_pools(void) printf("Getting/Creating the mempool ...\n"); pool = rte_mempool_lookup("mempool"); if (!pool) { - pool = rte_mempool_create( + pool = rte_pktmbuf_pool_create( "mempool", POOL_SIZE, - POOL_BUFFER_SIZE, - POOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - 0, + POOL_CACHE_SIZE, 0, POOL_BUFFER_SIZE, 0); if (pool == NULL) rte_panic("Cannot create mbuf pool\n"); diff --git a/app/test/test_table.h b/app/test/test_table.h index 64e9427..be331c0 100644 --- a/app/test/test_table.h +++ b/app/test/test_table.h @@ -65,7 +65,7 @@ #define PORT_TX_RING_SIZE 512 #define RING_RX_SIZE 128 #define RING_TX_SIZE 128 -#define POOL_BUFFER_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define POOL_BUFFER_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define POOL_SIZE (32 * 1024) #define POOL_CACHE_SIZE 256 #define BURST_SIZE 8 @@ -73,7 +73,6 @@ #define MAX_DUMMY_PORTS 2 #define MP_NAME "dummy_port_mempool" #define MBUF_COUNT (8000 * MAX_DUMMY_PORTS) -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) #define MP_CACHE_SZ 256 #define MP_SOCKET 0 #define MP_FLAGS 0 diff --git a/examples/bond/main.c b/examples/bond/main.c index 67c283d..fcb4c4e 100644 --- a/examples/bond/main.c +++ b/examples/bond/main.c @@ -96,7 +96,7 @@ #define RTE_LOGTYPE_DCB RTE_LOGTYPE_USER1 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUF (1024*8) #define MAX_PKT_BURST 32 @@ -738,12 +738,8 @@ main(int argc, char *argv[]) else if (nb_ports > MAX_PORTS) rte_exit(EXIT_FAILURE, "You can have max 4 ports\n"); - mbuf_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); + mbuf_pool = rte_pktmbuf_pool_create("MBUF_POOL", NB_MBUF, 32, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/distributor/main.c b/examples/distributor/main.c index 13fb04d..78fe3e9 100644 --- a/examples/distributor/main.c +++ b/examples/distributor/main.c @@ -47,7 +47,7 @@ #define RX_RING_SIZE 256 #define TX_RING_SIZE 512 #define NUM_MBUFS ((64*1024)-1) -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 #define RTE_RING_SZ 1024 @@ -528,12 +528,9 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Error: number of ports must be even, except " "when using a single port\n"); - 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, MBUF_DATA_SIZE, + rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); nb_ports_available = nb_ports; diff --git a/examples/dpdk_qat/main.c b/examples/dpdk_qat/main.c index 20e78bc..053be91 100644 --- a/examples/dpdk_qat/main.c +++ b/examples/dpdk_qat/main.c @@ -70,7 +70,7 @@ #include "crypto.h" -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUF (32 * 1024) #define MAX_PKT_BURST 32 @@ -598,7 +598,6 @@ print_ethaddr(const char *name, const struct ether_addr *eth_addr) static int init_mem(void) { - const unsigned flags = 0; int socketid; unsigned lcoreid; char s[64]; @@ -613,11 +612,8 @@ init_mem(void) if (pktmbuf_pool[socketid] == NULL) { snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); pktmbuf_pool[socketid] = - rte_mempool_create(s, NB_MBUF, MBUF_SIZE, 32, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socketid, flags); + rte_pktmbuf_pool_create(s, NB_MBUF, 32, 0, + MBUF_DATA_SIZE, socketid); if (pktmbuf_pool[socketid] == NULL) { printf("Cannot init mbuf pool on socket %d\n", socketid); return -1; diff --git a/examples/exception_path/main.c b/examples/exception_path/main.c index 14582de..b3fe170 100644 --- a/examples/exception_path/main.c +++ b/examples/exception_path/main.c @@ -81,11 +81,10 @@ #define MAX_PORTS (RTE_MAX_LCORE / 2) /* Max size of a single packet */ -#define MAX_PACKET_SZ 2048 +#define MAX_PACKET_SZ (2048) -/* Number of bytes needed for each mbuf */ -#define MBUF_SZ \ - (MAX_PACKET_SZ + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +/* Size of the data buffer in each mbuf */ +#define MBUF_DATA_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM) /* Number of mbufs in mempool that is created */ #define NB_MBUF 8192 @@ -532,11 +531,8 @@ main(int argc, char** argv) parse_args(argc, argv); /* Create the mbuf pool */ - pktmbuf_pool = rte_mempool_create("mbuf_pool", NB_MBUF, MBUF_SZ, - MEMPOOL_CACHE_SZ, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id()); if (pktmbuf_pool == NULL) { FATAL_ERROR("Could not initialise mbuf pool"); return -1; diff --git a/examples/ip_fragmentation/main.c b/examples/ip_fragmentation/main.c index cf63718..c702fdd 100644 --- a/examples/ip_fragmentation/main.c +++ b/examples/ip_fragmentation/main.c @@ -76,7 +76,7 @@ #define RTE_LOGTYPE_IP_FRAG RTE_LOGTYPE_USER1 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_SIZE (2048 + RTE_PKTMBUF_HEADROOM) /* allow max jumbo frame 9.5 KB */ #define JUMBO_FRAME_MAX_SIZE 0x2600 @@ -744,12 +744,8 @@ init_mem(void) socket); snprintf(buf, sizeof(buf), "pool_direct_%i", socket); - mp = rte_mempool_create(buf, NB_MBUF, - MBUF_SIZE, 32, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socket, 0); + mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32, + 0, MBUF_DATA_SIZE, socket); if (mp == NULL) { RTE_LOG(ERR, IP_FRAG, "Cannot create direct mempool\n"); return -1; @@ -762,12 +758,8 @@ init_mem(void) socket); snprintf(buf, sizeof(buf), "pool_indirect_%i", socket); - mp = rte_mempool_create(buf, NB_MBUF, - sizeof(struct rte_mbuf), 32, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socket, 0); + mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32, 0, 0, + socket); if (mp == NULL) { RTE_LOG(ERR, IP_FRAG, "Cannot create indirect mempool\n"); return -1; diff --git a/examples/ip_pipeline/init.c b/examples/ip_pipeline/init.c index 61d71c3..275fb35 100644 --- a/examples/ip_pipeline/init.c +++ b/examples/ip_pipeline/init.c @@ -146,8 +146,7 @@ struct app_params app = { .bsz_swq_wr = 64, /* Buffer pool */ - .pool_buffer_size = 2048 + sizeof(struct rte_mbuf) + - RTE_PKTMBUF_HEADROOM, + .pool_buffer_size = 2048 + RTE_PKTMBUF_HEADROOM, .pool_size = 32 * 1024, .pool_cache_size = 256, @@ -363,37 +362,18 @@ app_get_ring_resp(uint32_t core_id) static void app_init_mbuf_pools(void) { - struct rte_pktmbuf_pool_private indirect_mbp_priv; - /* Init the buffer pool */ RTE_LOG(INFO, USER1, "Creating the mbuf pool ...\n"); - app.pool = rte_mempool_create( - "mempool", - app.pool_size, - app.pool_buffer_size, - app.pool_cache_size, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), - 0); + app.pool = rte_pktmbuf_pool_create("mempool", app.pool_size, + app.pool_cache_size, 0, app.pool_buffer_size, rte_socket_id()); if (app.pool == NULL) rte_panic("Cannot create mbuf pool\n"); /* Init the indirect buffer pool */ RTE_LOG(INFO, USER1, "Creating the indirect mbuf pool ...\n"); - indirect_mbp_priv.mbuf_data_room_size = 0; - indirect_mbp_priv.mbuf_priv_size = sizeof(struct app_pkt_metadata); - app.indirect_pool = rte_mempool_create( - "indirect mempool", - app.pool_size, - sizeof(struct rte_mbuf) + sizeof(struct app_pkt_metadata), - app.pool_cache_size, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, &indirect_mbp_priv, - rte_pktmbuf_init, NULL, - rte_socket_id(), - 0); + app.indirect_pool = rte_pktmbuf_pool_create("indirect mempool", + app.pool_size, app.pool_cache_size, + sizeof(struct app_pkt_metadata), 0, rte_socket_id()); if (app.indirect_pool == NULL) rte_panic("Cannot create mbuf pool\n"); diff --git a/examples/ipv4_multicast/main.c b/examples/ipv4_multicast/main.c index 19832d8..575e989 100644 --- a/examples/ipv4_multicast/main.c +++ b/examples/ipv4_multicast/main.c @@ -77,13 +77,12 @@ #define MCAST_CLONE_PORTS 2 #define MCAST_CLONE_SEGS 2 -#define PKT_MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define PKT_MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_PKT_MBUF 8192 -#define HDR_MBUF_SIZE (sizeof(struct rte_mbuf) + 2 * RTE_PKTMBUF_HEADROOM) +#define HDR_MBUF_DATA_SIZE (2 * RTE_PKTMBUF_HEADROOM) #define NB_HDR_MBUF (NB_PKT_MBUF * MAX_PORTS) -#define CLONE_MBUF_SIZE (sizeof(struct rte_mbuf)) #define NB_CLONE_MBUF (NB_PKT_MBUF * MCAST_CLONE_PORTS * MCAST_CLONE_SEGS * 2) /* allow max jumbo frame 9.5 KB */ @@ -690,26 +689,20 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid IPV4_MULTICAST parameters\n"); /* create the mbuf pools */ - 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); + packet_pool = rte_pktmbuf_pool_create("packet_pool", NB_PKT_MBUF, 32, + 0, PKT_MBUF_DATA_SIZE, rte_socket_id()); if (packet_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init packet mbuf pool\n"); - header_pool = rte_mempool_create("header_pool", NB_HDR_MBUF, - HDR_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_pktmbuf_pool_create("header_pool", NB_HDR_MBUF, 32, + 0, HDR_MBUF_DATA_SIZE, rte_socket_id()); if (header_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init header mbuf pool\n"); - clone_pool = rte_mempool_create("clone_pool", NB_CLONE_MBUF, - CLONE_MBUF_SIZE, 32, sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + clone_pool = rte_pktmbuf_pool_create("clone_pool", NB_CLONE_MBUF, 32, + 0, 0, rte_socket_id()); if (clone_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init clone mbuf pool\n"); diff --git a/examples/kni/main.c b/examples/kni/main.c index 19d25d4..96ca473 100644 --- a/examples/kni/main.c +++ b/examples/kni/main.c @@ -80,9 +80,8 @@ /* Max size of a single packet */ #define MAX_PACKET_SZ 2048 -/* Number of bytes needed for each mbuf */ -#define MBUF_SZ \ - (MAX_PACKET_SZ + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +/* Size of the data buffer in each mbuf */ +#define MBUF_DATA_SZ (MAX_PACKET_SZ + RTE_PKTMBUF_HEADROOM) /* Number of mbufs in mempool that is created */ #define NB_MBUF (8192 * 16) @@ -867,11 +866,8 @@ main(int argc, char** argv) rte_exit(EXIT_FAILURE, "Could not parse input parameters\n"); /* Create the mbuf pool */ - pktmbuf_pool = rte_mempool_create("mbuf_pool", NB_MBUF, MBUF_SZ, - MEMPOOL_CACHE_SZ, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + pktmbuf_pool = rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, + MEMPOOL_CACHE_SZ, 0, MBUF_DATA_SZ, rte_socket_id()); if (pktmbuf_pool == NULL) { rte_exit(EXIT_FAILURE, "Could not initialise mbuf pool\n"); return -1; diff --git a/examples/l2fwd-ivshmem/host/host.c b/examples/l2fwd-ivshmem/host/host.c index 4f8d23e..197f22b 100644 --- a/examples/l2fwd-ivshmem/host/host.c +++ b/examples/l2fwd-ivshmem/host/host.c @@ -71,7 +71,7 @@ static uint32_t l2fwd_ivshmem_enabled_port_mask = 0; static struct ether_addr l2fwd_ivshmem_ports_eth_addr[RTE_MAX_ETHPORTS]; #define NB_MBUF 8192 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define MAX_RX_QUEUE_PER_LCORE 16 #define MAX_TX_QUEUE_PER_PORT 16 @@ -670,12 +670,8 @@ int main(int argc, char **argv) /* create a shared mbuf pool */ l2fwd_ivshmem_pktmbuf_pool = - rte_mempool_create(MBUF_MP_NAME, NB_MBUF, - MBUF_SIZE, 32, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + rte_pktmbuf_pool_create(MBUF_MP_NAME, NB_MBUF, 32, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (l2fwd_ivshmem_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c index f990045..fcebbda 100644 --- a/examples/l2fwd-jobstats/main.c +++ b/examples/l2fwd-jobstats/main.c @@ -70,7 +70,7 @@ #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 #define MAX_PKT_BURST 32 @@ -833,12 +833,8 @@ main(int argc, char **argv) /* 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); + rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (l2fwd_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); diff --git a/examples/l2fwd/main.c b/examples/l2fwd/main.c index 17621ee..d0a1ec8 100644 --- a/examples/l2fwd/main.c +++ b/examples/l2fwd/main.c @@ -71,7 +71,7 @@ #define RTE_LOGTYPE_L2FWD RTE_LOGTYPE_USER1 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 #define MAX_PKT_BURST 32 @@ -560,13 +560,8 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid L2FWD arguments\n"); /* 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, 32, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (l2fwd_pktmbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c index fce55f3..1a04004 100644 --- a/examples/l3fwd-acl/main.c +++ b/examples/l3fwd-acl/main.c @@ -80,7 +80,7 @@ #define MEMPOOL_CACHE_SIZE 256 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) /* * This expression is used to calculate the number of mbufs needed @@ -1848,12 +1848,9 @@ init_mem(unsigned nb_mbuf) if (pktmbuf_pool[socketid] == NULL) { snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); pktmbuf_pool[socketid] = - rte_mempool_create(s, nb_mbuf, MBUF_SIZE, - MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socketid, 0); + rte_pktmbuf_pool_create(s, nb_mbuf, + MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE, + socketid); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c index 4221239..bb0b66f 100644 --- a/examples/l3fwd-power/main.c +++ b/examples/l3fwd-power/main.c @@ -121,7 +121,7 @@ #define MEMPOOL_CACHE_SIZE 256 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) /* * This expression is used to calculate the number of mbufs needed depending on @@ -1379,12 +1379,9 @@ init_mem(unsigned nb_mbuf) if (pktmbuf_pool[socketid] == NULL) { snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); pktmbuf_pool[socketid] = - rte_mempool_create(s, nb_mbuf, - MBUF_SIZE, MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socketid, 0); + rte_pktmbuf_pool_create(s, nb_mbuf, + MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE, + socketid); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", diff --git a/examples/l3fwd-vf/main.c b/examples/l3fwd-vf/main.c index 20ba03a..f007bc1 100644 --- a/examples/l3fwd-vf/main.c +++ b/examples/l3fwd-vf/main.c @@ -94,7 +94,7 @@ #define MEMPOOL_CACHE_SIZE 256 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) /* * This expression is used to calculate the number of mbufs needed depending on user input, taking @@ -924,13 +924,9 @@ init_mem(unsigned nb_mbuf) } if (pktmbuf_pool[socketid] == NULL) { snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); - pktmbuf_pool[socketid] = - rte_mempool_create(s, nb_mbuf, MBUF_SIZE, - MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socketid, 0); + pktmbuf_pool[socketid] = rte_pktmbuf_pool_create(s, + nb_mbuf, MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE, + socketid); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", socketid); else diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c index 90e177f..7871038 100644 --- a/examples/l3fwd/main.c +++ b/examples/l3fwd/main.c @@ -119,7 +119,7 @@ #define MEMPOOL_CACHE_SIZE 256 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) /* * This expression is used to calculate the number of mbufs needed depending on user input, taking @@ -2315,11 +2315,9 @@ init_mem(unsigned nb_mbuf) if (pktmbuf_pool[socketid] == NULL) { snprintf(s, sizeof(s), "mbuf_pool_%d", socketid); pktmbuf_pool[socketid] = - rte_mempool_create(s, nb_mbuf, MBUF_SIZE, MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socketid, 0); + rte_pktmbuf_pool_create(s, nb_mbuf, + MEMPOOL_CACHE_SIZE, 0, MBUF_DATA_SIZE, + socketid); if (pktmbuf_pool[socketid] == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool on socket %d\n", socketid); diff --git a/examples/link_status_interrupt/main.c b/examples/link_status_interrupt/main.c index e6fb218..6adbd79 100644 --- a/examples/link_status_interrupt/main.c +++ b/examples/link_status_interrupt/main.c @@ -72,7 +72,7 @@ #define RTE_LOGTYPE_LSI RTE_LOGTYPE_USER1 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 #define MAX_PKT_BURST 32 @@ -614,12 +614,8 @@ main(int argc, char **argv) /* create the mbuf pool */ lsi_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); + rte_pktmbuf_pool_create("mbuf_pool", NB_MBUF, 32, 0, + MBUF_DATA_SIZE, rte_socket_id()); if (lsi_pktmbuf_pool == NULL) rte_panic("Cannot init mbuf pool\n"); diff --git a/examples/load_balancer/init.c b/examples/load_balancer/init.c index b35f797..5a56078 100644 --- a/examples/load_balancer/init.c +++ b/examples/load_balancer/init.c @@ -127,16 +127,10 @@ app_init_mbuf_pools(void) snprintf(name, sizeof(name), "mbuf_pool_%u", socket); printf("Creating the mbuf pool for socket %u ...\n", socket); - app.pools[socket] = rte_mempool_create( - name, - APP_DEFAULT_MEMPOOL_BUFFERS, - APP_DEFAULT_MBUF_SIZE, + app.pools[socket] = rte_pktmbuf_pool_create( + name, APP_DEFAULT_MEMPOOL_BUFFERS, APP_DEFAULT_MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - socket, - 0); + 0, APP_DEFAULT_MBUF_DATA_SIZE, socket); if (app.pools[socket] == NULL) { rte_panic("Cannot create mbuf pool on socket %u\n", socket); } diff --git a/examples/load_balancer/main.h b/examples/load_balancer/main.h index d9f878b..17c0f77 100644 --- a/examples/load_balancer/main.h +++ b/examples/load_balancer/main.h @@ -82,8 +82,8 @@ /* Mempools */ -#ifndef APP_DEFAULT_MBUF_SIZE -#define APP_DEFAULT_MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#ifndef APP_DEFAULT_MBUF_DATA_SIZE +#define APP_DEFAULT_MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #endif #ifndef APP_DEFAULT_MEMPOOL_BUFFERS diff --git a/examples/multi_process/client_server_mp/mp_server/init.c b/examples/multi_process/client_server_mp/mp_server/init.c index aadee76..dc3647d 100644 --- a/examples/multi_process/client_server_mp/mp_server/init.c +++ b/examples/multi_process/client_server_mp/mp_server/init.c @@ -71,9 +71,7 @@ #define MBUFS_PER_CLIENT 1536 #define MBUFS_PER_PORT 1536 #define MBUF_CACHE_SIZE 512 -#define MBUF_OVERHEAD (sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) -#define RX_MBUF_DATA_SIZE 2048 -#define MBUF_SIZE (RX_MBUF_DATA_SIZE + MBUF_OVERHEAD) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define RTE_MP_RX_DESC_DEFAULT 512 #define RTE_MP_TX_DESC_DEFAULT 512 @@ -104,10 +102,8 @@ init_mbuf_pools(void) * seems faster to use a cache instead */ printf("Creating mbuf pool '%s' [%u mbufs] ...\n", PKTMBUF_POOL_NAME, num_mbufs); - pktmbuf_pool = rte_mempool_create(PKTMBUF_POOL_NAME, num_mbufs, - MBUF_SIZE, MBUF_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, - NULL, rte_pktmbuf_init, NULL, rte_socket_id(), NO_FLAGS ); + pktmbuf_pool = rte_pktmbuf_pool_create(PKTMBUF_POOL_NAME, num_mbufs, + MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE, rte_socket_id()); return (pktmbuf_pool == NULL); /* 0 on success */ } diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c index 48448b4..7829c86 100644 --- a/examples/multi_process/symmetric_mp/main.c +++ b/examples/multi_process/symmetric_mp/main.c @@ -78,7 +78,7 @@ #define RTE_LOGTYPE_APP RTE_LOGTYPE_USER1 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUFS 64*1024 /* use 64k mbufs */ #define MBUF_CACHE_SIZE 256 #define PKT_BURST 32 @@ -446,11 +446,9 @@ main(int argc, char **argv) proc_type = rte_eal_process_type(); mp = (proc_type == RTE_PROC_SECONDARY) ? rte_mempool_lookup(_SMP_MBUF_POOL) : - rte_mempool_create(_SMP_MBUF_POOL, NB_MBUFS, MBUF_SIZE, - MBUF_CACHE_SIZE, sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_socket_id(), 0); + rte_pktmbuf_pool_create(_SMP_MBUF_POOL, NB_MBUFS, + MBUF_CACHE_SIZE, 0, MBUF_DATA_SIZE, + rte_socket_id()); if (mp == NULL) rte_exit(EXIT_FAILURE, "Cannot get memory pool for buffers\n"); diff --git a/examples/netmap_compat/bridge/bridge.c b/examples/netmap_compat/bridge/bridge.c index 0a8efbe..2d935cb 100644 --- a/examples/netmap_compat/bridge/bridge.c +++ b/examples/netmap_compat/bridge/bridge.c @@ -47,9 +47,8 @@ #include "compat_netmap.h" -#define BUF_SIZE 2048 -#define MBUF_SIZE (BUF_SIZE + sizeof(struct rte_mbuf) + \ - RTE_PKTMBUF_HEADROOM) +#define BUF_SIZE (2048) +#define MBUF_DATA_SIZE (BUF_SIZE + RTE_PKTMBUF_HEADROOM) #define MBUF_PER_POOL 8192 @@ -272,11 +271,8 @@ int main(int argc, char *argv[]) if (rte_eth_dev_count() < 1) rte_exit(EXIT_FAILURE, "Not enough ethernet ports available\n"); - 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); + pool = rte_pktmbuf_pool_create("mbuf_pool", MBUF_PER_POOL, 32, 0, + MBUF_DATA_SIZE, rte_socket_id()); if (pool == NULL) rte_exit(EXIT_FAILURE, "Couldn't create mempool\n"); diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c index f0a1b5a..5403c33 100644 --- a/examples/packet_ordering/main.c +++ b/examples/packet_ordering/main.c @@ -50,7 +50,7 @@ #define MAX_PKTS_BURST 32 #define REORDER_BUFFER_SIZE 8192 #define MBUF_PER_POOL 65535 -#define MBUF_SIZE (1600 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (1600 + RTE_PKTMBUF_HEADROOM) #define MBUF_POOL_CACHE_SIZE 250 #define RING_SIZE 16384 @@ -622,12 +622,9 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Error: number of ports must be even, except " "when using a single port\n"); - mbuf_pool = rte_mempool_create("mbuf_pool", MBUF_PER_POOL, MBUF_SIZE, - MBUF_POOL_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", MBUF_PER_POOL, + MBUF_POOL_CACHE_SIZE, 0, MBUF_DATA_SIZE, + rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "%s\n", rte_strerror(rte_errno)); diff --git a/examples/qos_meter/main.c b/examples/qos_meter/main.c index 4a981c6..a5e2510 100644 --- a/examples/qos_meter/main.c +++ b/examples/qos_meter/main.c @@ -70,7 +70,7 @@ * Buffer pool configuration * ***/ -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define NB_MBUF 8192 #define MEMPOOL_CACHE_SIZE 256 @@ -360,9 +360,8 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid input arguments\n"); /* Buffer pool init */ - pool = rte_mempool_create("pool", NB_MBUF, MBUF_SIZE, MEMPOOL_CACHE_SIZE, - sizeof(struct rte_pktmbuf_pool_private), rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, rte_socket_id(), 0); + pool = rte_pktmbuf_pool_create("pool", NB_MBUF, MEMPOOL_CACHE_SIZE, + 0, MBUF_DATA_SIZE, rte_socket_id()); if (pool == NULL) rte_exit(EXIT_FAILURE, "Buffer pool creation error\n"); diff --git a/examples/qos_sched/init.c b/examples/qos_sched/init.c index f38802e..aaf3466 100644 --- a/examples/qos_sched/init.c +++ b/examples/qos_sched/init.c @@ -335,13 +335,9 @@ int app_init(void) /* create the mbuf pools for each RX Port */ snprintf(pool_name, MAX_NAME_LEN, "mbuf_pool%u", i); - qos_conf[i].mbuf_pool = rte_mempool_create(pool_name, mp_size, MBUF_SIZE, - burst_conf.rx_burst * 4, - sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, - rte_eth_dev_socket_id(qos_conf[i].rx_port), - 0); + qos_conf[i].mbuf_pool = rte_pktmbuf_pool_create(pool_name, + mp_size, burst_conf.rx_burst * 4, 0, MBUF_DATA_SIZE, + rte_eth_dev_socket_id(qos_conf[i].rx_port)); if (qos_conf[i].mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot init mbuf pool for socket %u\n", i); diff --git a/examples/qos_sched/main.h b/examples/qos_sched/main.h index 971ec27..0e6f264 100644 --- a/examples/qos_sched/main.h +++ b/examples/qos_sched/main.h @@ -50,7 +50,7 @@ extern "C" { #define APP_RX_DESC_DEFAULT 128 #define APP_TX_DESC_DEFAULT 256 -#define MBUF_SIZE (1528 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (1528 + RTE_PKTMBUF_HEADROOM) #define APP_RING_SIZE (8*1024) #define NB_MBUF (2*1024*1024) diff --git a/examples/quota_watermark/include/conf.h b/examples/quota_watermark/include/conf.h index 8d95aaa..e80aca5 100644 --- a/examples/quota_watermark/include/conf.h +++ b/examples/quota_watermark/include/conf.h @@ -40,7 +40,7 @@ #define RX_DESC_PER_QUEUE 128 #define TX_DESC_PER_QUEUE 512 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define MBUF_PER_POOL 8192 #define QUOTA_WATERMARK_MEMZONE_NAME "qw_global_vars" diff --git a/examples/quota_watermark/qw/main.c b/examples/quota_watermark/qw/main.c index f269546..8ed0214 100644 --- a/examples/quota_watermark/qw/main.c +++ b/examples/quota_watermark/qw/main.c @@ -335,11 +335,8 @@ main(int argc, char **argv) rte_exit(EXIT_FAILURE, "Invalid quota/watermark argument(s)\n"); /* 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)); diff --git a/examples/rxtx_callbacks/main.c b/examples/rxtx_callbacks/main.c index 21117ce..fb8da51 100644 --- a/examples/rxtx_callbacks/main.c +++ b/examples/rxtx_callbacks/main.c @@ -43,7 +43,7 @@ #define TX_RING_SIZE 512 #define NUM_MBUFS 8191 -#define MBUF_SIZE (1600 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (1600 + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 @@ -204,12 +204,9 @@ main(int argc, char *argv[]) if (nb_ports < 2 || (nb_ports & 1)) rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n"); - 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, MBUF_DATA_SIZE, + rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c index 1bce6e7..ae606bf 100644 --- a/examples/skeleton/basicfwd.c +++ b/examples/skeleton/basicfwd.c @@ -43,7 +43,7 @@ #define TX_RING_SIZE 512 #define NUM_MBUFS 8191 -#define MBUF_SIZE (1600 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (1600 + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE 250 #define BURST_SIZE 32 @@ -190,15 +190,8 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Error: number of ports must be even\n"); /* Creates a new mempool in memory to hold the mbufs. */ - 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, MBUF_DATA_SIZE, rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/examples/vhost/main.c b/examples/vhost/main.c index fc73d1e..22d6a4b 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -67,7 +67,7 @@ (num_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 (2048 + RTE_PKTMBUF_HEADROOM) /* * No frame data buffer allocated from host are required for zero copy @@ -75,8 +75,7 @@ * directly use it. */ #define VIRTIO_DESCRIPTOR_LEN_ZCP 1518 -#define MBUF_SIZE_ZCP (VIRTIO_DESCRIPTOR_LEN_ZCP + sizeof(struct rte_mbuf) \ - + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE_ZCP (VIRTIO_DESCRIPTOR_LEN_ZCP + RTE_PKTMBUF_HEADROOM) #define MBUF_CACHE_SIZE_ZCP 0 #define MAX_PKT_BURST 32 /* Max burst size for RX/TX */ @@ -2844,11 +2843,8 @@ static void setup_mempool_tbl(int socket, uint32_t index, char *pool_name, char *ring_name, uint32_t nb_mbuf) { - vpool_array[index].pool - = rte_mempool_create(pool_name, nb_mbuf, MBUF_SIZE_ZCP, - MBUF_CACHE_SIZE_ZCP, sizeof(struct rte_pktmbuf_pool_private), - rte_pktmbuf_pool_init, NULL, - rte_pktmbuf_init, NULL, socket, 0); + vpool_array[index].pool = rte_pktmbuf_pool_create(pool_name, nb_mbuf, + MBUF_CACHE_SIZE_ZCP, 0, MBUF_DATA_SIZE_ZCP, socket); if (vpool_array[index].pool != NULL) { vpool_array[index].ring = rte_ring_create(ring_name, @@ -2932,15 +2928,9 @@ main(int argc, char *argv[]) if (zero_copy == 0) { /* Create the mbuf pool. */ - mbuf_pool = rte_mempool_create( - "MBUF_POOL", - NUM_MBUFS_PER_PORT - * valid_num_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_PER_PORT * valid_num_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/examples/vhost_xen/main.c b/examples/vhost_xen/main.c index b4a86e3..b672bf3 100644 --- a/examples/vhost_xen/main.c +++ b/examples/vhost_xen/main.c @@ -67,7 +67,7 @@ (num_switching_cores*MBUF_CACHE_SIZE)) #define MBUF_CACHE_SIZE 64 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) /* * RX and TX Prefetch, Host, and Write-back threshold values should be @@ -1474,12 +1474,9 @@ main(int argc, char *argv[]) } /* Create the mbuf pool. */ - mbuf_pool = rte_mempool_create("MBUF_POOL", NUM_MBUFS_PER_PORT * valid_num_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_PER_PORT * valid_num_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/examples/vmdq/main.c b/examples/vmdq/main.c index 7001860..7596bac 100644 --- a/examples/vmdq/main.c +++ b/examples/vmdq/main.c @@ -76,7 +76,7 @@ */ #define NUM_MBUFS_PER_PORT (128*512) #define MBUF_CACHE_SIZE 64 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define MAX_PKT_BURST 32 @@ -613,12 +613,9 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Error with valid ports number is not even or less than 2\n"); } - mbuf_pool = rte_mempool_create("MBUF_POOL", NUM_MBUFS_PER_PORT * 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_PER_PORT * 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/examples/vmdq_dcb/main.c b/examples/vmdq_dcb/main.c index 048c167..3c7f2b3 100644 --- a/examples/vmdq_dcb/main.c +++ b/examples/vmdq_dcb/main.c @@ -74,7 +74,7 @@ #define NUM_MBUFS 64*1024 #define MBUF_CACHE_SIZE 64 -#define MBUF_SIZE (2048 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATA_SIZE (2048 + RTE_PKTMBUF_HEADROOM) #define INVALID_PORT_ID 0xFF @@ -441,12 +441,8 @@ main(int argc, char *argv[]) rte_exit(EXIT_FAILURE, "Error with valid ports number is not even or less than 2\n"); } - 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, MBUF_DATA_SIZE, rte_socket_id()); if (mbuf_pool == NULL) rte_exit(EXIT_FAILURE, "Cannot create mbuf pool\n"); diff --git a/lib/librte_pmd_bond/rte_eth_bond_alb.c b/lib/librte_pmd_bond/rte_eth_bond_alb.c index 5778b25..6df318e 100644 --- a/lib/librte_pmd_bond/rte_eth_bond_alb.c +++ b/lib/librte_pmd_bond/rte_eth_bond_alb.c @@ -63,7 +63,7 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) struct bond_dev_private *internals = bond_dev->data->dev_private; struct client_data *hash_table = internals->mode6.client_table; - uint16_t element_size; + uint16_t data_size; char mem_name[RTE_ETH_NAME_MAX_LEN]; int socket_id = bond_dev->pci_dev->numa_node; @@ -79,15 +79,13 @@ bond_mode_alb_enable(struct rte_eth_dev *bond_dev) * 256 is size of ETH header, ARP header and nested VLAN headers. * The value is chosen to be cache aligned. */ - element_size = 256 + sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM; + data_size = 256 + RTE_PKTMBUF_HEADROOM; snprintf(mem_name, sizeof(mem_name), "%s_MODE6", bond_dev->data->name); - internals->mode6.mempool = rte_mempool_create(mem_name, - 512 * RTE_MAX_ETHPORTS, - 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, 0); + internals->mode6.mempool = rte_pktmbuf_pool_create(mem_name, + 512 * RTE_MAX_ETHPORTS, + RTE_MEMPOOL_CACHE_MAX_SIZE >= 32 ? + 32 : RTE_MEMPOOL_CACHE_MAX_SIZE, + 0, data_size, socket_id); if (internals->mode6.mempool == NULL) { RTE_LOG(ERR, PMD, "%s: Failed to initialize ALB mempool.\n", -- 2.1.4