xref: /linux/lib/crc/Kconfig (revision a578dd095dfe8b56c167201d9aea43e47d27f807)
189a51591SEric Biggers# SPDX-License-Identifier: GPL-2.0-only
289a51591SEric Biggers
389a51591SEric Biggers# Kconfig for the kernel's cyclic redundancy check (CRC) library code
489a51591SEric Biggers
589a51591SEric Biggersconfig CRC4
689a51591SEric Biggers	tristate
789a51591SEric Biggers	help
889a51591SEric Biggers	  The CRC4 library functions.  Select this if your module uses any of
989a51591SEric Biggers	  the functions from <linux/crc4.h>.
1089a51591SEric Biggers
1189a51591SEric Biggersconfig CRC7
1289a51591SEric Biggers	tristate
1389a51591SEric Biggers	help
1489a51591SEric Biggers	  The CRC7 library functions.  Select this if your module uses any of
1589a51591SEric Biggers	  the functions from <linux/crc7.h>.
1689a51591SEric Biggers
1789a51591SEric Biggersconfig CRC8
1889a51591SEric Biggers	tristate
1989a51591SEric Biggers	help
2089a51591SEric Biggers	  The CRC8 library functions.  Select this if your module uses any of
2189a51591SEric Biggers	  the functions from <linux/crc8.h>.
2289a51591SEric Biggers
2389a51591SEric Biggersconfig CRC16
2489a51591SEric Biggers	tristate
2589a51591SEric Biggers	help
2689a51591SEric Biggers	  The CRC16 library functions.  Select this if your module uses any of
2789a51591SEric Biggers	  the functions from <linux/crc16.h>.
2889a51591SEric Biggers
2989a51591SEric Biggersconfig CRC_CCITT
3089a51591SEric Biggers	tristate
3189a51591SEric Biggers	help
3289a51591SEric Biggers	  The CRC-CCITT library functions.  Select this if your module uses any
3389a51591SEric Biggers	  of the functions from <linux/crc-ccitt.h>.
3489a51591SEric Biggers
3589a51591SEric Biggersconfig CRC_ITU_T
3689a51591SEric Biggers	tristate
3789a51591SEric Biggers	help
3889a51591SEric Biggers	  The CRC-ITU-T library functions.  Select this if your module uses
3989a51591SEric Biggers	  any of the functions from <linux/crc-itu-t.h>.
4089a51591SEric Biggers
4189a51591SEric Biggersconfig CRC_T10DIF
4289a51591SEric Biggers	tristate
4389a51591SEric Biggers	help
4489a51591SEric Biggers	  The CRC-T10DIF library functions.  Select this if your module uses
4589a51591SEric Biggers	  any of the functions from <linux/crc-t10dif.h>.
4689a51591SEric Biggers
4789a51591SEric Biggersconfig CRC_T10DIF_ARCH
480bcfca56SEric Biggers	bool
490bcfca56SEric Biggers	depends on CRC_T10DIF && CRC_OPTIMIZATIONS
50530b304fSEric Biggers	default y if ARM && KERNEL_MODE_NEON
512b7531b2SEric Biggers	default y if ARM64 && KERNEL_MODE_NEON
52190c253dSEric Biggers	default y if PPC64 && ALTIVEC
53b5943815SEric Biggers	default y if RISCV && RISCV_ISA_ZBC
54*b10749d8SEric Biggers	default y if X86
5589a51591SEric Biggers
5689a51591SEric Biggersconfig CRC32
5789a51591SEric Biggers	tristate
5889a51591SEric Biggers	select BITREVERSE
5989a51591SEric Biggers	help
6089a51591SEric Biggers	  The CRC32 library functions.  Select this if your module uses any of
6189a51591SEric Biggers	  the functions from <linux/crc32.h> or <linux/crc32c.h>.
6289a51591SEric Biggers
6389a51591SEric Biggersconfig CRC32_ARCH
640bcfca56SEric Biggers	bool
650bcfca56SEric Biggers	depends on CRC32 && CRC_OPTIMIZATIONS
66530b304fSEric Biggers	default y if ARM && KERNEL_MODE_NEON
672b7531b2SEric Biggers	default y if ARM64
68b10d2d20SEric Biggers	default y if LOONGARCH
69da4fd657SEric Biggers	default y if MIPS && CPU_MIPSR6
70190c253dSEric Biggers	default y if PPC64 && ALTIVEC
71b5943815SEric Biggers	default y if RISCV && RISCV_ISA_ZBC
722374bf23SEric Biggers	default y if S390
739b2d720eSEric Biggers	default y if SPARC64
74*b10749d8SEric Biggers	default y if X86
7589a51591SEric Biggers
7689a51591SEric Biggersconfig CRC64
7789a51591SEric Biggers	tristate
7889a51591SEric Biggers	help
7989a51591SEric Biggers	  The CRC64 library functions.  Select this if your module uses any of
8089a51591SEric Biggers	  the functions from <linux/crc64.h>.
8189a51591SEric Biggers
8289a51591SEric Biggersconfig CRC64_ARCH
830bcfca56SEric Biggers	bool
840bcfca56SEric Biggers	depends on CRC64 && CRC_OPTIMIZATIONS
85b5943815SEric Biggers	default y if RISCV && RISCV_ISA_ZBC && 64BIT
86*b10749d8SEric Biggers	default y if X86_64
8789a51591SEric Biggers
8889a51591SEric Biggersconfig CRC_OPTIMIZATIONS
8989a51591SEric Biggers	bool "Enable optimized CRC implementations" if EXPERT
900bcfca56SEric Biggers	depends on !UML
9189a51591SEric Biggers	default y
9289a51591SEric Biggers	help
9389a51591SEric Biggers	  Disabling this option reduces code size slightly by disabling the
9489a51591SEric Biggers	  architecture-optimized implementations of any CRC variants that are
9589a51591SEric Biggers	  enabled.  CRC checksumming performance may get much slower.
9689a51591SEric Biggers
9789a51591SEric Biggers	  Keep this enabled unless you're really trying to minimize the size of
9889a51591SEric Biggers	  the kernel.
9989a51591SEric Biggers
10089a51591SEric Biggersconfig CRC_KUNIT_TEST
10189a51591SEric Biggers	tristate "KUnit tests for CRC functions" if !KUNIT_ALL_TESTS
10289a51591SEric Biggers	depends on KUNIT
10389a51591SEric Biggers	default KUNIT_ALL_TESTS
10489a51591SEric Biggers	select CRC7
10589a51591SEric Biggers	select CRC16
10689a51591SEric Biggers	select CRC_T10DIF
10789a51591SEric Biggers	select CRC32
10889a51591SEric Biggers	select CRC64
10989a51591SEric Biggers	help
11089a51591SEric Biggers	  Unit tests for the CRC library functions.
11189a51591SEric Biggers
11289a51591SEric Biggers	  This is intended to help people writing architecture-specific
11389a51591SEric Biggers	  optimized versions.  If unsure, say N.
11489a51591SEric Biggers
11589a51591SEric Biggersconfig CRC_BENCHMARK
11689a51591SEric Biggers	bool "Benchmark for the CRC functions"
11789a51591SEric Biggers	depends on CRC_KUNIT_TEST
11889a51591SEric Biggers	help
11989a51591SEric Biggers	  Include benchmarks in the KUnit test suite for the CRC functions.
120