From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mgw.gov.kz (mgw.gov.kz [89.218.88.242]) by dpdk.org (Postfix) with ESMTP id 8571C9AAE for ; Wed, 25 Feb 2015 04:16:15 +0100 (CET) Received: from mgw.gov.kz (mx.ctsat.kz [178.89.4.95]) by mgw.gov.kz with ESMTP id t1P3GBQN025597-t1P3GBQO025597; Wed, 25 Feb 2015 09:16:11 +0600 Received: from EXCASHUB1.rgp.local (192.168.40.51) by EdgeForefront.rgp.local (192.168.40.59) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 25 Feb 2015 09:14:37 +0600 Received: from [192.168.35.15] (192.168.35.15) by excashub1.rgp.local (192.168.40.48) with Microsoft SMTP Server (TLS) id 14.2.247.3; Wed, 25 Feb 2015 09:16:11 +0600 Message-ID: <54ED3E12.5010701@sts.kz> Date: Wed, 25 Feb 2015 09:14:26 +0600 From: Yerden Zhumabekov User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Bruce Richardson References: <1424781388-7485-1-git-send-email-e_zhumabekov@sts.kz> <20150224145734.GA9192@bricha3-MOBL3> In-Reply-To: <20150224145734.GA9192@bricha3-MOBL3> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [192.168.35.15] X-FEAS-SYSTEM-WL: e_zhumabekov@sts.kz Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH] app/test: add crc32 algorithms equivalence check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2015 03:16:16 -0000 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