From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E669A00BE; Fri, 1 Nov 2019 16:24:31 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A2A071E8B9; Fri, 1 Nov 2019 16:22:17 +0100 (CET) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 2B6DC1E548 for ; Fri, 1 Nov 2019 16:22:14 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Nov 2019 08:22:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,256,1569308400"; d="scan'208";a="351979171" Received: from silpixa00400072.ir.intel.com ([10.237.222.213]) by orsmga004.jf.intel.com with ESMTP; 01 Nov 2019 08:22:12 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: bruce.richardson@intel.com, konstantin.ananyev@intel.com, thomas@monjalon.net, aconole@redhat.com Date: Fri, 1 Nov 2019 15:21:45 +0000 Message-Id: <4e1409ab8f7331472d9107b87cc2a455692d0e43.1572621163.git.vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: References: In-Reply-To: References: Subject: [dpdk-dev] [PATCH v6 12/12] test/fib: add FIB library ipv6 performance autotests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Performance ipv6 tests for the FIB library. Signed-off-by: Vladimir Medvedkin --- app/test/Makefile | 1 + app/test/autotest_data.py | 6 ++ app/test/meson.build | 2 + app/test/test_fib6_perf.c | 157 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 166 insertions(+) create mode 100644 app/test/test_fib6_perf.c diff --git a/app/test/Makefile b/app/test/Makefile index 3a3f920..f792858 100644 --- a/app/test/Makefile +++ b/app/test/Makefile @@ -129,6 +129,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_RIB) += test_rib6.c SRCS-$(CONFIG_RTE_LIBRTE_FIB) += test_fib.c SRCS-$(CONFIG_RTE_LIBRTE_FIB) += test_fib6.c SRCS-$(CONFIG_RTE_LIBRTE_FIB) += test_fib_perf.c +SRCS-$(CONFIG_RTE_LIBRTE_FIB) += test_fib6_perf.c SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm.c SRCS-$(CONFIG_RTE_LIBRTE_LPM) += test_lpm_perf.c diff --git a/app/test/autotest_data.py b/app/test/autotest_data.py index 0783979..97e4423 100644 --- a/app/test/autotest_data.py +++ b/app/test/autotest_data.py @@ -725,6 +725,12 @@ "Report": None, }, { + "Name": "FIB6 perf autotest", + "Command": "fib6_perf_autotest", + "Func": default_autotest, + "Report": None, + }, + { "Name": "Efd perf autotest", "Command": "efd_perf_autotest", "Func": default_autotest, diff --git a/app/test/meson.build b/app/test/meson.build index 929883a..42664d8 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -50,6 +50,7 @@ test_sources = files('commands.c', 'test_fib.c', 'test_fib_perf.c', 'test_fib6.c', + 'test_fib6_perf.c', 'test_func_reentrancy.c', 'test_flow_classify.c', 'test_hash.c', @@ -268,6 +269,7 @@ perf_test_names = [ 'efd_perf_autotest', 'lpm6_perf_autotest', 'fib6_slow_autotest', + 'fib6_perf_autotest', 'rcu_qsbr_perf_autotest', 'red_perf', 'distributor_perf_autotest', diff --git a/app/test/test_fib6_perf.c b/app/test/test_fib6_perf.c new file mode 100644 index 0000000..56c799b --- /dev/null +++ b/app/test/test_fib6_perf.c @@ -0,0 +1,157 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation + */ + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "test.h" +#include "test_lpm6_data.h" + +#define TEST_FIB_ASSERT(cond) do { \ + if (!(cond)) { \ + printf("Error at line %d:\n", __LINE__); \ + return -1; \ + } \ +} while (0) + +#define ITERATIONS (1 << 10) +#define BATCH_SIZE 100000 +#define NUMBER_TBL8S (1 << 16) + +static void +print_route_distribution(const struct rules_tbl_entry *table, uint32_t n) +{ + unsigned int i, j; + + printf("Route distribution per prefix width:\n"); + printf("DEPTH QUANTITY (PERCENT)\n"); + printf("---------------------------\n"); + + /* Count depths. */ + for (i = 1; i <= 128; i++) { + unsigned int depth_counter = 0; + double percent_hits; + + for (j = 0; j < n; j++) + if (table[j].depth == (uint8_t) i) + depth_counter++; + + percent_hits = ((double)depth_counter)/((double)n) * 100; + printf("%.2u%15u (%.2f)\n", i, depth_counter, percent_hits); + } + printf("\n"); +} + +static inline uint8_t +bits_in_nh(uint8_t nh_sz) +{ + return 8 * (1 << nh_sz); +} + +static inline uint64_t +get_max_nh(uint8_t nh_sz) +{ + return ((1ULL << (bits_in_nh(nh_sz) - 1)) - 1); +} + +static int +test_fib6_perf(void) +{ + struct rte_fib6 *fib = NULL; + struct rte_fib6_conf conf; + uint64_t begin, total_time; + unsigned int i, j; + uint64_t next_hop_add; + int status = 0; + int64_t count = 0; + uint8_t ip_batch[NUM_IPS_ENTRIES][16]; + uint64_t next_hops[NUM_IPS_ENTRIES]; + + conf.type = RTE_FIB6_TRIE; + conf.default_nh = 0; + conf.max_routes = 1000000; + conf.trie.nh_sz = RTE_FIB6_TRIE_4B; + conf.trie.num_tbl8 = RTE_MIN(get_max_nh(conf.trie.nh_sz), 1000000U); + + rte_srand(rte_rdtsc()); + + printf("No. routes = %u\n", (unsigned int) NUM_ROUTE_ENTRIES); + + print_route_distribution(large_route_table, + (uint32_t)NUM_ROUTE_ENTRIES); + + /* Only generate IPv6 address of each item in large IPS table, + * here next_hop is not needed. + */ + generate_large_ips_table(0); + + fib = rte_fib6_create(__func__, SOCKET_ID_ANY, &conf); + TEST_FIB_ASSERT(fib != NULL); + + /* Measure add. */ + begin = rte_rdtsc(); + + for (i = 0; i < NUM_ROUTE_ENTRIES; i++) { + next_hop_add = (i & ((1 << 14) - 1)) + 1; + if (rte_fib6_add(fib, large_route_table[i].ip, + large_route_table[i].depth, next_hop_add) == 0) + status++; + } + /* End Timer. */ + total_time = rte_rdtsc() - begin; + + printf("Unique added entries = %d\n", status); + printf("Average FIB Add: %g cycles\n", + (double)total_time / NUM_ROUTE_ENTRIES); + + /* Measure bulk Lookup */ + total_time = 0; + count = 0; + + for (i = 0; i < NUM_IPS_ENTRIES; i++) + memcpy(ip_batch[i], large_ips_table[i].ip, 16); + + for (i = 0; i < ITERATIONS; i++) { + + /* Lookup per batch */ + begin = rte_rdtsc(); + rte_fib6_lookup_bulk(fib, ip_batch, next_hops, NUM_IPS_ENTRIES); + total_time += rte_rdtsc() - begin; + + for (j = 0; j < NUM_IPS_ENTRIES; j++) + if (next_hops[j] == 0) + count++; + } + printf("BULK FIB Lookup: %.1f cycles (fails = %.1f%%)\n", + (double)total_time / ((double)ITERATIONS * BATCH_SIZE), + (count * 100.0) / (double)(ITERATIONS * BATCH_SIZE)); + + /* Delete */ + status = 0; + begin = rte_rdtsc(); + + for (i = 0; i < NUM_ROUTE_ENTRIES; i++) { + /* rte_fib_delete(fib, ip, depth) */ + status += rte_fib6_delete(fib, large_route_table[i].ip, + large_route_table[i].depth); + } + + total_time = rte_rdtsc() - begin; + + printf("Average FIB Delete: %g cycles\n", + (double)total_time / NUM_ROUTE_ENTRIES); + + rte_fib6_free(fib); + + return 0; +} + +REGISTER_TEST_COMMAND(fib6_perf_autotest, test_fib6_perf); -- 2.7.4