|
2 | 2 | /* |
3 | 3 | * CRC constants generated by: |
4 | 4 | * |
5 | | - * ./scripts/gen-crc-consts.py x86_pclmul crc32_lsb_0xedb88320 |
| 5 | + * ./scripts/gen-crc-consts.py x86_pclmul crc16_msb_0x8bb7,crc32_lsb_0xedb88320 |
6 | 6 | * |
7 | 7 | * Do not edit manually. |
8 | 8 | */ |
9 | 9 |
|
| 10 | +/* |
| 11 | + * CRC folding constants generated for most-significant-bit-first CRC-16 using |
| 12 | + * G(x) = x^16 + x^15 + x^11 + x^9 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + x^0 |
| 13 | + */ |
| 14 | +static const struct { |
| 15 | + u8 bswap_mask[16]; |
| 16 | + u64 fold_across_2048_bits_consts[2]; |
| 17 | + u64 fold_across_1024_bits_consts[2]; |
| 18 | + u64 fold_across_512_bits_consts[2]; |
| 19 | + u64 fold_across_256_bits_consts[2]; |
| 20 | + u64 fold_across_128_bits_consts[2]; |
| 21 | + u8 shuf_table[48]; |
| 22 | + u64 barrett_reduction_consts[2]; |
| 23 | +} crc16_msb_0x8bb7_consts ____cacheline_aligned __maybe_unused = { |
| 24 | + .bswap_mask = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, |
| 25 | + .fold_across_2048_bits_consts = { |
| 26 | + 0xdccf000000000000, /* LO64_TERMS: (x^2000 mod G) * x^48 */ |
| 27 | + 0x4b0b000000000000, /* HI64_TERMS: (x^2064 mod G) * x^48 */ |
| 28 | + }, |
| 29 | + .fold_across_1024_bits_consts = { |
| 30 | + 0x9d9d000000000000, /* LO64_TERMS: (x^976 mod G) * x^48 */ |
| 31 | + 0x7cf5000000000000, /* HI64_TERMS: (x^1040 mod G) * x^48 */ |
| 32 | + }, |
| 33 | + .fold_across_512_bits_consts = { |
| 34 | + 0x044c000000000000, /* LO64_TERMS: (x^464 mod G) * x^48 */ |
| 35 | + 0xe658000000000000, /* HI64_TERMS: (x^528 mod G) * x^48 */ |
| 36 | + }, |
| 37 | + .fold_across_256_bits_consts = { |
| 38 | + 0x6ee3000000000000, /* LO64_TERMS: (x^208 mod G) * x^48 */ |
| 39 | + 0xe7b5000000000000, /* HI64_TERMS: (x^272 mod G) * x^48 */ |
| 40 | + }, |
| 41 | + .fold_across_128_bits_consts = { |
| 42 | + 0x2d56000000000000, /* LO64_TERMS: (x^80 mod G) * x^48 */ |
| 43 | + 0x06df000000000000, /* HI64_TERMS: (x^144 mod G) * x^48 */ |
| 44 | + }, |
| 45 | + .shuf_table = { |
| 46 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 47 | + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 48 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 49 | + }, |
| 50 | + .barrett_reduction_consts = { |
| 51 | + 0x8bb7000000000000, /* LO64_TERMS: (G - x^16) * x^48 */ |
| 52 | + 0xf65a57f81d33a48a, /* HI64_TERMS: (floor(x^79 / G) * x) - x^64 */ |
| 53 | + }, |
| 54 | +}; |
| 55 | + |
10 | 56 | /* |
11 | 57 | * CRC folding constants generated for least-significant-bit-first CRC-32 using |
12 | 58 | * G(x) = x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + |
|
0 commit comments