apps: use helper to create mbuf pools
authorOlivier Matz <olivier.matz@6wind.com>
Wed, 22 Apr 2015 09:57:24 +0000 (11:57 +0200)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 28 Apr 2015 09:34:10 +0000 (11:34 +0200)
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 <olivier.matz@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
48 files changed:
app/test-pipeline/init.c
app/test-pmd/testpmd.c
app/test/test_distributor.c
app/test/test_distributor_perf.c
app/test/test_kni.c
app/test/test_link_bonding.c
app/test/test_link_bonding_mode4.c
app/test/test_mbuf.c
app/test/test_pmd_perf.c
app/test/test_pmd_ring.c
app/test/test_reorder.c
app/test/test_sched.c
app/test/test_table.c
app/test/test_table.h
examples/bond/main.c
examples/distributor/main.c
examples/dpdk_qat/main.c
examples/exception_path/main.c
examples/ip_fragmentation/main.c
examples/ip_pipeline/init.c
examples/ipv4_multicast/main.c
examples/kni/main.c
examples/l2fwd-ivshmem/host/host.c
examples/l2fwd-jobstats/main.c
examples/l2fwd/main.c
examples/l3fwd-acl/main.c
examples/l3fwd-power/main.c
examples/l3fwd-vf/main.c
examples/l3fwd/main.c
examples/link_status_interrupt/main.c
examples/load_balancer/init.c
examples/load_balancer/main.h
examples/multi_process/client_server_mp/mp_server/init.c
examples/multi_process/symmetric_mp/main.c
examples/netmap_compat/bridge/bridge.c
examples/packet_ordering/main.c
examples/qos_meter/main.c
examples/qos_sched/init.c
examples/qos_sched/main.h
examples/quota_watermark/include/conf.h
examples/quota_watermark/qw/main.c
examples/rxtx_callbacks/main.c
examples/skeleton/basicfwd.c
examples/vhost/main.c
examples/vhost_xen/main.c
examples/vmdq/main.c
examples/vmdq_dcb/main.c
lib/librte_pmd_bond/rte_eth_bond_alb.c

index 05f4503..db2196b 100644 (file)
@@ -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");
 }
index 1f2445e..83a3d74 100644 (file)
@@ -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
 
index 9e8c06d..ad46987 100644 (file)
@@ -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;
index 31431bb..f04cb15 100644 (file)
@@ -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;
index 608901d..506b543 100644 (file)
@@ -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;
 }
index 8c24314..674d8dd 100644 (file)
@@ -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");
        }
index 02380f9..590daad 100644 (file)
@@ -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");
index 1ff66cb..4774263 100644 (file)
@@ -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) {
index d6a4a45..49a494d 100644 (file)
@@ -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",
index 7490112..53897f7 100644 (file)
@@ -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;
 
index 61cf8d3..91fbe9a 100644 (file)
@@ -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;
index 60c62de..c7239f8 100644 (file)
@@ -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;
 }
index c3093cc..de6c27d 100644 (file)
@@ -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");
index 64e9427..be331c0 100644 (file)
@@ -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
index 67c283d..fcb4c4e 100644 (file)
@@ -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");
 
index 13fb04d..78fe3e9 100644 (file)
@@ -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;
index 20e78bc..053be91 100644 (file)
@@ -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;
index 14582de..b3fe170 100644 (file)
 #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;
index cf63718..c702fdd 100644 (file)
@@ -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;
index 61d71c3..275fb35 100644 (file)
@@ -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");
 
index 19832d8..575e989 100644 (file)
 #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");
index 19d25d4..96ca473 100644 (file)
@@ -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;
index 4f8d23e..197f22b 100644 (file)
@@ -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");
 
index f990045..fcebbda 100644 (file)
@@ -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");
 
index 17621ee..d0a1ec8 100644 (file)
@@ -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");
 
index fce55f3..1a04004 100644 (file)
@@ -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",
index 4221239..bb0b66f 100644 (file)
 
 #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",
index 20ba03a..f007bc1 100644 (file)
@@ -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
index 90e177f..7871038 100644 (file)
 
 #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);
index e6fb218..6adbd79 100644 (file)
@@ -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");
 
index b35f797..5a56078 100644 (file)
@@ -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);
                }
index d9f878b..17c0f77 100644 (file)
@@ -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
index aadee76..dc3647d 100644 (file)
@@ -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 */
 }
index 48448b4..7829c86 100644 (file)
@@ -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");
 
index 0a8efbe..2d935cb 100644 (file)
@@ -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");
 
index f0a1b5a..5403c33 100644 (file)
@@ -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));
 
index 4a981c6..a5e2510 100644 (file)
@@ -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");
 
index f38802e..aaf3466 100644 (file)
@@ -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);
 
index 971ec27..0e6f264 100644 (file)
@@ -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)
 
index 8d95aaa..e80aca5 100644 (file)
@@ -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"
index f269546..8ed0214 100644 (file)
@@ -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));
 
index 21117ce..fb8da51 100644 (file)
@@ -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");
 
index 1bce6e7..ae606bf 100644 (file)
@@ -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");
index fc73d1e..22d6a4b 100644 (file)
@@ -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");
 
index b4a86e3..b672bf3 100644 (file)
@@ -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");
 
index 7001860..7596bac 100644 (file)
@@ -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");
 
index 048c167..3c7f2b3 100644 (file)
@@ -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");
 
index 5778b25..6df318e 100644 (file)
@@ -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",