idle = 0;
}
+#ifndef RTE_EXEC_ENV_WINDOWS
static void
stats_display(uint16_t port_id)
{
if (signum == SIGUSR2)
stats_display(0);
}
+#endif
struct rte_mbuf **tx_burst;
#define PACKET_SIZE 64
#define FRAME_GAP 12
#define MAC_PREAMBLE 8
+#define MAX_RETRY_COUNT 5
struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
unsigned lcore_id;
unsigned i, portid, nb_rx = 0, nb_tx = 0;
int pkt_per_port;
uint64_t diff_tsc;
uint64_t packets_per_second, total_packets;
+ int retry_cnt = 0;
+ int free_pkt = 0;
lcore_id = rte_lcore_id();
conf = &lcore_conf[lcore_id];
nb_tx = RTE_MIN(MAX_PKT_BURST, num);
nb_tx = rte_eth_tx_burst(portid, 0,
&tx_burst[idx], nb_tx);
+ if (nb_tx == 0)
+ retry_cnt++;
num -= nb_tx;
idx += nb_tx;
+ if (retry_cnt == MAX_RETRY_COUNT) {
+ retry_cnt = 0;
+ break;
+ }
}
}
+ for (free_pkt = idx; free_pkt < (MAX_TRAFFIC_BURST * conf->nb_ports);
+ free_pkt++)
+ rte_pktmbuf_free(tx_burst[free_pkt]);
printf("Total packets inject to prime ports = %u\n", idx);
packets_per_second = (link_mbps * 1000 * 1000) /
i = (i >= conf->nb_ports - 1) ? 0 : (i + 1);
}
- sleep(5);
+ rte_delay_us(5 * US_PER_S);
/* only when polling second */
if (flags == SC_BURST_XMIT_FIRST)
printf("Start PMD RXTX cycles cost test.\n");
+#ifndef RTE_EXEC_ENV_WINDOWS
signal(SIGUSR1, signal_handler);
signal(SIGUSR2, signal_handler);
+#endif
nb_ports = rte_eth_dev_count_avail();
if (nb_ports < NB_ETHPORTS_USED) {