X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=examples%2Fperformance-thread%2Fl3fwd-thread%2Fmain.c;h=4f8747bc3ec0dbe132256d2f8b0a6c7752ad98f5;hb=5d7b673d5fd6663b20c675dd382d9fb43b42af18;hp=4fafed16d94b12b53776e923bafe9ea3df708da9;hpb=8728ccf37615904cf23fb8763895b05c9a3c6b0c;p=dpdk.git diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c index 4fafed16d9..4f8747bc3e 100644 --- a/examples/performance-thread/l3fwd-thread/main.c +++ b/examples/performance-thread/l3fwd-thread/main.c @@ -2,8 +2,6 @@ * Copyright(c) 2010-2016 Intel Corporation */ -#define _GNU_SOURCE - #include #include #include @@ -306,9 +304,7 @@ static struct rte_eth_conf port_conf = { .mq_mode = ETH_MQ_RX_RSS, .max_rx_pkt_len = ETHER_MAX_LEN, .split_hdr_size = 0, - .ignore_offload_bitfield = 1, - .offloads = (DEV_RX_OFFLOAD_CHECKSUM | - DEV_RX_OFFLOAD_CRC_STRIP), + .offloads = DEV_RX_OFFLOAD_CHECKSUM, }, .rx_adv_conf = { .rss_conf = { @@ -1990,17 +1986,18 @@ cpu_load_collector(__rte_unused void *arg) { * * This loop is used to start empty scheduler on lcore. */ -static void +static void * lthread_null(__rte_unused void *args) { int lcore_id = rte_lcore_id(); RTE_LOG(INFO, L3FWD, "Starting scheduler on lcore %d.\n", lcore_id); lthread_exit(NULL); + return NULL; } /* main processing loop */ -static void +static void * lthread_tx_per_ring(void *dummy) { int nb_rx; @@ -2045,6 +2042,7 @@ lthread_tx_per_ring(void *dummy) lthread_cond_wait(ready, 0); } + return NULL; } /* @@ -2053,7 +2051,7 @@ lthread_tx_per_ring(void *dummy) * This lthread is used to spawn one new lthread per ring from producers. * */ -static void +static void * lthread_tx(void *args) { struct lthread *lt; @@ -2098,9 +2096,10 @@ lthread_tx(void *args) } } + return NULL; } -static void +static void * lthread_rx(void *dummy) { int ret; @@ -2124,7 +2123,7 @@ lthread_rx(void *dummy) if (rx_conf->n_rx_queue == 0) { RTE_LOG(INFO, L3FWD, "lcore %u has nothing to do\n", rte_lcore_id()); - return; + return NULL; } RTE_LOG(INFO, L3FWD, "Entering main Rx loop on lcore %u\n", rte_lcore_id()); @@ -2196,6 +2195,7 @@ lthread_rx(void *dummy) lthread_yield(); } } + return NULL; } /* @@ -2204,8 +2204,9 @@ lthread_rx(void *dummy) * This lthread loop spawns all rx and tx lthreads on master lcore */ -static void -lthread_spawner(__rte_unused void *arg) { +static void * +lthread_spawner(__rte_unused void *arg) +{ struct lthread *lt[MAX_THREAD]; int i; int n_thread = 0; @@ -2246,6 +2247,7 @@ lthread_spawner(__rte_unused void *arg) { for (i = 0; i < n_thread; i++) lthread_join(lt[i], NULL); + return NULL; } /* @@ -2491,7 +2493,7 @@ check_lcore_params(void) } static int -check_port_config(const unsigned nb_ports) +check_port_config(void) { unsigned portid; uint16_t i; @@ -2502,7 +2504,7 @@ check_port_config(const unsigned nb_ports) printf("port %u is not enabled in port mask\n", portid); return -1; } - if (portid >= nb_ports) { + if (!rte_eth_dev_is_valid_port(portid)) { printf("port %u is not present on the board\n", portid); return -1; } @@ -3514,9 +3516,9 @@ main(int argc, char **argv) if (ret < 0) rte_exit(EXIT_FAILURE, "init_rx_rings failed\n"); - nb_ports = rte_eth_dev_count(); + nb_ports = rte_eth_dev_count_avail(); - if (check_port_config(nb_ports) < 0) + if (check_port_config() < 0) rte_exit(EXIT_FAILURE, "check_port_config failed\n"); nb_lcores = rte_lcore_count(); @@ -3545,6 +3547,18 @@ main(int argc, char **argv) if (dev_info.tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE) local_port_conf.txmode.offloads |= DEV_TX_OFFLOAD_MBUF_FAST_FREE; + + local_port_conf.rx_adv_conf.rss_conf.rss_hf &= + dev_info.flow_type_rss_offloads; + if (local_port_conf.rx_adv_conf.rss_conf.rss_hf != + port_conf.rx_adv_conf.rss_conf.rss_hf) { + printf("Port %u modified RSS hash function based on hardware support," + "requested:%#"PRIx64" configured:%#"PRIx64"\n", + portid, + port_conf.rx_adv_conf.rss_conf.rss_hf, + local_port_conf.rx_adv_conf.rss_conf.rss_hf); + } + ret = rte_eth_dev_configure(portid, nb_rx_queue, (uint16_t)n_tx_queue, &local_port_conf); if (ret < 0) @@ -3591,7 +3605,6 @@ main(int argc, char **argv) fflush(stdout); txconf = &dev_info.default_txconf; - txconf->txq_flags = ETH_TXQ_FLAGS_IGNORE; txconf->offloads = local_port_conf.txmode.offloads; ret = rte_eth_tx_queue_setup(portid, queueid, nb_txd, socketid, txconf);