[PATCH] test: add larger input len test for CRC16-CCITT
Shreesh Adiga
16567adigashreesh at gmail.com
Fri Jun 12 04:37:45 CEST 2026
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 at 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
More information about the dev
mailing list