apps: use helper to create mbuf pools
[dpdk.git] / examples / multi_process / symmetric_mp / main.c
index 01faae9..7829c86 100644 (file)
@@ -58,7 +58,6 @@
 #include <rte_memory.h>
 #include <rte_memzone.h>
 #include <rte_launch.h>
-#include <rte_tailq.h>
 #include <rte_eal.h>
 #include <rte_per_lcore.h>
 #include <rte_lcore.h>
@@ -79,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
@@ -229,6 +228,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
                        }
        };
        const uint16_t rx_rings = num_queues, tx_rings = num_queues;
+       struct rte_eth_dev_info info;
        int retval;
        uint16_t q;
 
@@ -241,6 +241,9 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
        printf("# Initialising port %u... ", (unsigned)port);
        fflush(stdout);
 
+       rte_eth_dev_info_get(port, &info);
+       info.default_rxconf.rx_drop_en = 1;
+
        retval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);
        if (retval < 0)
                return retval;
@@ -248,7 +251,7 @@ smp_port_init(uint8_t port, struct rte_mempool *mbuf_pool, uint16_t num_queues)
        for (q = 0; q < rx_rings; q ++) {
                retval = rte_eth_rx_queue_setup(port, q, RX_RING_SIZE,
                                rte_eth_dev_socket_id(port),
-                               NULL,
+                               &info.default_rxconf,
                                mbuf_pool);
                if (retval < 0)
                        return retval;
@@ -443,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");