void app_lcore_io(struct app_lcore_params_io *lp, uint32_t n_workers) { uint32_t bsz_rx_rd = app.burst_size_io_rx_read; uint32_t bsz_rx_wr = app.burst_size_io_rx_write; uint32_t bsz_tx_rd = app.burst_size_io_tx_read; uint32_t bsz_tx_wr = app.burst_size_io_tx_write; app_lcore_io_rx(lp, n_workers, bsz_rx_rd, bsz_rx_wr); app_lcore_io_tx(lp, n_workers, bsz_tx_rd, bsz_tx_wr); #ifdef __linux__ app_lcore_io_tx_kni(lp, bsz_tx_wr); #endif /* __linux__ */ }
void app_lcore_main_loop_io(void *arg) { uint32_t lcore = rte_lcore_id(); struct app_lcore_params_io *lp = &app.lcore_params[lcore].io; uint32_t n_workers = app_get_lcores_worker(); uint64_t i = 0; uint32_t bsz_rx_rd = app.burst_size_io_rx_read; uint32_t bsz_rx_wr = app.burst_size_io_rx_write; uint32_t bsz_tx_rd = app.burst_size_io_tx_read; uint32_t bsz_tx_wr = app.burst_size_io_tx_write; if (lp->rx.n_nic_queues > 0 && lp->tx.n_nic_ports == 0) { /* receive loop */ for (;;) { if (APP_LCORE_IO_FLUSH && (unlikely(i == APP_LCORE_IO_FLUSH))) { if (rte_atomic32_read(&dpdk_stop) != 0) { break; } app_lcore_io_rx_flush(lp, n_workers); i = 0; } app_lcore_io_rx(lp, n_workers, bsz_rx_rd, bsz_rx_wr); i++; } } else if (lp->rx.n_nic_queues == 0 && lp->tx.n_nic_ports > 0) { /* transimit loop */ for (;;) { if (APP_LCORE_IO_FLUSH && (unlikely(i == APP_LCORE_IO_FLUSH))) { if (rte_atomic32_read(&dpdk_stop) != 0) { break; } app_lcore_io_tx_flush(lp, arg); i = 0; } app_lcore_io_tx(lp, n_workers, bsz_tx_rd, bsz_tx_wr); #ifdef __linux__ app_lcore_io_tx_kni(lp, bsz_tx_wr); #endif /* __linux__ */ i++; } } else { for (;;) { if (APP_LCORE_IO_FLUSH && (unlikely(i == APP_LCORE_IO_FLUSH))) { if (rte_atomic32_read(&dpdk_stop) != 0) { break; } app_lcore_io_rx_flush(lp, n_workers); app_lcore_io_tx_flush(lp, arg); i = 0; } app_lcore_io_rx(lp, n_workers, bsz_rx_rd, bsz_rx_wr); app_lcore_io_tx(lp, n_workers, bsz_tx_rd, bsz_tx_wr); #ifdef __linux__ app_lcore_io_tx_kni(lp, bsz_tx_wr); #endif /* __linux__ */ i++; } } /* cleanup */ if (likely(lp->tx.n_nic_ports > 0)) { app_lcore_io_tx_cleanup(lp); } }
static void app_lcore_main_loop_io (void) { uint32_t lcore = rte_lcore_id (); struct app_lcore_params_io *lp = &app.lcore_params[lcore].io; // uint32_t n_workers = app_get_lcores_worker(); uint64_t i = 0; uint32_t bsz_rx_rd = app.burst_size_io_rx_read; // uint32_t bsz_rx_wr = app.burst_size_io_rx_write; // uint8_t pos_lb = app.pos_lb; app_lcore_arp_tx_gratuitous (lp); gettimeofday (&lp->tx.start_ewr, NULL); if (bandWidthMeasureActive) { // only measure bw while (likely (doloop)) { if (likely (lp->rx.n_nic_queues > 0)) { app_lcore_io_rx_bw (lp, bsz_rx_rd); } if (likely (lp->tx.n_nic_queues > 0)) { app_lcore_io_tx_bw (lp, app.burst_size_io_tx_write); } i++; } } else if (bandWidthMeasure) { // only measure bw while (likely (doloop)) { if (likely (lp->rx.n_nic_queues > 0)) { app_lcore_io_rx_bw (lp, bsz_rx_rd); } i++; } } else if (selectiveTS) { // measure bw & latency, performing a selective Timestamping // Send a pkt-burst to fill output queues app_lcore_io_tx_bw (lp, app.nic_tx_ring_size - 1); while (likely (doloop)) { if (likely (lp->rx.n_nic_queues > 0)) { app_lcore_io_rx_sts (lp, bsz_rx_rd, app.burst_size_io_tx_write); } if (likely (lp->tx.n_nic_queues > 0)) { app_lcore_io_tx_sts (lp, app.burst_size_io_tx_write); } i++; } } else if (trainFriends) { while (likely (doloop)) { if (likely (lp->rx.n_nic_queues > 0)) { app_lcore_io_rx_sts (lp, bsz_rx_rd, trainFriends); } if (likely (lp->tx.n_nic_queues > 0)) { app_lcore_io_tx_sts (lp, trainFriends); if (trainSleep) { hptl_waitns (trainSleep); } } i++; } } else { // measure bw & latency, priorizing latency *((uint16_t *)(icmppkt + idoffset)) = (TSIDTYPE)tspacketId; while (likely (doloop)) { if (likely (lp->rx.n_nic_queues > 0)) { app_lcore_io_rx (lp, bsz_rx_rd); } if (likely (lp->tx.n_nic_queues > 0)) { app_lcore_io_tx (lp); } i++; } } }