| 72 | } |
| 73 | |
| 74 | int |
| 75 | main(int argc, char **argv) |
| 76 | { |
| 77 | const unsigned flags = 0; |
| 78 | const unsigned ring_size = 64; |
| 79 | const unsigned pool_size = 1024; |
| 80 | const unsigned pool_cache = 32; |
| 81 | const unsigned priv_data_sz = 0; |
| 82 | |
| 83 | int ret; |
| 84 | unsigned lcore_id; |
| 85 | |
| 86 | ret = rte_eal_init(argc, argv); |
| 87 | if (ret < 0) |
| 88 | rte_exit(EXIT_FAILURE, "Cannot init EAL\n"); |
| 89 | |
| 90 | /* Start of ring structure. 8< */ |
| 91 | if (rte_eal_process_type() == RTE_PROC_PRIMARY){ |
| 92 | send_ring = rte_ring_create(_PRI_2_SEC, ring_size, rte_socket_id(), flags); |
| 93 | recv_ring = rte_ring_create(_SEC_2_PRI, ring_size, rte_socket_id(), flags); |
| 94 | message_pool = rte_mempool_create(_MSG_POOL, pool_size, |
| 95 | STR_TOKEN_SIZE, pool_cache, priv_data_sz, |
| 96 | NULL, NULL, NULL, NULL, |
| 97 | rte_socket_id(), flags); |
| 98 | } else { |
| 99 | recv_ring = rte_ring_lookup(_PRI_2_SEC); |
| 100 | send_ring = rte_ring_lookup(_SEC_2_PRI); |
| 101 | message_pool = rte_mempool_lookup(_MSG_POOL); |
| 102 | } |
| 103 | /* >8 End of ring structure. */ |
| 104 | if (send_ring == NULL) |
| 105 | rte_exit(EXIT_FAILURE, "Problem getting sending ring\n"); |
| 106 | if (recv_ring == NULL) |
| 107 | rte_exit(EXIT_FAILURE, "Problem getting receiving ring\n"); |
| 108 | if (message_pool == NULL) |
| 109 | rte_exit(EXIT_FAILURE, "Problem getting message pool\n"); |
| 110 | |
| 111 | RTE_LOG(INFO, APP, "Finished Process Init.\n"); |
| 112 | |
| 113 | /* call lcore_recv() on every worker lcore */ |
| 114 | RTE_LCORE_FOREACH_WORKER(lcore_id) { |
| 115 | rte_eal_remote_launch(lcore_recv, NULL, lcore_id); |
| 116 | } |
| 117 | |
| 118 | /* call cmd prompt on main lcore */ |
| 119 | struct cmdline *cl = cmdline_stdin_new(simple_mp_ctx, "\nsimple_mp > "); |
| 120 | if (cl == NULL) |
| 121 | rte_exit(EXIT_FAILURE, "Cannot create cmdline instance\n"); |
| 122 | cmdline_interact(cl); |
| 123 | cmdline_stdin_exit(cl); |
| 124 | |
| 125 | rte_eal_mp_wait_lcore(); |
| 126 | |
| 127 | /* clean up the EAL */ |
| 128 | rte_eal_cleanup(); |
| 129 | |
| 130 | return 0; |
| 131 | } |
nothing calls this directly
no test coverage detected