apps: use helper to create mbuf pools
[dpdk.git] / examples / l2fwd-jobstats / main.c
index 67a9bad..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");
 
@@ -996,11 +992,11 @@ main(int argc, char **argv)
                                drain_tsc, 0);
 
                rte_timer_init(&qconf->flush_timer);
-               rte_timer_reset(&qconf->flush_timer, drain_tsc, PERIODICAL, lcore_id,
-                               &l2fwd_flush_job, NULL);
+               ret = rte_timer_reset(&qconf->flush_timer, drain_tsc, PERIODICAL,
+                               lcore_id, &l2fwd_flush_job, NULL);
 
                if (ret < 0) {
-                       rte_exit(1, "Failed to add flush job for lcore %u: %s",
+                       rte_exit(1, "Failed to reset flush job timer for lcore %u: %s",
                                        lcore_id, rte_strerror(-ret));
                }
 
@@ -1018,8 +1014,13 @@ main(int argc, char **argv)
                        rte_jobstats_set_update_period_function(job, l2fwd_job_update_cb);
 
                        rte_timer_init(&qconf->rx_timers[i]);
-                       rte_timer_reset(&qconf->rx_timers[i], 0, PERIODICAL, lcore_id,
+                       ret = rte_timer_reset(&qconf->rx_timers[i], 0, PERIODICAL, lcore_id,
                                        &l2fwd_fwd_job, (void *)(uintptr_t)i);
+
+                       if (ret < 0) {
+                               rte_exit(1, "Failed to reset lcore %u port %u job timer: %s",
+                                               lcore_id, qconf->rx_port_list[i], rte_strerror(-ret));
+                       }
                }
        }