xref: /linux/lib/crc/Kconfig (revision 9b2d720e8ac4b68043ef23820ff9210fa12ea50d)
1# SPDX-License-Identifier: GPL-2.0-only
2
3# Kconfig for the kernel's cyclic redundancy check (CRC) library code
4
5config CRC4
6	tristate
7	help
8	  The CRC4 library functions.  Select this if your module uses any of
9	  the functions from <linux/crc4.h>.
10
11config CRC7
12	tristate
13	help
14	  The CRC7 library functions.  Select this if your module uses any of
15	  the functions from <linux/crc7.h>.
16
17config CRC8
18	tristate
19	help
20	  The CRC8 library functions.  Select this if your module uses any of
21	  the functions from <linux/crc8.h>.
22
23config CRC16
24	tristate
25	help
26	  The CRC16 library functions.  Select this if your module uses any of
27	  the functions from <linux/crc16.h>.
28
29config CRC_CCITT
30	tristate
31	help
32	  The CRC-CCITT library functions.  Select this if your module uses any
33	  of the functions from <linux/crc-ccitt.h>.
34
35config CRC_ITU_T
36	tristate
37	help
38	  The CRC-ITU-T library functions.  Select this if your module uses
39	  any of the functions from <linux/crc-itu-t.h>.
40
41config CRC_T10DIF
42	tristate
43	help
44	  The CRC-T10DIF library functions.  Select this if your module uses
45	  any of the functions from <linux/crc-t10dif.h>.
46
47config ARCH_HAS_CRC_T10DIF
48	bool
49
50config CRC_T10DIF_ARCH
51	bool
52	depends on CRC_T10DIF && CRC_OPTIMIZATIONS
53	default y if ARM && KERNEL_MODE_NEON
54	default y if ARM64 && KERNEL_MODE_NEON
55	default y if PPC64 && ALTIVEC
56	default y if RISCV && RISCV_ISA_ZBC
57
58config CRC32
59	tristate
60	select BITREVERSE
61	help
62	  The CRC32 library functions.  Select this if your module uses any of
63	  the functions from <linux/crc32.h> or <linux/crc32c.h>.
64
65config ARCH_HAS_CRC32
66	bool
67
68config CRC32_ARCH
69	bool
70	depends on CRC32 && CRC_OPTIMIZATIONS
71	default y if ARM && KERNEL_MODE_NEON
72	default y if ARM64
73	default y if LOONGARCH
74	default y if MIPS && CPU_MIPSR6
75	default y if PPC64 && ALTIVEC
76	default y if RISCV && RISCV_ISA_ZBC
77	default y if S390
78	default y if SPARC64
79
80config CRC64
81	tristate
82	help
83	  The CRC64 library functions.  Select this if your module uses any of
84	  the functions from <linux/crc64.h>.
85
86config ARCH_HAS_CRC64
87	bool
88
89config CRC64_ARCH
90	bool
91	depends on CRC64 && CRC_OPTIMIZATIONS
92	default y if RISCV && RISCV_ISA_ZBC && 64BIT
93
94config CRC_OPTIMIZATIONS
95	bool "Enable optimized CRC implementations" if EXPERT
96	depends on !UML
97	default y
98	help
99	  Disabling this option reduces code size slightly by disabling the
100	  architecture-optimized implementations of any CRC variants that are
101	  enabled.  CRC checksumming performance may get much slower.
102
103	  Keep this enabled unless you're really trying to minimize the size of
104	  the kernel.
105
106config CRC_KUNIT_TEST
107	tristate "KUnit tests for CRC functions" if !KUNIT_ALL_TESTS
108	depends on KUNIT
109	default KUNIT_ALL_TESTS
110	select CRC7
111	select CRC16
112	select CRC_T10DIF
113	select CRC32
114	select CRC64
115	help
116	  Unit tests for the CRC library functions.
117
118	  This is intended to help people writing architecture-specific
119	  optimized versions.  If unsure, say N.
120
121config CRC_BENCHMARK
122	bool "Benchmark for the CRC functions"
123	depends on CRC_KUNIT_TEST
124	help
125	  Include benchmarks in the KUnit test suite for the CRC functions.
126