DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] test: add larger input len test for CRC16-CCITT
@ 2026-06-12  2:37 Shreesh Adiga
  2026-06-15 21:31 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Shreesh Adiga @ 2026-06-12  2:37 UTC (permalink / raw)
  To: Jasvinder Singh; +Cc: dev

CRC16-CCITT test only covered len 32, 12, and 2 which meant that
code paths like 4x SSE4.2 loop and AVX512 code paths which operated
on larger lens like >255 never got covered.

This patch adds a 348 len input test for CRC16-CCITT similar to
CRC32 test which covers the additional paths in SSE4.2 and AVX512
implementations, therefore improving the test coverage.

Signed-off-by: Shreesh Adiga <16567adigashreesh@gmail.com>
---
 app/test/test_crc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/app/test/test_crc.c b/app/test/test_crc.c
index 4ff03e3f64..11645d323d 100644
--- a/app/test/test_crc.c
+++ b/app/test/test_crc.c
@@ -14,6 +14,7 @@
 #define CRC32_VEC_LEN2     348
 #define CRC16_VEC_LEN1     12
 #define CRC16_VEC_LEN2     2
+#define CRC16_VEC_LEN3     348
 
 /* CRC test vector */
 static const uint8_t crc_vec[CRC_VEC_LEN] = {
@@ -46,6 +47,7 @@ static const uint32_t crc32_vec2_res = 0xefaae02f;
 static const uint32_t crc16_vec_res = 0x6bec;
 static const uint32_t crc16_vec1_res = 0x8cdd;
 static const uint32_t crc16_vec2_res = 0xec5b;
+static const uint32_t crc16_vec3_res = 0x6271;
 
 static int
 crc_all_algs(const char *desc, enum rte_net_crc_type type,
@@ -137,6 +139,12 @@ crc_autotest(void)
 	ret |= crc_all_algs("16-bit CCITT CRC:  Test 6", RTE_NET_CRC16_CCITT, crc16_vec2,
 		CRC16_VEC_LEN2, crc16_vec2_res);
 
+	/* 16-bit CCITT CRC:  Test 7 */
+	memset(test_data, 0, CRC32_VEC_LEN1);
+	for (i = 0; i < CRC16_VEC_LEN3; i += 12)
+		rte_memcpy(&test_data[i], crc16_vec1, 12);
+	ret |= crc_all_algs("16-bit CCITT CRC: Test 7", RTE_NET_CRC16_CCITT, test_data,
+		CRC16_VEC_LEN3, crc16_vec3_res);
 	return ret;
 }
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] test: add larger input len test for CRC16-CCITT
  2026-06-12  2:37 [PATCH] test: add larger input len test for CRC16-CCITT Shreesh Adiga
@ 2026-06-15 21:31 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-06-15 21:31 UTC (permalink / raw)
  To: Shreesh Adiga; +Cc: Jasvinder Singh, dev

On Fri, 12 Jun 2026 08:07:45 +0530
Shreesh Adiga <16567adigashreesh@gmail.com> wrote:

> CRC16-CCITT test only covered len 32, 12, and 2 which meant that
> code paths like 4x SSE4.2 loop and AVX512 code paths which operated
> on larger lens like >255 never got covered.
> 
> This patch adds a 348 len input test for CRC16-CCITT similar to
> CRC32 test which covers the additional paths in SSE4.2 and AVX512
> implementations, therefore improving the test coverage.
> 
> Signed-off-by: Shreesh Adiga <16567adigashreesh@gmail.com>
> ---

Looks good applied to net-next

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-15 21:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-12  2:37 [PATCH] test: add larger input len test for CRC16-CCITT Shreesh Adiga
2026-06-15 21:31 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox