X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_pmd_perf.c;h=3a248d512c4a33c11c16b49f553c5b5eb1330c1c;hb=f0243339496d48e6f5d76e6ef6741d6986b965d0;hp=49a805c1e0b5609bdb104cbed10b2938d1fd9aa7;hpb=0ead65af87734e3133f65277cd82d389b696ddfb;p=dpdk.git diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 49a805c1e0..3a248d512c 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -275,7 +275,7 @@ alloc_lcore(uint16_t socketid) for (lcore_id = 0; lcore_id < RTE_MAX_LCORE; lcore_id++) { if (LCORE_AVAIL != lcore_conf[lcore_id].status || lcore_conf[lcore_id].socketid != socketid || - lcore_id == rte_get_master_lcore()) + lcore_id == rte_get_main_lcore()) continue; lcore_conf[lcore_id].status = LCORE_USED; lcore_conf[lcore_id].nb_ports = 0; @@ -606,10 +606,10 @@ timeout: static int exec_burst(uint32_t flags, int lcore) { - unsigned i, portid, nb_tx = 0; + unsigned int portid, nb_tx = 0; struct lcore_conf *conf; uint32_t pkt_per_port; - int num, idx = 0; + int num, i, idx = 0; int diff_tsc; conf = &lcore_conf[lcore]; @@ -628,16 +628,14 @@ exec_burst(uint32_t flags, int lcore) rte_atomic64_set(&start, 1); /* start xmit */ + i = 0; while (num) { nb_tx = RTE_MIN(MAX_PKT_BURST, num); - for (i = 0; i < conf->nb_ports; i++) { - portid = conf->portlist[i]; - nb_tx = rte_eth_tx_burst(portid, 0, - &tx_burst[idx], nb_tx); - idx += nb_tx; - num -= nb_tx; - } - + portid = conf->portlist[i]; + nb_tx = rte_eth_tx_burst(portid, 0, &tx_burst[idx], nb_tx); + idx += nb_tx; + num -= nb_tx; + i = (i >= conf->nb_ports - 1) ? 0 : (i + 1); } sleep(5); @@ -661,7 +659,7 @@ exec_burst(uint32_t flags, int lcore) static int test_pmd_perf(void) { - uint16_t nb_ports, num, nb_lcores, slave_id = (uint16_t)-1; + uint16_t nb_ports, num, nb_lcores, worker_id = (uint16_t)-1; uint16_t nb_rxd = MAX_TRAFFIC_BURST; uint16_t nb_txd = MAX_TRAFFIC_BURST; uint16_t portid; @@ -699,13 +697,13 @@ test_pmd_perf(void) RTE_ETH_FOREACH_DEV(portid) { if (socketid == -1) { socketid = rte_eth_dev_socket_id(portid); - slave_id = alloc_lcore(socketid); - if (slave_id == (uint16_t)-1) { + worker_id = alloc_lcore(socketid); + if (worker_id == (uint16_t)-1) { printf("No avail lcore to run test\n"); return -1; } printf("Performance test runs on lcore %u socket %u\n", - slave_id, socketid); + worker_id, socketid); } if (socketid != rte_eth_dev_socket_id(portid)) { @@ -762,8 +760,8 @@ test_pmd_perf(void) "rte_eth_promiscuous_enable: err=%s, port=%d\n", rte_strerror(-ret), portid); - lcore_conf[slave_id].portlist[num++] = portid; - lcore_conf[slave_id].nb_ports++; + lcore_conf[worker_id].portlist[num++] = portid; + lcore_conf[worker_id].nb_ports++; } check_all_ports_link_status(nb_ports, RTE_PORT_ALL); @@ -788,13 +786,13 @@ test_pmd_perf(void) if (NULL == do_measure) do_measure = measure_rxtx; - rte_eal_remote_launch(main_loop, NULL, slave_id); + rte_eal_remote_launch(main_loop, NULL, worker_id); - if (rte_eal_wait_lcore(slave_id) < 0) + if (rte_eal_wait_lcore(worker_id) < 0) return -1; } else if (sc_flag == SC_BURST_POLL_FIRST || sc_flag == SC_BURST_XMIT_FIRST) - if (exec_burst(sc_flag, slave_id) < 0) + if (exec_burst(sc_flag, worker_id) < 0) return -1; /* port tear down */