Home
last modified time | relevance | path

Searched full:crc (Results 1 – 25 of 1179) sorted by relevance

12345678910>>...48

/linux/lib/crc/mips/
H A Dcrc32.h31 #define __CRC32(crc, value, op, SZ, TYPE) \ argument
39 : "+r" (crc) \
43 #define _CRC32_crc32b(crc, value) __CRC32(crc, value, crc32b, 0, 0) argument
44 #define _CRC32_crc32h(crc, value) __CRC32(crc, value, crc32h, 1, 0) argument
45 #define _CRC32_crc32w(crc, value) __CRC32(crc, value, crc32w, 2, 0) argument
46 #define _CRC32_crc32d(crc, value) __CRC32(crc, value, crc32d, 3, 0) argument
47 #define _CRC32_crc32cb(crc, value) __CRC32(crc, value, crc32cb, 0, 1) argument
48 #define _CRC32_crc32ch(crc, value) __CRC32(crc, value, crc32ch, 1, 1) argument
49 #define _CRC32_crc32cw(crc, value) __CRC32(crc, value, crc32cw, 2, 1) argument
50 #define _CRC32_crc32cd(crc, value) __CRC32(crc, value, crc32cd, 3, 1) argument
[all …]
/linux/include/linux/
H A Dcrc32.h9 * crc32_le() - Compute least-significant-bit-first IEEE CRC-32
10 * @crc: Initial CRC value. ~0 (recommended) or 0 for a new CRC computation, or
11 * the previous CRC value if computing incrementally.
15 * This implements the CRC variant that is often known as the IEEE CRC-32, or
16 * simply CRC-32, and is widely used in Ethernet and other applications:
23 * This does *not* invert the CRC at the beginning or end. The caller is
26 * For new applications, prefer to use CRC-32C instead. See crc32c().
29 * Return: The new CRC value
31 u32 crc32_le(u32 crc, const void *p, size_t len);
34 static inline u32 crc32(u32 crc, const void *p, size_t len) in crc32() argument
[all …]
H A Dcrc8.h25 * Return value of crc8() indicating valid message+crc. This is true
26 * if a CRC is inverted before transmission. The CRC computed over the
40 * crc8_populate_lsb - fill crc table for given polynomial in regular bit order.
46 * regular bit order (lsb first). Polynomials in CRC algorithms are typically
58 * crc8_populate_msb - fill crc table for given polynomial in reverse bit order.
64 * reverse bit order (msb first). Polynomials in CRC algorithms are typically
78 * @table: crc table used for calculation.
81 * @crc: previous returned crc8 value.
88 * discontiguous blocks of data. When generating the CRC the
95 * "A Painless Guide to CRC Error Detection Algorithms", ver 3, Aug 1993
[all …]
/linux/lib/crc/arm64/
H A Dcrc32.h11 asmlinkage u32 crc32_le_arm64(u32 crc, unsigned char const *p, size_t len);
12 asmlinkage u32 crc32c_le_arm64(u32 crc, unsigned char const *p, size_t len);
13 asmlinkage u32 crc32_be_arm64(u32 crc, unsigned char const *p, size_t len);
15 asmlinkage u32 crc32_le_arm64_4way(u32 crc, unsigned char const *p, size_t len);
16 asmlinkage u32 crc32c_le_arm64_4way(u32 crc, unsigned char const *p, size_t len);
17 asmlinkage u32 crc32_be_arm64_4way(u32 crc, unsigned char const *p, size_t len);
19 static inline u32 crc32_le_arch(u32 crc, const u8 *p, size_t len) in crc32_le_arch() argument
22 return crc32_le_base(crc, p, len); in crc32_le_arch()
27 crc = crc32_le_arm64_4way(crc, p, len); in crc32_le_arch()
34 return crc; in crc32_le_arch()
[all …]
/linux/lib/crc/tests/
H A Dcrc_kunit.c3 * Unit tests and benchmarks for the CRC library functions
13 #include <linux/crc-t10dif.h>
29 * struct crc_variant - describes a CRC variant
30 * @bits: Number of bits in the CRC, 1 <= @bits <= 64.
31 * @le: true if it's a "little endian" CRC (reversed mapping between bits and
32 * polynomial coefficients in each byte), false if it's a "big endian" CRC
36 * @func: The function to compute a CRC. The type signature uses u64 so that it
37 * can fit any CRC up to CRC-64. The CRC is passed in, and is expected
39 * function is expected to *not* invert the CRC at the beginning and end.
45 u64 (*func)(u64 crc, const u8 *p, size_t len);
[all …]
/linux/lib/crc/loongarch/
H A Dcrc32.h3 * CRC32 and CRC32C using LoongArch crc* instructions
15 #define _CRC32(crc, value, size, type) \ argument
19 : "+r" (crc) \
24 #define CRC32(crc, value, size) _CRC32(crc, value, size, crc) argument
25 #define CRC32C(crc, value, size) _CRC32(crc, value, size, crcc) argument
29 static inline u32 crc32_le_arch(u32 crc, const u8 *p, size_t len) in crc32_le_arch() argument
32 return crc32_le_base(crc, p, len); in crc32_le_arch()
37 CRC32(crc, value, d); in crc32_le_arch()
45 CRC32(crc, value, w); in crc32_le_arch()
52 CRC32(crc, value, h); in crc32_le_arch()
[all …]
/linux/lib/crc/riscv/
H A Dcrc-clmul-template.h5 * This file is a "template" that generates a CRC function optimized using the
7 * file must define the following parameters to specify the type of CRC:
9 * crc_t: the data type of the CRC, e.g. u32 for a 32-bit CRC
10 * LSB_CRC: 0 for a msb (most-significant-bit) first CRC, i.e. natural
12 * 1 for a lsb (least-significant-bit) first CRC, i.e. reflected
59 * polynomial whose bit order matches the CRC's bit order.
75 /* XOR @crc into the end of @msgpoly that represents the high-order terms. */
77 crc_clmul_prep(crc_t crc, unsigned long msgpoly) in crc_clmul_prep() argument
80 return msgpoly ^ crc; in crc_clmul_prep()
82 return msgpoly ^ ((unsigned long)crc << (BITS_PER_LONG - CRC_BITS)); in crc_clmul_prep()
[all …]
H A Dcrc32.h11 #include "crc-clmul.h"
13 static inline u32 crc32_le_arch(u32 crc, const u8 *p, size_t len) in crc32_le_arch() argument
16 return crc32_lsb_clmul(crc, p, len, in crc32_le_arch()
18 return crc32_le_base(crc, p, len); in crc32_le_arch()
21 static inline u32 crc32_be_arch(u32 crc, const u8 *p, size_t len) in crc32_be_arch() argument
24 return crc32_msb_clmul(crc, p, len, in crc32_be_arch()
26 return crc32_be_base(crc, p, len); in crc32_be_arch()
29 static inline u32 crc32c_arch(u32 crc, const u8 *p, size_t len) in crc32c_arch() argument
32 return crc32_lsb_clmul(crc, p, len, in crc32c_arch()
34 return crc32c_base(crc, p, len); in crc32c_arch()
/linux/lib/crc/
H A Dcrc32-main.c35 crc32_le_base(u32 crc, const u8 *p, size_t len) in crc32_le_base() argument
38 crc = (crc >> 8) ^ crc32table_le[(crc & 255) ^ *p++]; in crc32_le_base()
39 return crc; in crc32_le_base()
43 crc32_be_base(u32 crc, const u8 *p, size_t len) in crc32_be_base() argument
46 crc = (crc << 8) ^ crc32table_be[(crc >> 24) ^ *p++]; in crc32_be_base()
47 return crc; in crc32_be_base()
51 crc32c_base(u32 crc, const u8 *p, size_t len) in crc32c_base() argument
54 crc = (crc >> 8) ^ crc32ctable_le[(crc & 255) ^ *p++]; in crc32c_base()
55 return crc; in crc32c_base()
72 u32 crc32_le(u32 crc, const void *p, size_t len) in crc32_le() argument
[all …]
H A Dcrc64-main.c3 * Normal 64-bit CRC calculation.
9 * Dr. Ross N. Williams has a great document to introduce the idea of CRC
13 * http://www.ross.net/crc/download/crc_v3.txt
15 * crc64table[256] is the lookup table of a table-driven 64-bit CRC
44 crc64_be_generic(u64 crc, const u8 *p, size_t len) in crc64_be_generic() argument
47 crc = (crc << 8) ^ crc64table[(crc >> 56) ^ *p++]; in crc64_be_generic()
48 return crc; in crc64_be_generic()
52 crc64_nvme_generic(u64 crc, const u8 *p, size_t len) in crc64_nvme_generic() argument
55 crc = (crc >> 8) ^ crc64nvmetable[(crc & 0xff) ^ *p++]; in crc64_nvme_generic()
56 return crc; in crc64_nvme_generic()
[all …]
H A Dgen_crc64table.c20 uint64_t i, j, c, crc; in generate_reflected_crc64_table() local
23 crc = 0ULL; in generate_reflected_crc64_table()
27 if ((crc ^ (c >> j)) & 1) in generate_reflected_crc64_table()
28 crc = (crc >> 1) ^ poly; in generate_reflected_crc64_table()
30 crc >>= 1; in generate_reflected_crc64_table()
32 table[i] = crc; in generate_reflected_crc64_table()
38 uint64_t i, j, c, crc; in generate_crc64_table() local
41 crc = 0; in generate_crc64_table()
45 if ((crc ^ c) & 0x8000000000000000ULL) in generate_crc64_table()
46 crc = (crc << 1) ^ poly; in generate_crc64_table()
[all …]
H A DKconfig3 # Kconfig for the kernel's cyclic redundancy check (CRC) library code
32 The CRC-CCITT library functions. Select this if your module uses any
33 of the functions from <linux/crc-ccitt.h>.
38 The CRC-ITU-T library functions. Select this if your module uses
39 any of the functions from <linux/crc-itu-t.h>.
44 The CRC-T10DIF library functions. Select this if your module uses
45 any of the functions from <linux/crc-t10dif.h>.
89 bool "Enable optimized CRC implementations" if EXPERT
94 architecture-optimized implementations of any CRC variants that are
95 enabled. CRC checksumming performance may get much slower.
[all …]
H A DMakefile3 # Makefile for the kernel's cyclic redundancy check (CRC) library code
9 obj-$(CONFIG_CRC_CCITT) += crc-ccitt.o
10 obj-$(CONFIG_CRC_ITU_T) += crc-itu-t.o
12 obj-$(CONFIG_CRC_T10DIF) += crc-t10dif.o
13 crc-t10dif-y := crc-t10dif-main.o
16 crc-t10dif-$(CONFIG_ARM) += arm/crc-t10dif-core.o
17 crc-t10dif-$(CONFIG_ARM64) += arm64/crc-t10dif-core.o
18 crc-t10dif-$(CONFIG_PPC) += powerpc/crct10dif-vpmsum_asm.o
19 crc-t10dif-$(CONFIG_RISCV) += riscv/crc16_msb.o
20 crc-t10dif-$(CONFIG_X86) += x86/crc16-msb-pclmul.o
H A Dgen_crc32table.c14 * crc is the crc of the byte i; other entries are filled in based on the
21 uint32_t crc = 1; in crc32init_le_generic() local
26 crc = (crc >> 1) ^ ((crc & 1) ? polynomial : 0); in crc32init_le_generic()
28 tab[i + j] = crc ^ tab[j]; in crc32init_le_generic()
48 uint32_t crc = 0x80000000; in crc32init_be() local
53 crc = (crc << 1) ^ ((crc & 0x80000000) ? CRC32_POLY_BE : 0); in crc32init_be()
55 crc32table_be[i + j] = crc ^ crc32table_be[j]; in crc32init_be()
/linux/fs/xfs/libxfs/
H A Dxfs_cksum.h8 * Calculate the intermediate checksum for a buffer that has the CRC field
9 * inside it. The offset of the 32bit crc fields is passed as the
11 * hence we have to split the CRC calculation across the cksum_offset.
17 uint32_t crc; in xfs_start_cksum_safe() local
19 /* Calculate CRC up to the checksum. */ in xfs_start_cksum_safe()
20 crc = crc32c(XFS_CRC_SEED, buffer, cksum_offset); in xfs_start_cksum_safe()
23 crc = crc32c(crc, &zero, sizeof(__u32)); in xfs_start_cksum_safe()
25 /* Calculate the rest of the CRC. */ in xfs_start_cksum_safe()
26 return crc32c(crc, &buffer[cksum_offset + sizeof(__be32)], in xfs_start_cksum_safe()
31 * Fast CRC method where the buffer is modified. Callers must have exclusive
[all …]
/linux/lib/crc/arm/
H A Dcrc32.h3 * Accelerated CRC32(C) using ARM CRC, NEON and Crypto Extensions instructions
25 static inline u32 crc32_le_scalar(u32 crc, const u8 *p, size_t len) in crc32_le_scalar() argument
28 return crc32_armv8_le(crc, p, len); in crc32_le_scalar()
29 return crc32_le_base(crc, p, len); in crc32_le_scalar()
32 static inline u32 crc32_le_arch(u32 crc, const u8 *p, size_t len) in crc32_le_arch() argument
40 crc = crc32_le_scalar(crc, p, n); in crc32_le_arch()
46 crc = crc32_pmull_le(p, n, crc); in crc32_le_arch()
51 return crc32_le_scalar(crc, p, len); in crc32_le_arch()
54 static inline u32 crc32c_scalar(u32 crc, const u8 *p, size_t len) in crc32c_scalar() argument
57 return crc32c_armv8_le(crc, p, len); in crc32c_scalar()
[all …]
/linux/tools/power/acpi/tools/acpidbg/
H A Dacpidbg.c123 static int acpi_aml_read(int fd, struct circ_buf *crc) in acpi_aml_read() argument
128 p = &crc->buf[crc->head]; in acpi_aml_read()
129 len = circ_space_to_end(crc); in acpi_aml_read()
134 crc->head = (crc->head + len) & (ACPI_AML_BUF_SIZE - 1); in acpi_aml_read()
138 static int acpi_aml_read_batch_cmd(int unused, struct circ_buf *crc) in acpi_aml_read_batch_cmd() argument
144 p = &crc->buf[crc->head]; in acpi_aml_read_batch_cmd()
145 len = circ_space_to_end(crc); in acpi_aml_read_batch_cmd()
155 crc->head = (crc->head + len) & (ACPI_AML_BUF_SIZE - 1); in acpi_aml_read_batch_cmd()
159 static int acpi_aml_read_batch_log(int fd, struct circ_buf *crc) in acpi_aml_read_batch_log() argument
165 p = &crc->buf[crc->head]; in acpi_aml_read_batch_log()
[all …]
/linux/Documentation/staging/
H A Dcrc32.rst2 Brief tutorial on CRC computation
5 A CRC is a long-division remainder. You add the CRC to the message,
6 and the whole thing (message+CRC) is a multiple of the given
7 CRC polynomial. To check the CRC, you can either check that the
8 CRC matches the recomputed value, *or* you can check that the
9 remainder computed on the message+CRC is 0. This latter approach
11 protocols put the end-of-frame flag after the CRC.
21 To produce a 32-bit CRC, the divisor is actually a 33-bit CRC polynomial.
23 CRC is written in hex with the most significant bit omitted. (If you're
26 Note that a CRC is computed over a string of *bits*, so you have
[all …]
/linux/lib/crc/s390/
H A Dcrc32le-vx.c3 * Hardware-accelerated CRC-32 variants for Linux on z Systems
6 * computing of bitreflected CRC-32 checksums for IEEE 802.3 Ethernet
9 * This CRC-32 implementation algorithm is bitreflected and processes
20 /* Vector register range containing CRC-32 constants */
29 * The CRC-32 constant block contains reduction constants to fold and
32 * For the CRC-32 variants, the constants are precomputed according to
48 * CRC-32 (IEEE 802.3 Ethernet, ...) polynomials:
53 * CRC-32C (Castagnoli) polynomials:
78 * crc32_le_vgfm_generic - Compute CRC-32 (LE variant) with vector registers
79 * @crc: Initial CRC value, typically ~0.
[all …]
H A Dcrc32.h3 * CRC-32 implemented with the z/Architecture Vector Extension Facility.
18 * DEFINE_CRC32_VX() - Define a CRC-32 function using the vector extension
20 * Creates a function to perform a particular CRC-32 computation. Depending
26 static inline u32 ___fname(u32 crc, const u8 *data, size_t datalen) \
32 return ___crc32_sw(crc, data, datalen); \
38 crc = ___crc32_sw(crc, data, prealign); \
46 crc = ___crc32_vx(crc, data, aligned); \
50 crc = ___crc32_sw(crc, data + aligned, remaining); \
52 return crc; \
H A Dcrc32be-vx.c3 * Hardware-accelerated CRC-32 variants for Linux on z Systems
6 * computing of CRC-32 checksums.
8 * This CRC-32 implementation algorithm processes the most-significant
19 /* Vector register range containing CRC-32 constants */
28 * The CRC-32 constant block contains reduction constants to fold and
31 * For the CRC-32 variants, the constants are precomputed according to
52 * CRC-32 (IEEE 802.3 Ethernet, ...) polynomials:
68 * crc32_be_vgfm_16 - Compute CRC-32 (BE variant) with vector registers
69 * @crc: Initial CRC value, typically ~0.
75 * V0: Initial CRC value and intermediate constants and results.
[all …]
/linux/lib/crc/x86/
H A Dcrc32.h10 #include "crc-pclmul-template.h"
18 static inline u32 crc32_le_arch(u32 crc, const u8 *p, size_t len) in crc32_le_arch() argument
20 CRC_PCLMUL(crc, p, len, crc32_lsb, crc32_lsb_0xedb88320_consts, in crc32_le_arch()
22 return crc32_le_base(crc, p, len); in crc32_le_arch()
37 asmlinkage u32 crc32c_x86_3way(u32 crc, const u8 *buffer, size_t len);
39 static inline u32 crc32c_arch(u32 crc, const u8 *p, size_t len) in crc32c_arch() argument
44 return crc32c_base(crc, p, len); in crc32c_arch()
52 * CRC them independently, and combine them using PCLMULQDQ. in crc32c_arch()
72 crc = crc32_lsb_vpclmul_avx512(crc, p, len, in crc32c_arch()
75 crc = crc32c_x86_3way(crc, p, len); in crc32c_arch()
[all …]
/linux/lib/crc/powerpc/
H A Dcrc-t10dif.h3 * Calculate a CRC T10-DIF with vpmsum acceleration
23 u32 __crct10dif_vpmsum(u32 crc, unsigned char const *p, size_t len);
29 u32 crc = crci; in crc_t10dif_arch() local
34 return crc_t10dif_generic(crc, p, len); in crc_t10dif_arch()
38 crc = crc_t10dif_generic(crc, p, prealign); in crc_t10dif_arch()
44 crc <<= 16; in crc_t10dif_arch()
48 crc = __crct10dif_vpmsum(crc, p, len & ~VMX_ALIGN_MASK); in crc_t10dif_arch()
52 crc >>= 16; in crc_t10dif_arch()
58 crc = crc_t10dif_generic(crc, p, tail); in crc_t10dif_arch()
61 return crc & 0xffff; in crc_t10dif_arch()
/linux/Documentation/w1/slaves/
H A Dw1_ds2423.rst27 memory page along the crc=YES or NO for indicating whether the read operation
28 was successful and CRC matched.
37 - 2 bytes for crc16 which was calculated from the data read since the previous crc bytes
39 - crc=YES/NO indicating whether read was ok and crc matched
44 … ff 00 00 fe ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff crc=YES c=2
45 … ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff crc=YES c=2
46 …0 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff crc=YES c=408798761
47 … ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff crc=YES c=5
49 example from the read with crc errors::
51 … ff 00 00 fe ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff 00 00 ff ff crc=YES c=2
[all …]
/linux/drivers/ipack/
H A Dipack.c265 static u16 ipack_crc_byte(u16 crc, u8 c) in ipack_crc_byte() argument
269 crc ^= c << 8; in ipack_crc_byte()
271 crc = (crc << 1) ^ ((crc & 0x8000) ? 0x1021 : 0); in ipack_crc_byte()
272 return crc; in ipack_crc_byte()
276 * The algorithm in lib/crc-ccitt.c does not seem to apply since it uses the
282 u16 crc; in ipack_calc_crc1() local
285 crc = 0xffff; in ipack_calc_crc1()
288 crc = ipack_crc_byte(crc, c); in ipack_calc_crc1()
290 crc = ~crc; in ipack_calc_crc1()
291 return crc & 0xff; in ipack_calc_crc1()
[all …]

12345678910>>...48