+ /*
+ * If there's any of the key workloads left without an lcore_id
+ * after the high performing core assignment above, pre-assign
+ * them here.
+ */
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (lcore_id == (unsigned int)distr_core_id ||
+ lcore_id == (unsigned int)rx_core_id ||
+ lcore_id == (unsigned int)tx_core_id)
+ continue;
+ if (distr_core_id < 0) {
+ distr_core_id = lcore_id;
+ printf("Distributor on core %d\n", lcore_id);
+ continue;
+ }
+ if (rx_core_id < 0) {
+ rx_core_id = lcore_id;
+ printf("Rx on core %d\n", lcore_id);
+ continue;
+ }
+ if (tx_core_id < 0) {
+ tx_core_id = lcore_id;
+ printf("Tx on core %d\n", lcore_id);
+ continue;
+ }
+ }
+
+ printf(" tx id %d, dist id %d, rx id %d\n",
+ tx_core_id,
+ distr_core_id,
+ rx_core_id);
+
+ /*
+ * Kick off all the worker threads first, avoiding the pre-assigned
+ * lcore_ids for tx, rx and distributor workloads.
+ */
+ RTE_LCORE_FOREACH_SLAVE(lcore_id) {
+ if (lcore_id == (unsigned int)distr_core_id ||
+ lcore_id == (unsigned int)rx_core_id ||
+ lcore_id == (unsigned int)tx_core_id)
+ continue;
+ printf("Starting thread %d as worker, lcore_id %d\n",
+ worker_id, lcore_id);
+ struct lcore_params *p =
+ rte_malloc(NULL, sizeof(*p), 0);
+ if (!p)
+ rte_panic("malloc failure\n");
+ *p = (struct lcore_params){worker_id++, d, rx_dist_ring,
+ dist_tx_ring, mbuf_pool};
+
+ rte_eal_remote_launch((lcore_function_t *)lcore_worker,
+ p, lcore_id);
+ }
+
+ /* Start tx core */
+ rte_eal_remote_launch((lcore_function_t *)lcore_tx,
+ dist_tx_ring, tx_core_id);
+
+ /* Start distributor core */
+ struct lcore_params *pd =
+ rte_malloc(NULL, sizeof(*pd), 0);
+ if (!pd)
+ rte_panic("malloc failure\n");
+ *pd = (struct lcore_params){worker_id++, d,
+ rx_dist_ring, dist_tx_ring, mbuf_pool};
+ rte_eal_remote_launch(
+ (lcore_function_t *)lcore_distributor,
+ pd, distr_core_id);
+
+ /* Start rx core */
+ struct lcore_params *pr =
+ rte_malloc(NULL, sizeof(*pr), 0);
+ if (!pr)
+ rte_panic("malloc failure\n");
+ *pr = (struct lcore_params){worker_id++, d, rx_dist_ring,
+ dist_tx_ring, mbuf_pool};
+ rte_eal_remote_launch((lcore_function_t *)lcore_rx,
+ pr, rx_core_id);