DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yerden Zhumabekov <e_zhumabekov@sts.kz>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH] app/test: add crc32 algorithms equivalence check
Date: Wed, 25 Feb 2015 09:14:26 +0600	[thread overview]
Message-ID: <54ED3E12.5010701@sts.kz> (raw)
In-Reply-To: <20150224145734.GA9192@bricha3-MOBL3>


24.02.2015 20:57, Bruce Richardson пишет:
> +#define CRC32_ITERATIONS (1U << 16)
> This test takes almost no time at all, so maybe we want to do a few more
> iterations e.g. 2^18 - 2^20. 
Noted, I'll put (1U << 20).
>> +	printf("# CRC32 implementations equivalence test\n");
>> +	for (i = 0; i < CRC32_ITERATIONS; i++) {
>> +		/* Randomizing data_len of data set */
>> +		data_len = (size_t) (rte_rand() % sizeof(data64) + 1);
> I suggest parenthesis around the % operation for clarity.
Noted.
>> +		init_val = (uint32_t) rte_rand();
>> +
>> +		/* Fill the data set */
>> +		for (j = 0; j < CRC32_DWORDS; j++) {
>> +			data64[j] = rte_rand();
>> +		}
> As a matter of style, we generally omit braces for single-statement loop bodies.
Noted.
>> +
>> +		/* Calculate software CRC32 */
>> +		rte_hash_crc_set_alg(CRC32_SW);
>> +		hash_val = rte_hash_crc(data64, data_len, init_val);
>> +
>> +		/* Check against 4-byte-operand sse4.2 CRC32 if available */
>> +		rte_hash_crc_set_alg(CRC32_SSE42);
>> +		if (hash_val != rte_hash_crc(data64, data_len, init_val)) {
>> +			res = -1;
> I think you need a print statement here, stating that the test failed, and
> why exactly it failed.
> Also, rather than setting res to -1, you can just do a print and break, and
> change "return res" below to "return i == CRC32_ITERATIONS ? 0 : -1", making
> use of the fact that you can check i to detect early termination on error.

Noted; then I suggest I'll print out test data which caused the break as
well. It might be handy for further investigation.

-- 
Sincerely,

Yerden Zhumabekov
State Technical Service
Astana, KZ

  reply	other threads:[~2015-02-25  3:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 12:36 Yerden Zhumabekov
2015-02-24 14:57 ` Bruce Richardson
2015-02-25  3:14   ` Yerden Zhumabekov [this message]
2015-02-25  4:08 ` [dpdk-dev] [PATCH v2] " Yerden Zhumabekov
2015-02-25 11:34   ` Bruce Richardson
2015-02-25 12:36     ` Yerden Zhumabekov
2015-02-25 12:34 ` [dpdk-dev] [PATCH v3] " Yerden Zhumabekov
2015-02-25 13:14   ` Bruce Richardson
2015-02-25 15:19     ` 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=54ED3E12.5010701@sts.kz \
    --to=e_zhumabekov@sts.kz \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    /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).