From: Bruce Richardson <bruce.richardson@intel.com>
To: Medvedkin Vladimir <medvedkinv@gmail.com>
Cc: dev@dpdk.org, thomas@monjalon.net, cristian.dumitrescu@intel.com
Subject: Re: [dpdk-dev] [PATCH v4 3/4] Add autotests for RIB library
Date: Fri, 29 Jun 2018 16:31:27 +0100 [thread overview]
Message-ID: <20180629153127.GA13896@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <1524780214-23196-4-git-send-email-medvedkinv@gmail.com>
On Fri, Apr 27, 2018 at 01:03:33AM +0300, Medvedkin Vladimir wrote:
> Signed-off-by: Medvedkin Vladimir <medvedkinv@gmail.com>
> ---
> test/test/Makefile | 5 +
> test/test/meson.build | 8 +
> test/test/test_rib.c | 308 +++++++++++++++++++++++++++++++++++++++
> test/test/test_rib_generate_rt.c | 297 +++++++++++++++++++++++++++++++++++++
> test/test/test_rib_generate_rt.h | 38 +++++
> test/test/test_rib_lpm_comp.c | 189 ++++++++++++++++++++++++
> test/test/test_rib_perf.c | 145 ++++++++++++++++++
> 7 files changed, 990 insertions(+)
> create mode 100644 test/test/test_rib.c
> create mode 100644 test/test/test_rib_generate_rt.c
> create mode 100644 test/test/test_rib_generate_rt.h
> create mode 100644 test/test/test_rib_lpm_comp.c
> create mode 100644 test/test/test_rib_perf.c
>
<snip>
> diff --git a/test/test/test_rib_perf.c b/test/test/test_rib_perf.c
> new file mode 100644
> index 0000000..42fbd1e
> --- /dev/null
> +++ b/test/test/test_rib_perf.c
> @@ -0,0 +1,145 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2018 Vladimir Medvedkin <medvedkinv@gmail.com>
> + */
> +
> +#include <stdio.h>
> +#include <stdint.h>
> +#include <stdlib.h>
> +
> +#include <rte_cycles.h>
> +#include <rte_random.h>
> +#include <rte_branch_prediction.h>
> +#include <rte_ip.h>
> +#include <rte_malloc.h>
> +#include <rte_rib.h>
> +#include <rte_dir24_8.h>
> +
> +#include "test.h"
> +#include "test_xmmt_ops.h"
> +#include "test_rib_generate_rt.h"
> +
> +#define TEST_RIB_ASSERT(cond) do { \
> + if (!(cond)) { \
> + printf("Error at line %d:\n", __LINE__); \
> + return -1; \
> + } \
> +} while (0)
> +
> +#define ITERATIONS (1 << 15)
> +#define BATCH_SIZE (1 << 12)
> +#define BULK_SIZE 32
> +
> +#define NH_MSK(nh_sz) ((1ULL << ((1 << (3 + nh_sz)) - 1)) - 1)
> +
> +static int
> +test_rib_perf(void)
> +{
> + struct rte_rib *rib = NULL;
> + struct rte_rib_conf conf;
> + struct route_rule *rt;
> + uint64_t begin, total_time;
> + uint64_t next_hop_add;
> + uint64_t default_nh = 0;
> + int64_t count = 0;
> + unsigned int i, j;
> + int status = 0;
> + int ret, nh_bits, nr_tbl8;
> + uint32_t num_routes;
> +
> + conf.max_nodes = 3000000;
> + conf.node_sz = sizeof(struct rte_rib_node);
> + conf.type = RTE_RIB_DIR24_8;
> + conf.fib_conf.dir24_8.def_nh = default_nh;
> + conf.fib_conf.dir24_8.nh_sz = RTE_DIR24_8_8B;
It's good that you are taking the worst-case to show the perf, but it means
that the library comes out a bit slower than LPM in the autotest.
How about running the same test cases for multiple data sizes, 8, 4, 2?
> +
> + rte_srand(rte_rdtsc());
> +
> + nh_bits = RTE_MIN(((1 << (3 + conf.fib_conf.dir24_8.nh_sz)) - 1), 24);
> + nr_tbl8 = RTE_MIN(((1 << nh_bits) - 1), 131071);
> + conf.fib_conf.dir24_8.num_tbl8 = nr_tbl8;
> + num_routes = 1200000;
> +
> + rt = rte_zmalloc("struct route_rule *", sizeof(struct route_rule) *
> + num_routes, 0);
> + TEST_RIB_ASSERT(rt != NULL);
> +
> + num_routes = generate_large_route_rule_table(num_routes, rt);
> + TEST_RIB_ASSERT(num_routes != 0);
> +
> + printf("No. routes = %u\n", (unsigned int) num_routes);
> +
> + shuffle_rt(rt, num_routes);
> +
> + print_route_distribution(rt, (uint32_t) num_routes);
> +
> + rib = rte_rib_create(__func__, SOCKET_ID_ANY, &conf);
> + TEST_RIB_ASSERT(rib != NULL);
> +
> + /* Measue add. */
> + begin = rte_rdtsc();
> +
> + for (i = 0; i < num_routes; i++) {
> + do {
> + next_hop_add = rte_rand() & NH_MSK(conf.fib_conf.dir24_8.nh_sz);
> + } while (next_hop_add == default_nh);
> +
> + ret = rte_rib_add(rib, rt[i].ip, rt[i].depth, next_hop_add);
> + if ((ret == 0))
> + status++;
> + }
> +
> + total_time = rte_rdtsc() - begin;
> +
> + printf("Unique added entries = %d\n", status);
> + printf("Average RIB Add: %g cycles\n",
> + (double)total_time / num_routes);
> +
> + /* Measure bulk Lookup */
> + total_time = 0;
> + count = 0;
> + for (i = 0; i < ITERATIONS; i++) {
> + static uint32_t ip_batch[BATCH_SIZE];
> + uint64_t next_hops[BULK_SIZE];
> +
> + /* Create array of random IP addresses */
> + for (j = 0; j < BATCH_SIZE; j++)
> + ip_batch[j] = rte_rand();
> +
> + /* Lookup per batch */
> + begin = rte_rdtsc();
> + for (j = 0; j < BATCH_SIZE; j += BULK_SIZE)
> + rte_rib_fib_lookup_bulk(rib, &ip_batch[j], next_hops,
> + BULK_SIZE);
> +
> + total_time += rte_rdtsc() - begin;
> + for (j = 0; j < BULK_SIZE; j++) {
> + if (next_hops[j] == default_nh)
> + count++;
> + }
> + }
> + printf("BULK RIB 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_routes; i++) {
> + ret = rte_rib_delete(rib, rt[i].ip, rt[i].depth);
> + if (ret == 0)
> + status++;
> + }
> +
> + total_time = rte_rdtsc() - begin;
> +
> + printf("Average RIB Delete: %g cycles\n",
> + (double)total_time / num_routes);
> +
> + rte_rib_free(rib);
> + rte_free(rt);
> +
> + return 0;
> +}
> +
> +REGISTER_TEST_COMMAND(rib_perf_autotest, test_rib_perf);
> --
> 1.8.3.1
>
next prev parent reply other threads:[~2018-06-29 15:31 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-26 22:03 [dpdk-dev] [PATCH v4 0/4] lib/rib: Add Routing Information Base library Medvedkin Vladimir
2018-04-26 22:03 ` [dpdk-dev] [PATCH v4 1/4] Add RIB library Medvedkin Vladimir
2018-04-26 22:17 ` Stephen Hemminger
2018-04-26 22:18 ` Stephen Hemminger
2018-04-26 22:19 ` Stephen Hemminger
2018-04-26 22:19 ` Stephen Hemminger
2018-04-26 22:20 ` Stephen Hemminger
2018-04-27 6:45 ` Vladimir Medvedkin
2018-06-29 13:54 ` Bruce Richardson
2018-06-29 14:02 ` Bruce Richardson
2018-04-26 22:03 ` [dpdk-dev] [PATCH v4 2/4] Add dir24_8 implementation for rib library Medvedkin Vladimir
2018-04-26 22:03 ` [dpdk-dev] [PATCH v4 3/4] Add autotests for RIB library Medvedkin Vladimir
2018-06-29 14:13 ` Bruce Richardson
2018-06-29 15:07 ` Bruce Richardson
2018-06-29 15:31 ` Bruce Richardson [this message]
2018-04-26 22:03 ` [dpdk-dev] [PATCH v4 4/4] Add support for lpm and rib bulk lookup Medvedkin Vladimir
2018-04-26 22:24 ` [dpdk-dev] [PATCH v4 0/4] lib/rib: Add Routing Information Base library Stephen Hemminger
2018-04-26 22:27 ` Thomas Monjalon
2018-04-26 22:42 ` Stephen Hemminger
2018-04-26 22:49 ` Stephen Hemminger
2018-04-27 8:27 ` Vladimir Medvedkin
2018-06-29 15:48 ` Bruce Richardson
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 00/12] lib: add RIB and FIB liraries Vladimir Medvedkin
2019-09-12 7:37 ` Morten Brørup
2019-09-12 9:47 ` Medvedkin, Vladimir
2019-09-12 12:00 ` Morten Brørup
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 " Vladimir Medvedkin
2019-11-05 23:14 ` Thomas Monjalon
2019-11-06 5:50 ` David Marchand
2019-11-06 7:50 ` Thomas Monjalon
2019-11-06 11:53 ` Medvedkin, Vladimir
2019-11-06 11:59 ` Thomas Monjalon
2019-11-06 14:37 ` Aaron Conole
2019-11-06 11:50 ` Medvedkin, Vladimir
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 01/12] rib: add RIB library Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 02/12] test/rib: add RIB library autotests Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 03/12] rib: add ipv6 support for RIB Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 04/12] test/rib: add ipv6 support for RIB autotests Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 05/12] fib: add FIB library Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 06/12] fib: add FIB ipv6 support Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 07/12] fib: add DIR24-8 dataplane algorithm Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 08/12] fib: add dataplane algorithm for ipv6 Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 09/12] test/fib: add FIB library autotests Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 10/12] test/fib: add ipv6 support for FIB autotests Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 11/12] test/fib: add FIB library performance autotests Vladimir Medvedkin
2019-11-01 15:21 ` [dpdk-dev] [PATCH v6 12/12] test/fib: add FIB library ipv6 " Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 01/12] rib: add RIB library Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 02/12] test/rib: add RIB library autotests Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 03/12] rib: add ipv6 support for RIB Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 04/12] test/rib: add ipv6 support for RIB autotests Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 05/12] fib: add FIB library Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 06/12] fib: add FIB ipv6 support Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 07/12] fib: add DIR24-8 dataplane algorithm Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 08/12] fib: add dataplane algorithm for ipv6 Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 09/12] test/fib: add FIB library autotests Vladimir Medvedkin
2019-09-12 14:07 ` Aaron Conole
2019-10-01 17:12 ` Medvedkin, Vladimir
2019-10-24 15:55 ` Thomas Monjalon
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 10/12] test/fib: add ipv6 support for FIB autotests Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 11/12] test/fib: add FIB library performance autotests Vladimir Medvedkin
2019-09-11 17:09 ` [dpdk-dev] [PATCH v5 12/12] test/fib: add FIB library ipv6 " Vladimir Medvedkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180629153127.GA13896@bricha3-MOBL.ger.corp.intel.com \
--to=bruce.richardson@intel.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
--cc=medvedkinv@gmail.com \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).