xref: /linux/lib/crc/Kconfig (revision ff57d59200baadfdb41f94a49fed7d161a9a8124)
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
516e4d63e8SEric Biggers	default y if ARM64
52190c253dSEric Biggers	default y if PPC64 && ALTIVEC
53b5943815SEric Biggers	default y if RISCV && RISCV_ISA_ZBC
54b10749d8SEric 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
68*3d9aba66SHuacai Chen	default y if LOONGARCH && 64BIT
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
74b10749d8SEric 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
8563432fd6SDemian Shulhan	default y if ARM64
86b5943815SEric Biggers	default y if RISCV && RISCV_ISA_ZBC && 64BIT
87b10749d8SEric Biggers	default y if X86_64
8889a51591SEric Biggers
8989a51591SEric Biggersconfig CRC_OPTIMIZATIONS
9089a51591SEric Biggers	bool "Enable optimized CRC implementations" if EXPERT
910bcfca56SEric Biggers	depends on !UML
9289a51591SEric Biggers	default y
9389a51591SEric Biggers	help
9489a51591SEric Biggers	  Disabling this option reduces code size slightly by disabling the
9589a51591SEric Biggers	  architecture-optimized implementations of any CRC variants that are
9689a51591SEric Biggers	  enabled.  CRC checksumming performance may get much slower.
9789a51591SEric Biggers
9889a51591SEric Biggers	  Keep this enabled unless you're really trying to minimize the size of
9989a51591SEric Biggers	  the kernel.
10089a51591SEric Biggers
10189a51591SEric Biggersconfig CRC_KUNIT_TEST
10289a51591SEric Biggers	tristate "KUnit tests for CRC functions" if !KUNIT_ALL_TESTS
10385c9f3a2SEric Biggers	depends on KUNIT && (CRC7 || CRC16 || CRC_T10DIF || CRC32 || CRC64)
10489a51591SEric Biggers	default KUNIT_ALL_TESTS
10589a51591SEric Biggers	help
10689a51591SEric Biggers	  Unit tests for the CRC library functions.
10789a51591SEric Biggers
10889a51591SEric Biggers	  This is intended to help people writing architecture-specific
10989a51591SEric Biggers	  optimized versions.  If unsure, say N.
11089a51591SEric Biggers
111cdf22aeaSEric Biggersconfig CRC_ENABLE_ALL_FOR_KUNIT
112cdf22aeaSEric Biggers	tristate "Enable all CRC functions for KUnit test"
113cdf22aeaSEric Biggers	depends on KUNIT
114cdf22aeaSEric Biggers	select CRC7
115cdf22aeaSEric Biggers	select CRC16
116cdf22aeaSEric Biggers	select CRC_T10DIF
117cdf22aeaSEric Biggers	select CRC32
118cdf22aeaSEric Biggers	select CRC64
119cdf22aeaSEric Biggers	help
120cdf22aeaSEric Biggers	  Enable all CRC functions that have test code in CRC_KUNIT_TEST.
121cdf22aeaSEric Biggers
122cdf22aeaSEric Biggers	  Enable this only if you'd like the CRC KUnit test suite to test all
123cdf22aeaSEric Biggers	  the CRC variants, even ones that wouldn't otherwise need to be built.
124cdf22aeaSEric Biggers
12589a51591SEric Biggersconfig CRC_BENCHMARK
12689a51591SEric Biggers	bool "Benchmark for the CRC functions"
12789a51591SEric Biggers	depends on CRC_KUNIT_TEST
12889a51591SEric Biggers	help
12989a51591SEric Biggers	  Include benchmarks in the KUnit test suite for the CRC functions.
130