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 05B53A04B5; Tue, 27 Oct 2020 16:14:29 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C120EBBB4; Tue, 27 Oct 2020 16:12:11 +0100 (CET) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 4ADE572DE for ; Tue, 27 Oct 2020 16:11:55 +0100 (CET) IronPort-SDR: 3uCNiN/WI03okNsxj8jgNZeiCrn/uG+MOlOavj+KpNrrkCC/HNC9KqzeVtOLxvjUpS8PCZsST8 jAjiLqt30DvA== X-IronPort-AV: E=McAfee;i="6000,8403,9786"; a="168197290" X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="168197290" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2020 08:11:53 -0700 IronPort-SDR: zzQaZmSHTf9wjNUxWplska7pw7TTswrm3jQuRMXrRL1oSSbBc4qJtm7Jx4x00OFLpZrTJjmHop 3O4ThokB5KnA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,424,1596524400"; d="scan'208";a="322963861" Received: from silpixa00400072.ir.intel.com ([10.237.222.213]) by orsmga006.jf.intel.com with ESMTP; 27 Oct 2020 08:11:51 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: david.marchand@redhat.com, jerinj@marvell.com, mdr@ashroe.eu, thomas@monjalon.net, konstantin.ananyev@intel.com, bruce.richardson@intel.com, ciara.power@intel.com Date: Tue, 27 Oct 2020 15:11:30 +0000 Message-Id: <3f7ebc36e813627639b7353447d74d59c4d8aa0d.1603811281.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 v15 7/8] app/testfib: add support for different lookup functions 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" Added -v option to switch between different lookup implementations to measure their performance and correctness. Signed-off-by: Vladimir Medvedkin --- app/test-fib/main.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 62 insertions(+), 3 deletions(-) diff --git a/app/test-fib/main.c b/app/test-fib/main.c index 9cf01b1..9e6a4f2 100644 --- a/app/test-fib/main.c +++ b/app/test-fib/main.c @@ -99,6 +99,7 @@ static struct { uint8_t ent_sz; uint8_t rnd_lookup_ips_ratio; uint8_t print_fract; + uint8_t lookup_fn; } config = { .routes_file = NULL, .lookup_ips_file = NULL, @@ -110,7 +111,8 @@ static struct { .tbl8 = DEFAULT_LPM_TBL8, .ent_sz = 4, .rnd_lookup_ips_ratio = 0, - .print_fract = 10 + .print_fract = 10, + .lookup_fn = 0 }; struct rt_rule_4 { @@ -638,7 +640,11 @@ print_usage(void) "1/2/4/8 (default 4)>]\n" "[-g ]\n" "[-w ]\n" - "[-u ]\n", + "[-u ]\n" + "[-v ]\n", config.prgname); } @@ -681,7 +687,7 @@ parse_opts(int argc, char **argv) int opt; char *endptr; - while ((opt = getopt(argc, argv, "f:t:n:d:l:r:c6ab:e:g:w:u:s")) != + while ((opt = getopt(argc, argv, "f:t:n:d:l:r:c6ab:e:g:w:u:sv:")) != -1) { switch (opt) { case 'f': @@ -769,6 +775,23 @@ parse_opts(int argc, char **argv) rte_exit(-EINVAL, "Invalid option -g\n"); } break; + case 'v': + if ((strcmp(optarg, "s1") == 0) || + (strcmp(optarg, "s") == 0)) { + config.lookup_fn = 1; + break; + } else if (strcmp(optarg, "v") == 0) { + config.lookup_fn = 2; + break; + } else if (strcmp(optarg, "s2") == 0) { + config.lookup_fn = 3; + break; + } else if (strcmp(optarg, "s3") == 0) { + config.lookup_fn = 4; + break; + } + print_usage(); + rte_exit(-EINVAL, "Invalid option -v %s\n", optarg); default: print_usage(); rte_exit(-EINVAL, "Invalid options\n"); @@ -846,6 +869,27 @@ run_v4(void) return -rte_errno; } + if (config.lookup_fn != 0) { + if (config.lookup_fn == 1) + ret = rte_fib_select_lookup(fib, + RTE_FIB_LOOKUP_DIR24_8_SCALAR_MACRO); + else if (config.lookup_fn == 2) + ret = rte_fib_select_lookup(fib, + RTE_FIB_LOOKUP_DIR24_8_VECTOR_AVX512); + else if (config.lookup_fn == 3) + ret = rte_fib_select_lookup(fib, + RTE_FIB_LOOKUP_DIR24_8_SCALAR_INLINE); + else if (config.lookup_fn == 4) + ret = rte_fib_select_lookup(fib, + RTE_FIB_LOOKUP_DIR24_8_SCALAR_UNI); + else + ret = -EINVAL; + if (ret != 0) { + printf("Can not init lookup function\n"); + return ret; + } + } + for (k = config.print_fract, i = 0; k > 0; k--) { start = rte_rdtsc_precise(); for (j = 0; j < (config.nb_routes - i) / k; j++) { @@ -1025,6 +1069,21 @@ run_v6(void) return -rte_errno; } + if (config.lookup_fn != 0) { + if (config.lookup_fn == 1) + ret = rte_fib6_select_lookup(fib, + RTE_FIB6_LOOKUP_TRIE_SCALAR); + else if (config.lookup_fn == 2) + ret = rte_fib6_select_lookup(fib, + RTE_FIB6_LOOKUP_TRIE_VECTOR_AVX512); + else + ret = -EINVAL; + if (ret != 0) { + printf("Can not init lookup function\n"); + return ret; + } + } + for (k = config.print_fract, i = 0; k > 0; k--) { start = rte_rdtsc_precise(); for (j = 0; j < (config.nb_routes - i) / k; j++) { -- 2.7.4