apps: use helper to create mbuf pools
[dpdk.git] / examples / ip_pipeline / init.c
index d00027f..275fb35 100644 (file)
@@ -48,7 +48,6 @@
 #include <rte_memory.h>
 #include <rte_memcpy.h>
 #include <rte_memzone.h>
-#include <rte_tailq.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_launch.h>
@@ -113,7 +112,7 @@ struct app_params app = {
                .rx_adv_conf = {
                        .rss_conf = {
                                .rss_key = NULL,
-                               .rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6,
+                               .rss_hf = ETH_RSS_IP,
                        },
                },
                .txmode = {
@@ -147,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,
 
@@ -366,31 +364,16 @@ 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");
 
        /* Init the indirect buffer pool */
        RTE_LOG(INFO, USER1, "Creating the indirect mbuf pool ...\n");
-       app.indirect_pool = rte_mempool_create(
-               "indirect mempool",
-               app.pool_size,
-               sizeof(struct rte_mbuf) + sizeof(struct app_pkt_metadata),
-               app.pool_cache_size,
-               0,
-               NULL, NULL,
-               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");
 
@@ -419,7 +402,7 @@ app_init_rings(void)
        RTE_LOG(INFO, USER1, "Initializing %u SW rings ...\n", n_swq);
 
        app.rings = rte_malloc_socket(NULL, n_swq * sizeof(struct rte_ring *),
-               CACHE_LINE_SIZE, rte_socket_id());
+               RTE_CACHE_LINE_SIZE, rte_socket_id());
        if (app.rings == NULL)
                rte_panic("Cannot allocate memory to store ring pointers\n");
 
@@ -474,11 +457,6 @@ app_init_ports(void)
 {
        uint32_t i;
 
-       /* Init driver */
-       RTE_LOG(INFO, USER1, "Initializing the PMD driver ...\n");
-       if (rte_eal_pci_probe() < 0)
-               rte_panic("Cannot probe PCI\n");
-
        /* Init NIC ports, then start the ports */
        for (i = 0; i < app.n_ports; i++) {
                uint32_t port;
@@ -561,7 +539,7 @@ app_ping(void)
                        rte_panic("Unable to allocate new message\n");
 
                req = (struct app_msg_req *)
-                       ((struct rte_mbuf *)msg)->ctrl.data;
+                               rte_ctrlmbuf_data((struct rte_mbuf *)msg);
                req->type = APP_MSG_REQ_PING;
 
                /* Send request */
@@ -600,7 +578,7 @@ app_init_etc(void)
 void
 app_init(void)
 {
-       if ((sizeof(struct app_pkt_metadata) % CACHE_LINE_SIZE) != 0)
+       if ((sizeof(struct app_pkt_metadata) % RTE_CACHE_LINE_SIZE) != 0)
                rte_panic("Application pkt meta-data size mismatch\n");
 
        app_check_core_params();