From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Vladimir Medvedkin <vladimir.medvedkin@intel.com>,
Yipeng Wang <yipeng1.wang@intel.com>,
Sameh Gobriel <sameh.gobriel@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Anatoly Burakov <anatoly.burakov@intel.com>
Subject: [PATCH] test: remove unnecessary rte_srand
Date: Mon, 3 Jul 2023 11:49:03 -0700 [thread overview]
Message-ID: <20230703184903.51441-1-stephen@networkplumber.org> (raw)
The random number is already initialized to a better random
seed during starup process. The calls to rte_srand() are redundant
and actually make entropy worse.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
app/test/test_fib6_perf.c | 2 --
app/test/test_fib_perf.c | 2 --
app/test/test_hash_multiwriter.c | 2 --
app/test/test_lpm6_perf.c | 2 --
app/test/test_lpm_perf.c | 2 --
app/test/test_malloc.c | 2 --
app/test/test_memzone.c | 1 -
app/test/test_reciprocal_division.c | 1 -
app/test/test_reciprocal_division_perf.c | 2 --
9 files changed, 16 deletions(-)
diff --git a/app/test/test_fib6_perf.c b/app/test/test_fib6_perf.c
index add20c2331b1..f5c06b4fc9d0 100644
--- a/app/test/test_fib6_perf.c
+++ b/app/test/test_fib6_perf.c
@@ -83,8 +83,6 @@ test_fib6_perf(void)
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,
diff --git a/app/test/test_fib_perf.c b/app/test/test_fib_perf.c
index b56293e64f41..fcf8d222d90a 100644
--- a/app/test/test_fib_perf.c
+++ b/app/test/test_fib_perf.c
@@ -334,8 +334,6 @@ test_fib_perf(void)
int status = 0;
int64_t count = 0;
- rte_srand(rte_rdtsc());
-
generate_large_route_rule_table();
printf("No. routes = %u\n", (unsigned int) NUM_ROUTE_ENTRIES);
diff --git a/app/test/test_hash_multiwriter.c b/app/test/test_hash_multiwriter.c
index 0c5a8ca18607..3b70157b433b 100644
--- a/app/test/test_hash_multiwriter.c
+++ b/app/test/test_hash_multiwriter.c
@@ -146,8 +146,6 @@ test_hash_multiwriter(void)
tbl_multiwriter_test_params.nb_tsx_insertion)
* tbl_multiwriter_test_params.nb_tsx_insertion;
- rte_srand(rte_rdtsc());
-
keys = rte_malloc(NULL, sizeof(uint32_t) * nb_entries, 0);
if (keys == NULL) {
diff --git a/app/test/test_lpm6_perf.c b/app/test/test_lpm6_perf.c
index 5b684686a687..2e79655aa89c 100644
--- a/app/test/test_lpm6_perf.c
+++ b/app/test/test_lpm6_perf.c
@@ -66,8 +66,6 @@ test_lpm6_perf(void)
config.number_tbl8s = NUMBER_TBL8S;
config.flags = 0;
- rte_srand(rte_rdtsc());
-
printf("No. routes = %u\n", (unsigned) NUM_ROUTE_ENTRIES);
print_route_distribution(large_route_table, (uint32_t) NUM_ROUTE_ENTRIES);
diff --git a/app/test/test_lpm_perf.c b/app/test/test_lpm_perf.c
index e72437ba3850..dcc2eb375ae9 100644
--- a/app/test/test_lpm_perf.c
+++ b/app/test/test_lpm_perf.c
@@ -605,8 +605,6 @@ test_lpm_perf(void)
uint64_t cache_line_counter = 0;
int64_t count = 0;
- rte_srand(rte_rdtsc());
-
generate_large_route_rule_table();
printf("No. routes = %u\n", (unsigned) NUM_ROUTE_ENTRIES);
diff --git a/app/test/test_malloc.c b/app/test/test_malloc.c
index ff081dd93139..b1d8be1e0491 100644
--- a/app/test/test_malloc.c
+++ b/app/test/test_malloc.c
@@ -692,8 +692,6 @@ test_random_alloc_free(void *_ __rte_unused)
unsigned i;
unsigned count = 0;
- rte_srand((unsigned)rte_rdtsc());
-
for (i = 0; i < N; i++){
unsigned free_mem = 0;
size_t allocated_size;
diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c
index f10f4fd9cd39..dd42f783c7ce 100644
--- a/app/test/test_memzone.c
+++ b/app/test/test_memzone.c
@@ -573,7 +573,6 @@ test_memzone_reserve_max_aligned(void)
socket = rte_socket_id_by_idx(i);
/* random alignment */
- rte_srand((unsigned int)rte_rdtsc());
const unsigned int align = 1 << ((rte_rand() % 8) + 5); /* from 128 up to 4k alignment */
/* memzone size may be between size and size - align */
diff --git a/app/test/test_reciprocal_division.c b/app/test/test_reciprocal_division.c
index 8ea9b1d24d27..c70b90d2f4d7 100644
--- a/app/test/test_reciprocal_division.c
+++ b/app/test/test_reciprocal_division.c
@@ -32,7 +32,6 @@ test_reciprocal(void)
struct rte_reciprocal reci_u32 = {0};
struct rte_reciprocal_u64 reci_u64 = {0};
- rte_srand(rte_rdtsc());
printf("Validating unsigned 32bit division.\n");
for (i = 0; i < MAX_ITERATIONS; i++) {
/* Change divisor every DIVIDE_ITER iterations. */
diff --git a/app/test/test_reciprocal_division_perf.c b/app/test/test_reciprocal_division_perf.c
index 4f625873e53a..3d25be71cae5 100644
--- a/app/test/test_reciprocal_division_perf.c
+++ b/app/test/test_reciprocal_division_perf.c
@@ -37,8 +37,6 @@ test_reciprocal_division_perf(void)
struct rte_reciprocal reci_u32 = {0};
struct rte_reciprocal_u64 reci_u64 = {0};
- rte_srand(rte_rdtsc());
-
printf("Validating unsigned 32bit division.\n");
for (i = 0; i < MAX_ITERATIONS; i++) {
/* Change divisor every DIVIDE_ITER iterations. */
--
2.39.2
next reply other threads:[~2023-07-03 18:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-03 18:49 Stephen Hemminger [this message]
2023-07-03 23:21 ` [PATCH v2] " Stephen Hemminger
2024-03-06 21:43 ` Thomas Monjalon
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=20230703184903.51441-1-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=anatoly.burakov@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=sameh.gobriel@intel.com \
--cc=vladimir.medvedkin@intel.com \
--cc=yipeng1.wang@intel.com \
/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).