- int ret;
- unsigned int lcore_id, master_lcore_id, last_lcore_id;
-
- uint8_t port_id;
-
- rte_set_log_level(RTE_LOG_INFO);
-
- ret = rte_eal_init(argc, argv);
- if (ret < 0)
- rte_exit(EXIT_FAILURE, "Cannot initialize EAL\n");
-
- argc -= ret;
- argv += ret;
-
- init_dpdk();
- setup_shared_variables();
-
- *quota = 32;
- *low_watermark = 60 * RING_SIZE / 100;
-
- last_lcore_id = get_last_lcore_id();
- master_lcore_id = rte_get_master_lcore();
-
- /* Parse the application's arguments */
- ret = parse_qw_args(argc, argv);
- if (ret < 0)
- 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);
- if (mbuf_pool == NULL)
- rte_panic("%s\n", rte_strerror(rte_errno));
-
- for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++)
- if (is_bit_set(port_id, portmask)) {
- configure_eth_port(port_id);
- init_ring(master_lcore_id, port_id);
- }
-
- pair_ports();
-
- /* Start pipeline_connect() on all the available slave lcore but the last */
- for (lcore_id = 0 ; lcore_id < last_lcore_id; lcore_id++) {
- if (rte_lcore_is_enabled(lcore_id) && lcore_id != master_lcore_id) {
-
- for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++)
- if (is_bit_set(port_id, portmask))
- init_ring(lcore_id, port_id);
-
- /* typecast is a workaround for GCC 4.3 bug */
- rte_eal_remote_launch((int (*)(void *))pipeline_stage, NULL, lcore_id);
- }
- }
-
- /* Start send_stage() on the last slave core */
- /* typecast is a workaround for GCC 4.3 bug */
- rte_eal_remote_launch((int (*)(void *))send_stage, NULL, last_lcore_id);
-
- /* Start receive_stage() on the master core */
- receive_stage(NULL);
-
- return 0;
+ int ret;
+ unsigned int lcore_id, master_lcore_id, last_lcore_id;
+
+ uint16_t port_id;
+
+ rte_log_set_global_level(RTE_LOG_INFO);
+
+ ret = rte_eal_init(argc, argv);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Cannot initialize EAL\n");
+
+ argc -= ret;
+ argv += ret;
+
+ init_dpdk();
+ setup_shared_variables();
+
+ *quota = 32;
+ *low_watermark = 60 * RING_SIZE / 100;
+
+ last_lcore_id = get_last_lcore_id();
+ master_lcore_id = rte_get_master_lcore();
+
+ /* Parse the application's arguments */
+ ret = parse_qw_args(argc, argv);
+ if (ret < 0)
+ rte_exit(EXIT_FAILURE, "Invalid quota/watermark argument(s)\n");
+
+ /* Create a pool of mbuf to store packets */
+ 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));
+
+ for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++)
+ if (is_bit_set(port_id, portmask)) {
+ configure_eth_port(port_id);
+ init_ring(master_lcore_id, port_id);
+ }
+
+ pair_ports();
+
+ /*
+ * Start pipeline_connect() on all the available slave lcores
+ * but the last
+ */
+ for (lcore_id = 0 ; lcore_id < last_lcore_id; lcore_id++) {
+ if (rte_lcore_is_enabled(lcore_id) &&
+ lcore_id != master_lcore_id) {
+
+ for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++)
+ if (is_bit_set(port_id, portmask))
+ init_ring(lcore_id, port_id);
+
+ /* typecast is a workaround for GCC 4.3 bug */
+ rte_eal_remote_launch((int (*)(void *))pipeline_stage,
+ NULL, lcore_id);
+ }
+ }
+
+ /* Start send_stage() on the last slave core */
+ /* typecast is a workaround for GCC 4.3 bug */
+ rte_eal_remote_launch((int (*)(void *))send_stage, NULL, last_lcore_id);
+
+ /* Start receive_stage() on the master core */
+ receive_stage(NULL);
+
+ return 0;