Skip to contentSkip to conversation

net/crc: improved barrett reduction in x86 SSE42

PATCH New Shreesh Adiga 1 participant 1 message Nov 10

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/crc: improved barrett reduction in x86 SSE42

Use 64-bit polynomial structure and perform barrett reduction from 128-bit to 64-bit which involves lesser instructions than performing the 128 to 64 followed by 64 to 32 sequence.

This also requires one less fold register as we can reuse the x^127 from single fold loop required for initial 128-bit reduction sequence.

Move CRC16-CCITT and CRC32-ETH folding constants into static const context structures in their respective handlers, removing the runtime initialization previously performed by rte_net_crc_sse42_init and avoids the extra data segment static variables which were being populated.

---
 lib/net/net_crc.h     |   3 -
 lib/net/net_crc_sse.c | 134 +++++++++++++++++-------------------------
 lib/net/rte_net_crc.c |  10 ----
 3 files changed, 53 insertions(+), 94 deletions(-)
lib/net/net_crc.h +0 -3
index 320b0edca8..0d61ccafd6 100644
@@ -13,9 +13,6 @@
 
 /* SSE4.2 */
 
-void
-rte_net_crc_sse42_init(void);
-
 uint32_t
 rte_crc16_ccitt_sse42_handler(const uint8_t *data, uint32_t data_len);
 
lib/net/net_crc_sse.c +53 -81

226 lines not on this page · raw message

lib/net/rte_net_crc.c +0 -10
index 3a589bdd6d..6becd3e336 100644
@@ -151,15 +151,6 @@ avx512_vpclmulqdq_init(void)
 #define SSE42_PCLMULQDQ_CPU_SUPPORTED \
 	rte_cpu_get_flag_enabled(RTE_CPUFLAG_PCLMULQDQ)
 
-static void
-sse42_pclmulqdq_init(void)
-{
-#ifdef RTE_ARCH_X86_64
-	if (SSE42_PCLMULQDQ_CPU_SUPPORTED)
-		rte_net_crc_sse42_init();
-#endif
-}
-
 /* NEON/PMULL handling */
 
 #define NEON_PMULL_CPU_SUPPORTED \
@@ -272,7 +263,6 @@ uint32_t rte_net_crc_calc(const struct rte_net_crc *ctx, const void *data, const
 RTE_INIT(rte_net_crc_init)
 {
 	rte_net_crc_scalar_init();
-	sse42_pclmulqdq_init();
 	avx512_vpclmulqdq_init();
 	neon_pmull_init();
 	handlers_init(RTE_NET_CRC_SCALAR);
Signature · 1 line
2.56.0