From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 178E3A0C4E;
	Mon, 25 Oct 2021 19:03:04 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 940BA40E32;
	Mon, 25 Oct 2021 19:03:03 +0200 (CEST)
Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com
 [66.111.4.28]) by mails.dpdk.org (Postfix) with ESMTP id 6A1C04003E
 for <dev@dpdk.org>; Mon, 25 Oct 2021 19:03:02 +0200 (CEST)
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43])
 by mailout.nyi.internal (Postfix) with ESMTP id 03A1B5C01E8;
 Mon, 25 Oct 2021 13:03:02 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162])
 by compute3.internal (MEProxy); Mon, 25 Oct 2021 13:03:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 from:to:cc:subject:date:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding:content-type; s=fm2; bh=
 nNuL+8QgIumN73l0rqPT7L7iUFoKy+Q8eDG9BJswekY=; b=e3hJERvyaq5Zdkm/
 XM4kXNJABLeDle7rJYojgCJ8jhu4JJf2MfQgfun8BSp1JMv7kFKFZv3u6o/v8kv5
 ORSNwwAg5dLKLE+7rqBhKn9zpZtwU4cdVrVf2KqNS8ZgEkdVEdWesCnnLXwPTEWg
 sF88Fi5YQq05nrmYKtCX9OuQrnxW7rT+AoyvoGNVmQ0DNugRDXC3cmHn8g8udrfa
 dZvPoKfRyhsCMGze+9B1x3CDrVSEn1h/zMLWkVp6hC8huAMG1Pomerir57N2iIBm
 OPRJhvL2qq27KXUAemFBL5kOZZZyKnA+N3ATB2hMyzACmcua+GpjHAeT7haysFsR
 XixjjA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-transfer-encoding:content-type
 :date:from:in-reply-to:message-id:mime-version:references
 :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender
 :x-sasl-enc; s=fm1; bh=nNuL+8QgIumN73l0rqPT7L7iUFoKy+Q8eDG9BJswe
 kY=; b=BEB+IIGx20DOR4XWKKM3sYZwRTq7hFFRpM2r4z88CKhIJpNMn6J5zZbeU
 3YXaFX1GE1jNiBw1Owzr8QriSMujCQDLrk4gS7bTZW8GM8fkLmfJRLE8JTro4zQu
 8yC6U/2BdFIT/coTzEx2QoV6Z2LGjFl2FgoNOT2++SCzufZERcx1E1Lm0YLZTZR+
 XYNpovpdU6jEVGN4hMyL+Enq9yekHJNp+mwMxHJPByaNsS2eXI9bghcIF4OKFwtT
 4bIhlSNmWGYv9txJVAlJ8vDCumA6Vpi/v1N+xujBwn2KcQXlIJrpjFV45KkMU4p1
 5Dt+Saq7TFr+jkyL5yOeAyH7EJRiQ==
X-ME-Sender: <xms:ReN2YcLiDCsJr4stWBXgqcawEnLZ7dTQrIWEou5VgNEL2siQY5K63A>
 <xme:ReN2YcL0BHeS0gDGzZu379raPT8iBqzAHvq3BTp30TCKvmvNlFPEx9XCwk6yy64VG
 0k8R_LaRSxpfpc2Fw>
X-ME-Received: <xmr:ReN2YcvaOvdkMx63zXOxUymj4W0wV0bNgl1LiB3QTNsbELhz6V7gdTPIodaZeqdwSHgdCJnxk_HIzv-vtKJf0S76Mg>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvdefhedguddtgecutefuodetggdotefrod
 ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh
 necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd
 enucfjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm
 rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc
 ggtffrrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdej
 ueeiiedvffegheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh
 hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght
X-ME-Proxy: <xmx:ReN2YZb2qCYSu2__Q_TK-tesHQnRRjzij0uItjp0XmxyxsQisfauxA>
 <xmx:ReN2YTaGB-YHCMLsigY4OlDG3Wzc9qzNACmh9qkngwkMowgpHy5laA>
 <xmx:ReN2YVBFd8LVP-p1Q1t9lbZjhfL7Vqgq_l2rPoRX317f62He8UU2-w>
 <xmx:ReN2YeyDGGlwsNp3iWnPzloMhyn2YswAnNHCmMhHh4-ztpuHsia2gQ>
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon,
 25 Oct 2021 13:03:00 -0400 (EDT)
From: Thomas Monjalon <thomas@monjalon.net>
To: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: dev@dpdk.org, yipeng1.wang@intel.com, sameh.gobriel@intel.com,
 bruce.richardson@intel.com, konstantin.ananyev@intel.com,
 stephen@networkplumber.org
Date: Mon, 25 Oct 2021 19:02:58 +0200
Message-ID: <34793174.9LTJZ4FjZS@thomas>
In-Reply-To: <1634842469-27119-6-git-send-email-vladimir.medvedkin@intel.com>
References: <1634842469-27119-1-git-send-email-vladimir.medvedkin@intel.com>
 <1634842469-27119-6-git-send-email-vladimir.medvedkin@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
Subject: Re: [dpdk-dev] [PATCH v5 5/5] test/thash: add performance tests for
 the Toeplitz hash
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

21/10/2021 20:54, Vladimir Medvedkin:
> This patch adds performance tests for different implementations
> of the Toeplitz hash function.

Please name them.

> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

There are some garbage,

> @@ -320,6 +321,7 @@ perf_test_names = [
>          'hash_readwrite_lf_perf_autotest',
>          'trace_perf_autotest',
>          'ipsec_perf_autotest',
> +	'thash_perf_autotest',

here (tabs instead of space)

>  driver_test_names = [
> diff --git a/app/test/test_thash_perf.c b/app/test/test_thash_perf.c
> new file mode 100644
> index 0000000..fb66e20
> --- /dev/null
> +++ b/app/test/test_thash_perf.c
> @@ -0,0 +1,120 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2021 Intel Corporation
> + */
> +
> +#include <stdio.h>
> +#include <stdint.h>
> +#include <stdlib.h>
> +#include <math.h>
> +
> +#include <rte_cycles.h>
> +#include <rte_malloc.h>
> +#include <rte_random.h>
> +#include <rte_thash.h>
> +
> +#include "test.h"
> +
> +#define ITERATIONS	(1 << 15)
> +#define	BATCH_SZ	(1 << 10)
> +
> +#define IPV4_2_TUPLE_LEN	(8)
> +#define IPV4_4_TUPLE_LEN	(12)
> +#define IPV6_2_TUPLE_LEN	(32)
> +#define IPV6_4_TUPLE_LEN	(36)
> +
> +
> +static uint8_t default_rss_key[] = {
> +	0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
> +	0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
> +	0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
> +	0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
> +	0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa,
> +};
> +
> +static void
> +run_thash_test(unsigned int tuple_len)
> +{
> +	uint32_t *tuples[BATCH_SZ];
> +	unsigned int i, j;
> +	uint64_t start_tsc, end_tsc;
> +	uint32_t len = RTE_ALIGN_CEIL(tuple_len, sizeof(uint32_t));
> +	volatile uint32_t hash = 0;
> +	uint32_t bulk_hash[BATCH_SZ] = { 0 };
> +
> +	for (i = 0; i < BATCH_SZ; i++) {
> +		tuples[i] = rte_zmalloc(NULL, len, 0);
> +		for (j = 0; j < len / sizeof(uint32_t); j++)
> +			tuples[i][j] = rte_rand();
> +	}
> +
> +	start_tsc = rte_rdtsc_precise();
> +	for (i = 0; i < ITERATIONS; i++) {
> +		for (j = 0; j < BATCH_SZ; j++) {
> +			hash ^= rte_softrss(tuples[j], len / sizeof(uint32_t),
> +				default_rss_key);
> +		}
> +	}
> +	end_tsc = rte_rdtsc_precise();
> +
> +	printf("Average rte_softrss() takes \t\t%.1f cycles for key len %d\n",
> +		(double)(end_tsc - start_tsc) / (double)(ITERATIONS *
> +		BATCH_SZ), len);
> +
> +	start_tsc = rte_rdtsc_precise();
> +	for (i = 0; i < ITERATIONS; i++) {
> +		for (j = 0; j < BATCH_SZ; j++) {
> +			hash ^= rte_softrss_be(tuples[j], len /
> +				sizeof(uint32_t), default_rss_key);
> +		}
> +	}
> +	end_tsc = rte_rdtsc_precise();
> +
> +	printf("Average rte_softrss_be() takes \t\t%.1f cycles for key len %d\n",
> +		(double)(end_tsc - start_tsc) / (double)(ITERATIONS *
> +		BATCH_SZ), len);

The function could stop here (one function per type of implementation).

> +
> +	if (!rte_thash_gfni_supported())
> +		return;
> +
> +	uint64_t rss_key_matrixes[RTE_DIM(default_rss_key)];
> +
> +	rte_thash_complete_matrix(rss_key_matrixes, default_rss_key,
> +		RTE_DIM(default_rss_key));
> +
> +	start_tsc = rte_rdtsc_precise();
> +	for (i = 0; i < ITERATIONS; i++) {
> +		for (j = 0; j < BATCH_SZ; j++)
> +			hash ^= rte_thash_gfni(rss_key_matrixes,
> +				(uint8_t *)tuples[j], len);
> +	}
> +	end_tsc = rte_rdtsc_precise();
> +
> +	printf("Average rte_thash_gfni takes \t\t%.1f cycles for key len %d\n",
> +		(double)(end_tsc - start_tsc) / (double)(ITERATIONS *
> +		BATCH_SZ), len);
> +
> +	start_tsc = rte_rdtsc_precise();
> +	for (i = 0; i < ITERATIONS; i++)
> +		rte_thash_gfni_bulk(rss_key_matrixes, len, (uint8_t **)tuples,
> +			bulk_hash, BATCH_SZ);
> +
> +	end_tsc = rte_rdtsc_precise();
> +
> +	printf("Average rte_thash_gfni_x2 takes \t%.1f cycles for key len %d\n",

and here, the function name is not updated.

> +		(double)(end_tsc - start_tsc) / (double)(ITERATIONS *
> +		BATCH_SZ), len);
> +

useless blank line

> +}