}
/* Main processing loop */
-static __attribute__((noreturn)) int
+static int
main_loop(__attribute__((unused)) void *arg)
{
const unsigned lcore_id = rte_lcore_id();
char tap_name[IFNAMSIZ];
int tap_fd;
- /* Create new tap interface */
- rte_snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id);
- tap_fd = tap_create(tap_name);
- if (tap_fd < 0)
- FATAL_ERROR("Could not create tap interface \"%s\" (%d)",
- tap_name, tap_fd);
-
if ((1 << lcore_id) & input_cores_mask) {
+ /* Create new tap interface */
+ rte_snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id);
+ tap_fd = tap_create(tap_name);
+ if (tap_fd < 0)
+ FATAL_ERROR("Could not create tap interface \"%s\" (%d)",
+ tap_name, tap_fd);
+
PRINT_INFO("Lcore %u is reading from port %u and writing to %s",
lcore_id, (unsigned)port_ids[lcore_id], tap_name);
fflush(stdout);
}
}
else if ((1 << lcore_id) & output_cores_mask) {
+ /* Create new tap interface */
+ rte_snprintf(tap_name, IFNAMSIZ, "tap_dpdk_%.2u", lcore_id);
+ tap_fd = tap_create(tap_name);
+ if (tap_fd < 0)
+ FATAL_ERROR("Could not create tap interface \"%s\" (%d)",
+ tap_name, tap_fd);
+
PRINT_INFO("Lcore %u is reading from %s and writing to port %u",
lcore_id, tap_name, (unsigned)port_ids[lcore_id]);
fflush(stdout);
}
else {
PRINT_INFO("Lcore %u has nothing to do", lcore_id);
- for (;;)
- ; /* loop doing nothing */
+ return 0;
}
/*
* Tap file is closed automatically when program exits. Putting close()
}
/* main processing loop */
-static __attribute__((noreturn)) int
+static int
main_loop(__attribute__((unused)) void *dummy)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
if (qconf->n_rx_queue == 0) {
RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id);
- while(1);
+ return 0;
}
RTE_LOG(INFO, L3FWD, "entering main loop on lcore %u\n", lcore_id);
}
/* main processing loop */
-static __attribute__((noreturn)) int
+static int
main_loop(__rte_unused void *dummy)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
if (qconf->n_rx_queue == 0) {
RTE_LOG(INFO, IPv4_MULTICAST, "lcore %u has nothing to do\n",
lcore_id);
- while(1);
+ return 0;
}
RTE_LOG(INFO, IPv4_MULTICAST, "entering main loop on lcore %u\n",
if (qconf->n_rx_port == 0) {
RTE_LOG(INFO, L2FWD, "lcore %u has nothing to do\n", lcore_id);
- while(1);
+ return;
}
RTE_LOG(INFO, L2FWD, "entering main loop on lcore %u\n", lcore_id);
}
/* main processing loop */
-static __attribute__((noreturn)) int
+static int
main_loop(__attribute__((unused)) void *dummy)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
if (qconf->n_rx_queue == 0) {
RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id);
- while(1);
+ return 0;
}
RTE_LOG(INFO, L3FWD, "entering main loop on lcore %u\n", lcore_id);
}
/* main processing loop */
-static __attribute__((noreturn)) int
+static int
main_loop(__attribute__((unused)) void *dummy)
{
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
if (qconf->n_rx_queue == 0) {
RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", lcore_id);
- while(1);
+ return 0;
}
RTE_LOG(INFO, L3FWD, "entering main loop on lcore %u\n", lcore_id);
if (qconf->n_rx_port == 0) {
RTE_LOG(INFO, LSI, "lcore %u has nothing to do\n", lcore_id);
- while(1);
+ return;
}
RTE_LOG(INFO, LSI, "entering main loop on lcore %u\n", lcore_id);
for (count = 0; count <= MAX_CHECK_TIME; count++) {
all_ports_up = 1;
for (portid = 0; portid < port_num; portid++) {
- if ((port_mask & (1 << portid)) == 0)
+ if ((port_mask & (1 << ports->id[portid])) == 0)
continue;
memset(&link, 0, sizeof(link));
- rte_eth_link_get_nowait(portid, &link);
+ rte_eth_link_get_nowait(ports->id[portid], &link);
/* print link status if flag set */
if (print_flag == 1) {
if (link.link_status)
printf("Port %d Link Up - speed %u "
- "Mbps - %s\n", (uint8_t)portid,
+ "Mbps - %s\n", ports->id[portid],
(unsigned)link.link_speed,
(link.link_duplex == ETH_LINK_FULL_DUPLEX) ?
("full-duplex") : ("half-duplex\n"));
else
printf("Port %d Link Down\n",
- (uint8_t)portid);
+ (uint8_t)ports->id[portid]);
continue;
}
/* clear all_ports_up flag if any link down */
const volatile struct tx_stats *tx = &ports->tx_stats[i];
for (j = 0; j < ports->num_ports; j++){
/* assign to local variables here, save re-reading volatile vars */
- const uint64_t tx_val = tx->tx[j];
- const uint64_t drop_val = tx->tx_drop[j];
+ const uint64_t tx_val = tx->tx[ports->id[j]];
+ const uint64_t drop_val = tx->tx_drop[ports->id[j]];
port_tx[j] += tx_val;
port_tx_drop[j] += drop_val;
client_tx[i] += tx_val;
while (sleep(sleeptime) <= sleeptime)
do_stats_display();
}
- else {
- const unsigned sleeptime = 100;
- printf("Putting core %u to sleep\n", rte_lcore_id());
- while (sleep(sleeptime) <= sleeptime)
- ; /* loop doing nothing */
- }
return 0;
}