void
app_print_params(void)
{
- uint32_t port, queue, lcore, rule, i, j;
+ unsigned port, queue, lcore, rule, i, j;
/* Print NIC RX configuration */
printf("NIC RX ports: ");
printf("RX ports ");
for (i = 0; i < lp->rx.n_nic_queues; i ++) {
printf("(%u, %u) ",
- (uint32_t) lp->rx.nic_queues[i].port,
- (uint32_t) lp->rx.nic_queues[i].queue);
+ (unsigned) lp->rx.nic_queues[i].port,
+ (unsigned) lp->rx.nic_queues[i].queue);
}
printf("; ");
printf("Worker lcore %u (socket %u) ID %u: ",
lcore,
rte_lcore_to_socket_id(lcore),
- lp->worker_id);
+ (unsigned)lp->worker_id);
printf("Input rings ");
for (i = 0; i < lp->n_rings_in; i ++) {
printf("Worker lcore %u (socket %u) ID %u: \n",
lcore,
rte_lcore_to_socket_id(lcore),
- lp->worker_id);
+ (unsigned)lp->worker_id);
printf("Output rings per TX port ");
for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
printf("\t%u: %u.%u.%u.%u/%u => %u;\n",
rule,
- (ip & 0xFF000000) >> 24,
- (ip & 0x00FF0000) >> 16,
- (ip & 0x0000FF00) >> 8,
- ip & 0x000000FF,
- (uint32_t) depth,
- (uint32_t) if_out
+ (unsigned) (ip & 0xFF000000) >> 24,
+ (unsigned) (ip & 0x00FF0000) >> 16,
+ (unsigned) (ip & 0x0000FF00) >> 8,
+ (unsigned) ip & 0x000000FF,
+ (unsigned) depth,
+ (unsigned) if_out
);
}
/* Rings */
printf("Ring sizes: NIC RX = %u; Worker in = %u; Worker out = %u; NIC TX = %u;\n",
- app.nic_rx_ring_size,
- app.ring_rx_size,
- app.ring_tx_size,
- app.nic_tx_ring_size);
+ (unsigned) app.nic_rx_ring_size,
+ (unsigned) app.ring_rx_size,
+ (unsigned) app.ring_tx_size,
+ (unsigned) app.nic_tx_ring_size);
/* Bursts */
printf("Burst sizes: I/O RX (rd = %u, wr = %u); Worker (rd = %u, wr = %u); I/O TX (rd = %u, wr = %u)\n",
- app.burst_size_io_rx_read,
- app.burst_size_io_rx_write,
- app.burst_size_worker_read,
- app.burst_size_worker_write,
- app.burst_size_io_tx_read,
- app.burst_size_io_tx_write);
+ (unsigned) app.burst_size_io_rx_read,
+ (unsigned) app.burst_size_io_rx_write,
+ (unsigned) app.burst_size_worker_read,
+ (unsigned) app.burst_size_worker_write,
+ (unsigned) app.burst_size_io_tx_read,
+ (unsigned) app.burst_size_io_tx_write);
}
.rx_adv_conf = {
.rss_conf = {
.rss_key = NULL,
- .rss_hf = ETH_RSS_IPV4,
+ .rss_hf = ETH_RSS_IPV4 | ETH_RSS_IPV6,
},
},
.txmode = {
.wthresh = APP_DEFAULT_NIC_RX_WTHRESH,
},
.rx_free_thresh = APP_DEFAULT_NIC_RX_FREE_THRESH,
+ .rx_drop_en = APP_DEFAULT_NIC_RX_DROP_EN,
};
static struct rte_eth_txconf tx_conf = {
static void
app_init_mbuf_pools(void)
{
- uint32_t socket, lcore;
+ unsigned socket, lcore;
/* Init the buffer pools */
for (socket = 0; socket < APP_MAX_SOCKETS; socket ++) {
static void
app_init_lpm_tables(void)
{
- uint32_t socket, lcore;
+ unsigned socket, lcore;
/* Init the LPM tables */
for (socket = 0; socket < APP_MAX_SOCKETS; socket ++) {
if (ret < 0) {
rte_panic("Unable to add entry %u (%x/%u => %u) to the LPM table on socket %u (%d)\n",
- rule, app.lpm_rules[rule].ip,
- (uint32_t) app.lpm_rules[rule].depth,
- (uint32_t) app.lpm_rules[rule].if_out,
+ (unsigned) rule,
+ (unsigned) app.lpm_rules[rule].ip,
+ (unsigned) app.lpm_rules[rule].depth,
+ (unsigned) app.lpm_rules[rule].if_out,
socket,
ret);
}
static void
app_init_rings_rx(void)
{
- uint32_t lcore;
+ unsigned lcore;
/* Initialize the rings for the RX side */
for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
struct app_lcore_params_io *lp_io = &app.lcore_params[lcore].io;
- uint32_t socket_io, lcore_worker;
+ unsigned socket_io, lcore_worker;
if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
(lp_io->rx.n_nic_queues == 0)) {
static void
app_init_rings_tx(void)
{
- uint32_t lcore;
+ unsigned lcore;
/* Initialize the rings for the TX side */
for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
struct app_lcore_params_worker *lp_worker = &app.lcore_params[lcore].worker;
- uint32_t port;
+ unsigned port;
if (app.lcore_params[lcore].type != e_APP_LCORE_WORKER) {
continue;
socket_io = rte_lcore_to_socket_id(lcore_io);
printf("Creating ring to connect worker lcore %u with TX port %u (through I/O lcore %u) (socket %u) ...\n",
- lcore, port, lcore_io, socket_io);
+ lcore, port, (unsigned)lcore_io, (unsigned)socket_io);
rte_snprintf(name, sizeof(name), "app_ring_tx_s%u_w%u_p%u", socket_io, lcore, port);
ring = rte_ring_create(
name,
for (lcore = 0; lcore < APP_MAX_LCORES; lcore ++) {
struct app_lcore_params_io *lp_io = &app.lcore_params[lcore].io;
- uint32_t i;
+ unsigned i;
if ((app.lcore_params[lcore].type != e_APP_LCORE_IO) ||
(lp_io->tx.n_nic_ports == 0)) {
}
for (i = 0; i < lp_io->tx.n_nic_ports; i ++){
- uint32_t port, j;
+ unsigned port, j;
port = lp_io->tx.nic_ports[i];
for (j = 0; j < app_get_lcores_worker(); j ++) {
static void
app_init_nics(void)
{
- uint32_t socket, lcore;
- uint8_t port, queue;
+ unsigned socket;
+ uint32_t lcore;
+ uint8_t port, queue;
int ret;
+ uint32_t n_rx_queues, n_tx_queues;
/* Init driver */
printf("Initializing the PMD driver ...\n");
/* Init NIC ports and queues, then start the ports */
for (port = 0; port < APP_MAX_NIC_PORTS; port ++) {
struct rte_mempool *pool;
- uint32_t n_rx_queues, n_tx_queues;
n_rx_queues = app_get_nic_rx_queues_per_port(port);
n_tx_queues = app.nic_tx_port_mask[port];
}
/* Init port */
- printf("Initializing NIC port %u ...\n", (uint32_t) port);
+ printf("Initializing NIC port %u ...\n", (unsigned) port);
ret = rte_eth_dev_configure(
port,
(uint8_t) n_rx_queues,
(uint8_t) n_tx_queues,
&port_conf);
if (ret < 0) {
- rte_panic("Cannot init NIC port %u (%d)\n", (uint32_t) port, ret);
+ rte_panic("Cannot init NIC port %u (%d)\n", (unsigned) port, ret);
}
rte_eth_promiscuous_enable(port);
pool = app.lcore_params[lcore].pool;
printf("Initializing NIC port %u RX queue %u ...\n",
- (uint32_t) port,
- (uint32_t) queue);
+ (unsigned) port,
+ (unsigned) queue);
ret = rte_eth_rx_queue_setup(
port,
queue,
pool);
if (ret < 0) {
rte_panic("Cannot init RX queue %u for port %u (%d)\n",
- (uint32_t) queue,
- (uint32_t) port,
+ (unsigned) queue,
+ (unsigned) port,
ret);
}
}
app_get_lcore_for_nic_tx(port, &lcore);
socket = rte_lcore_to_socket_id(lcore);
printf("Initializing NIC port %u TX queue 0 ...\n",
- (uint32_t) port);
+ (unsigned) port);
ret = rte_eth_tx_queue_setup(
port,
0,
#endif
#ifndef APP_DEFAULT_MEMPOOL_BUFFERS
-#define APP_DEFAULT_MEMPOOL_BUFFERS 8192
+#define APP_DEFAULT_MEMPOOL_BUFFERS 8192 * 4
#endif
#ifndef APP_DEFAULT_MEMPOOL_CACHE_SIZE
#define APP_DEFAULT_NIC_RX_FREE_THRESH 64
#endif
+#ifndef APP_DEFAULT_NIC_RX_DROP_EN
+#define APP_DEFAULT_NIC_RX_DROP_EN 0
+#endif
+
/* NIC TX */
#ifndef APP_DEFAULT_NIC_TX_RING_SIZE
#define APP_DEFAULT_NIC_TX_RING_SIZE 1024
lp->rx.rings_count[worker] ++;
}
if (unlikely(lp->rx.rings_iters[worker] == APP_STATS)) {
- uint32_t lcore = rte_lcore_id();
+ unsigned lcore = rte_lcore_id();
printf("\tI/O RX %u out (worker %u): enq success rate = %.2f\n",
lcore,
- worker,
+ (unsigned)worker,
((double) lp->rx.rings_count[worker]) / ((double) lp->rx.rings_iters[worker]));
lp->rx.rings_iters[worker] = 0;
lp->rx.rings_count[worker] = 0;
uint8_t pos_lb)
{
struct rte_mbuf *mbuf_1_0, *mbuf_1_1, *mbuf_2_0, *mbuf_2_1;
- uint8_t *data_1_0, *data_1_1;
+ uint8_t *data_1_0, *data_1_1 = NULL;
uint32_t i;
for (i = 0; i < lp->rx.n_nic_queues; i ++) {
lp->rx.nic_queues_count[i] += n_mbufs;
if (unlikely(lp->rx.nic_queues_iters[i] == APP_STATS)) {
struct rte_eth_stats stats;
- uint32_t lcore = rte_lcore_id();
+ unsigned lcore = rte_lcore_id();
rte_eth_stats_get(port, &stats);
printf("I/O RX %u in (NIC port %u): NIC drop ratio = %.2f avg burst size = %.2f\n",
lcore,
- (uint32_t) port,
+ (unsigned) port,
(double) stats.ierrors / (double) (stats.ierrors + stats.ipackets),
((double) lp->rx.nic_queues_count[i]) / ((double) lp->rx.nic_queues_iters[i]));
lp->rx.nic_queues_iters[i] = 0;
lp->tx.nic_ports_iters[port] ++;
lp->tx.nic_ports_count[port] += n_pkts;
if (unlikely(lp->tx.nic_ports_iters[port] == APP_STATS)) {
- uint32_t lcore = rte_lcore_id();
+ unsigned lcore = rte_lcore_id();
printf("\t\t\tI/O TX %u out (port %u): avg burst size = %.2f\n",
lcore,
- (uint32_t) port,
+ (unsigned) port,
((double) lp->tx.nic_ports_count[port]) / ((double) lp->tx.nic_ports_iters[port]));
lp->tx.nic_ports_iters[port] = 0;
lp->tx.nic_ports_count[port] = 0;
}
if (lp->rings_out_iters[port] == APP_STATS){
printf("\t\tWorker %u out (NIC port %u): enq success rate = %.2f\n",
- lp->worker_id,
- (uint32_t) port,
+ (unsigned) lp->worker_id,
+ (unsigned) port,
((double) lp->rings_out_count[port]) / ((double) lp->rings_out_iters[port]));
lp->rings_out_iters[port] = 0;
lp->rings_out_count[port] = 0;
app_lcore_main_loop(__attribute__((unused)) void *arg)
{
struct app_lcore_params *lp;
- uint32_t lcore;
+ unsigned lcore;
lcore = rte_lcore_id();
lp = &app.lcore_params[lcore];
if (lp->type == e_APP_LCORE_WORKER) {
printf("Logical core %u (worker %u) main loop.\n",
lcore,
- lp->worker.worker_id);
+ (unsigned) lp->worker.worker_id);
app_lcore_main_loop_worker();
}