diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/test-pmd/cmdline.c | 2 | ||||
-rw-r--r-- | app/test-pmd/config.c | 10 | ||||
-rw-r--r-- | app/test-pmd/parameters.c | 18 | ||||
-rw-r--r-- | app/test-pmd/testpmd.c | 4 | ||||
-rw-r--r-- | app/test/test_link_bonding_mode4.c | 2 | ||||
-rw-r--r-- | app/test/test_memzone.c | 135 | ||||
-rw-r--r-- | app/test/test_pmd_perf.c | 15 |
7 files changed, 164 insertions, 22 deletions
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 315a252e..f4ff318d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -1568,7 +1568,7 @@ cmd_config_rss_parsed(void *parsed_result, __attribute__((unused)) void *data) { struct cmd_config_rss *res = parsed_result; - struct rte_eth_rss_conf rss_conf; + struct rte_eth_rss_conf rss_conf = { .rss_key_len = 0, }; int diag; uint8_t i; diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 36c47ab5..c50b62ef 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -224,8 +224,10 @@ nic_stats_display(portid_t port_id) if (diff_cycles > 0) diff_cycles = prev_cycles[port_id] - diff_cycles; - diff_pkts_rx = stats.ipackets - prev_pkts_rx[port_id]; - diff_pkts_tx = stats.opackets - prev_pkts_tx[port_id]; + diff_pkts_rx = (stats.ipackets > prev_pkts_rx[port_id]) ? + (stats.ipackets - prev_pkts_rx[port_id]) : 0; + diff_pkts_tx = (stats.opackets > prev_pkts_tx[port_id]) ? + (stats.opackets - prev_pkts_tx[port_id]) : 0; prev_pkts_rx[port_id] = stats.ipackets; prev_pkts_tx[port_id] = stats.opackets; mpps_rx = diff_cycles > 0 ? @@ -1197,7 +1199,7 @@ simple_fwd_config_setup(void) fwd_streams[i]->rx_queue = 0; fwd_streams[i]->tx_port = fwd_ports_ids[j]; fwd_streams[i]->tx_queue = 0; - fwd_streams[i]->peer_addr = j; + fwd_streams[i]->peer_addr = fwd_streams[i]->tx_port; fwd_streams[i]->retry_enabled = retry_enabled; if (port_topology == PORT_TOPOLOGY_PAIRED) { @@ -1205,7 +1207,7 @@ simple_fwd_config_setup(void) fwd_streams[j]->rx_queue = 0; fwd_streams[j]->tx_port = fwd_ports_ids[i]; fwd_streams[j]->tx_queue = 0; - fwd_streams[j]->peer_addr = i; + fwd_streams[j]->peer_addr = fwd_streams[j]->tx_port; fwd_streams[j]->retry_enabled = retry_enabled; } } diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 2f969539..09233917 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -360,7 +360,8 @@ parse_portnuma_config(const char *q_arg) char s[256]; const char *p, *p0 = q_arg; char *end; - uint8_t i,port_id,socket_id; + uint8_t i, socket_id; + portid_t port_id; unsigned size; enum fieldnames { FLD_PORT = 0, @@ -390,8 +391,9 @@ parse_portnuma_config(const char *q_arg) if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) return -1; } - port_id = (uint8_t)int_fld[FLD_PORT]; - if (port_id_is_invalid(port_id, ENABLED_WARN)) { + port_id = (portid_t)int_fld[FLD_PORT]; + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) { printf("Valid port range is [0"); FOREACH_PORT(pid, ports) printf(", %d", pid); @@ -416,7 +418,8 @@ parse_ringnuma_config(const char *q_arg) char s[256]; const char *p, *p0 = q_arg; char *end; - uint8_t i,port_id,ring_flag,socket_id; + uint8_t i, ring_flag, socket_id; + portid_t port_id; unsigned size; enum fieldnames { FLD_PORT = 0, @@ -450,8 +453,9 @@ parse_ringnuma_config(const char *q_arg) if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) return -1; } - port_id = (uint8_t)int_fld[FLD_PORT]; - if (port_id_is_invalid(port_id, ENABLED_WARN)) { + port_id = (portid_t)int_fld[FLD_PORT]; + if (port_id_is_invalid(port_id, ENABLED_WARN) || + port_id == (portid_t)RTE_PORT_ALL) { printf("Valid port range is [0"); FOREACH_PORT(pid, ports) printf(", %d", pid); @@ -806,7 +810,7 @@ launch_args_parse(int argc, char** argv) port_topology = PORT_TOPOLOGY_LOOP; else rte_exit(EXIT_FAILURE, "port-topology %s invalid -" - " must be: paired or chained \n", + " must be: paired, chained or loop\n", optarg); } if (!strcmp(lgopts[opt_idx].name, "forward-mode")) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index ce48ca03..9de01fed 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -1900,8 +1900,8 @@ get_eth_dcb_conf(struct rte_eth_conf *eth_conf, 1 << (i % vmdq_rx_conf->nb_queue_pools); } for (i = 0; i < ETH_DCB_NUM_USER_PRIORITIES; i++) { - vmdq_rx_conf->dcb_tc[i] = i; - vmdq_tx_conf->dcb_tc[i] = i; + vmdq_rx_conf->dcb_tc[i] = i % num_tcs; + vmdq_tx_conf->dcb_tc[i] = i % num_tcs; } /* set DCB mode of RX and TX of multiple queues */ diff --git a/app/test/test_link_bonding_mode4.c b/app/test/test_link_bonding_mode4.c index 292ea3d0..33967112 100644 --- a/app/test/test_link_bonding_mode4.c +++ b/app/test/test_link_bonding_mode4.c @@ -659,7 +659,7 @@ bond_handshake(void) TEST_ASSERT_EQUAL(all_slaves_done, 1, "Bond handshake failed\n"); /* If flags doesn't match - report failure */ - return all_slaves_done = 1 ? TEST_SUCCESS : TEST_FAILED; + return all_slaves_done == 1 ? TEST_SUCCESS : TEST_FAILED; } #define TEST_LACP_SLAVE_COUT RTE_DIM(test_params.slave_ports) diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c index 7ae31cf7..72cda007 100644 --- a/app/test/test_memzone.c +++ b/app/test/test_memzone.c @@ -176,6 +176,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 2M\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_2M_HINT", size, SOCKET_ID_ANY, RTE_MEMZONE_2MB|RTE_MEMZONE_SIZE_HINT_ONLY); @@ -187,6 +191,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 2M\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } /* Check if 1GB huge pages are unavailable, that function fails unless * HINT flag is indicated @@ -202,6 +210,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 2M\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_1G", size, SOCKET_ID_ANY, RTE_MEMZONE_1GB); @@ -224,6 +236,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 1G\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_1G_HINT", size, SOCKET_ID_ANY, RTE_MEMZONE_1GB|RTE_MEMZONE_SIZE_HINT_ONLY); @@ -235,6 +251,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 1G\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } /* Check if 1GB huge pages are unavailable, that function fails unless * HINT flag is indicated @@ -250,12 +270,20 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 1G\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_2M", size, SOCKET_ID_ANY, RTE_MEMZONE_2MB); if (mz != NULL) { printf("MEMZONE FLAG 2MB\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } } if (hugepage_2MB_avail && hugepage_1GB_avail) { @@ -285,6 +313,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 16M\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_16M_HINT", size, SOCKET_ID_ANY, RTE_MEMZONE_16MB|RTE_MEMZONE_SIZE_HINT_ONLY); @@ -296,6 +328,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 16M\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } /* Check if 1GB huge pages are unavailable, that function fails * unless HINT flag is indicated @@ -312,6 +348,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 16M\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_16G", size, SOCKET_ID_ANY, RTE_MEMZONE_16GB); @@ -333,6 +373,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 16G\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_16G_HINT", size, SOCKET_ID_ANY, RTE_MEMZONE_16GB|RTE_MEMZONE_SIZE_HINT_ONLY); @@ -344,6 +388,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 16G\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } /* Check if 1GB huge pages are unavailable, that function fails * unless HINT flag is indicated @@ -360,6 +408,10 @@ test_memzone_reserve_flags(void) printf("hugepage_sz not equal 16G\n"); return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } mz = rte_memzone_reserve("flag_zone_16M", size, SOCKET_ID_ANY, RTE_MEMZONE_16MB); if (mz != NULL) { @@ -434,6 +486,12 @@ test_memzone_reserve_max(void) rte_memzone_dump(stdout); return -1; } + + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } + return 0; } @@ -473,6 +531,12 @@ test_memzone_reserve_max_aligned(void) rte_memzone_dump(stdout); return -1; } + + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } + return 0; } @@ -593,6 +657,28 @@ test_memzone_aligned(void) if (is_memory_overlap(memzone_aligned_512->phys_addr, memzone_aligned_512->len, memzone_aligned_1024->phys_addr, memzone_aligned_1024->len)) return -1; + + /* free all used zones */ + if (rte_memzone_free(memzone_aligned_32)) { + printf("Fail memzone free\n"); + return -1; + } + if (rte_memzone_free(memzone_aligned_128)) { + printf("Fail memzone free\n"); + return -1; + } + if (rte_memzone_free(memzone_aligned_256)) { + printf("Fail memzone free\n"); + return -1; + } + if (rte_memzone_free(memzone_aligned_512)) { + printf("Fail memzone free\n"); + return -1; + } + if (rte_memzone_free(memzone_aligned_1024)) { + printf("Fail memzone free\n"); + return -1; + } return 0; } @@ -638,6 +724,11 @@ check_memzone_bounded(const char *name, uint32_t len, uint32_t align, return -1; } + if (rte_memzone_free(mz)) { + printf("Fail memzone free\n"); + return -1; + } + return 0; } @@ -758,7 +849,7 @@ test_memzone_free(void) } static int -test_memzone(void) +test_memzone_basic(void) { const struct rte_memzone *memzone1; const struct rte_memzone *memzone2; @@ -837,6 +928,40 @@ test_memzone(void) if (mz != NULL) return -1; + if (rte_memzone_free(memzone1)) { + printf("Fail memzone free - memzone1\n"); + return -1; + } + if (rte_memzone_free(memzone2)) { + printf("Fail memzone free - memzone2\n"); + return -1; + } + if (memzone3 && rte_memzone_free(memzone3)) { + printf("Fail memzone free - memzone3\n"); + return -1; + } + if (rte_memzone_free(memzone4)) { + printf("Fail memzone free - memzone4\n"); + return -1; + } + + return 0; +} + +static int memzone_calk_called; +static void memzone_walk_clb(const struct rte_memzone *mz __rte_unused, + void *arg __rte_unused) +{ + memzone_calk_called = 1; +} + +static int +test_memzone(void) +{ + printf("test basic memzone API\n"); + if (test_memzone_basic() < 0) + return -1; + printf("test free memzone\n"); if (test_memzone_free() < 0) return -1; @@ -869,6 +994,14 @@ test_memzone(void) if (test_memzone_reserve_max_aligned() < 0) return -1; + printf("check memzone cleanup\n"); + rte_memzone_walk(memzone_walk_clb, NULL); + if (memzone_calk_called) { + printf("there are some memzones left after test\n"); + rte_memzone_dump(stdout); + return -1; + } + return 0; } diff --git a/app/test/test_pmd_perf.c b/app/test/test_pmd_perf.c index 1ffd65a5..afab180f 100644 --- a/app/test/test_pmd_perf.c +++ b/app/test/test_pmd_perf.c @@ -572,6 +572,7 @@ poll_burst(void *args) unsigned i, portid, nb_rx = 0; uint64_t total; uint64_t timeout = MAX_IDLE; + int num[RTE_MAX_ETHPORTS]; lcore_id = rte_lcore_id(); conf = &lcore_conf[lcore_id]; @@ -591,6 +592,7 @@ poll_burst(void *args) for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; next[portid] = i * pkt_per_port; + num[portid] = pkt_per_port; } while (!rte_atomic64_read(&start)) @@ -601,8 +603,8 @@ poll_burst(void *args) for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; nb_rx = rte_eth_rx_burst((uint8_t) portid, 0, - &pkts_burst[next[portid]], - MAX_PKT_BURST); + &pkts_burst[next[portid]], + RTE_MIN(MAX_PKT_BURST, num[portid])); if (unlikely(nb_rx == 0)) { timeout--; if (unlikely(timeout == 0)) @@ -610,6 +612,7 @@ poll_burst(void *args) continue; } next[portid] += nb_rx; + num[portid] -= nb_rx; total -= nb_rx; } } @@ -618,7 +621,6 @@ timeout: printf("%"PRIu64" packets lost, IDLE %"PRIu64" times\n", total, MAX_IDLE - timeout); - /* clean up */ total = pkt_per_port * conf->nb_ports - total; for (i = 0; i < total; i++) @@ -644,7 +646,7 @@ exec_burst(uint32_t flags, int lcore) conf = &lcore_conf[lcore]; pkt_per_port = MAX_TRAFFIC_BURST; - num = pkt_per_port; + num = pkt_per_port * conf->nb_ports; rte_atomic64_init(&start); @@ -661,11 +663,12 @@ exec_burst(uint32_t flags, int lcore) nb_tx = RTE_MIN(MAX_PKT_BURST, num); for (i = 0; i < conf->nb_ports; i++) { portid = conf->portlist[i]; - rte_eth_tx_burst(portid, 0, + nb_tx = rte_eth_tx_burst(portid, 0, &tx_burst[idx], nb_tx); idx += nb_tx; + num -= nb_tx; } - num -= nb_tx; + } sleep(5); |