X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest%2Ftest_lpm_perf.c;h=489719c40b9ecf0ed60d477c3bca47605f7f9717;hb=d839b2f008b17027baabe98e129c114fe4de58e1;hp=608e17abcdb66efbcc437fdb679d4a359dc2b4c1;hpb=17d60f5b5eea64ed7402f12d0025d95260defa28;p=dpdk.git diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c index 608e17abcd..489719c40b 100644 --- a/app/test/test_lpm_perf.c +++ b/app/test/test_lpm_perf.c @@ -1,34 +1,5 @@ -/*- - * BSD LICENSE - * - * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Intel Corporation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation */ #include @@ -63,7 +34,7 @@ struct route_rule { uint8_t depth; }; -struct route_rule large_route_table[MAX_RULE_NUM]; +static struct route_rule large_route_table[MAX_RULE_NUM]; static uint32_t num_route_entries; #define NUM_ROUTE_ENTRIES num_route_entries @@ -301,6 +272,7 @@ static void generate_large_route_rule_table(void) uint32_t ip_class; uint8_t depth; + num_route_entries = 0; memset(large_route_table, 0, sizeof(large_route_table)); for (ip_class = IP_CLASS_A; ip_class <= IP_CLASS_C; ip_class++) { @@ -313,11 +285,11 @@ static void generate_large_route_rule_table(void) * they are 4 rules with private local IP address and 1 all-zeros prefix * with depth = 8. */ - insert_rule_in_random_pos(IPv4(0, 0, 0, 0), 8); - insert_rule_in_random_pos(IPv4(10, 2, 23, 147), 32); - insert_rule_in_random_pos(IPv4(192, 168, 100, 10), 24); - insert_rule_in_random_pos(IPv4(192, 168, 25, 100), 24); - insert_rule_in_random_pos(IPv4(192, 168, 129, 124), 32); + insert_rule_in_random_pos(RTE_IPV4(0, 0, 0, 0), 8); + insert_rule_in_random_pos(RTE_IPV4(10, 2, 23, 147), 32); + insert_rule_in_random_pos(RTE_IPV4(192, 168, 100, 10), 24); + insert_rule_in_random_pos(RTE_IPV4(192, 168, 25, 100), 24); + insert_rule_in_random_pos(RTE_IPV4(192, 168, 129, 124), 32); } static void @@ -488,7 +460,7 @@ test_lpm_perf(void) (double)total_time / ((double)ITERATIONS * BATCH_SIZE), (count * 100.0) / (double)(ITERATIONS * BATCH_SIZE)); - /* Delete */ + /* Measure Delete */ status = 0; begin = rte_rdtsc(); @@ -498,7 +470,7 @@ test_lpm_perf(void) large_route_table[i].depth); } - total_time += rte_rdtsc() - begin; + total_time = rte_rdtsc() - begin; printf("Average LPM Delete: %g cycles\n", (double)total_time / NUM_ROUTE_ENTRIES);