|
2 | 2 | /*
|
3 | 3 | * CRC constants generated by:
|
4 | 4 | *
|
5 |
| - * ./scripts/gen-crc-consts.py x86_pclmul crc16_msb_0x8bb7,crc32_lsb_0xedb88320 |
| 5 | + * ./scripts/gen-crc-consts.py x86_pclmul crc16_msb_0x8bb7,crc32_lsb_0xedb88320,crc64_msb_0x42f0e1eba9ea3693,crc64_lsb_0x9a6c9329ac4bc9b5 |
6 | 6 | *
|
7 | 7 | * Do not edit manually.
|
8 | 8 | */
|
@@ -97,3 +97,99 @@ static const struct {
|
97 | 97 | 0x00000001db710640, /* LO64_TERMS: (G - x^32) * x^31 */
|
98 | 98 | },
|
99 | 99 | };
|
| 100 | + |
| 101 | +/* |
| 102 | + * CRC folding constants generated for most-significant-bit-first CRC-64 using |
| 103 | + * G(x) = x^64 + x^62 + x^57 + x^55 + x^54 + x^53 + x^52 + x^47 + x^46 + x^45 + |
| 104 | + * x^40 + x^39 + x^38 + x^37 + x^35 + x^33 + x^32 + x^31 + x^29 + x^27 + |
| 105 | + * x^24 + x^23 + x^22 + x^21 + x^19 + x^17 + x^13 + x^12 + x^10 + x^9 + |
| 106 | + * x^7 + x^4 + x^1 + x^0 |
| 107 | + */ |
| 108 | +static const struct { |
| 109 | + u8 bswap_mask[16]; |
| 110 | + u64 fold_across_2048_bits_consts[2]; |
| 111 | + u64 fold_across_1024_bits_consts[2]; |
| 112 | + u64 fold_across_512_bits_consts[2]; |
| 113 | + u64 fold_across_256_bits_consts[2]; |
| 114 | + u64 fold_across_128_bits_consts[2]; |
| 115 | + u8 shuf_table[48]; |
| 116 | + u64 barrett_reduction_consts[2]; |
| 117 | +} crc64_msb_0x42f0e1eba9ea3693_consts ____cacheline_aligned __maybe_unused = { |
| 118 | + .bswap_mask = {15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, |
| 119 | + .fold_across_2048_bits_consts = { |
| 120 | + 0x7f52691a60ddc70d, /* LO64_TERMS: (x^2048 mod G) * x^0 */ |
| 121 | + 0x7036b0389f6a0c82, /* HI64_TERMS: (x^2112 mod G) * x^0 */ |
| 122 | + }, |
| 123 | + .fold_across_1024_bits_consts = { |
| 124 | + 0x05cf79dea9ac37d6, /* LO64_TERMS: (x^1024 mod G) * x^0 */ |
| 125 | + 0x001067e571d7d5c2, /* HI64_TERMS: (x^1088 mod G) * x^0 */ |
| 126 | + }, |
| 127 | + .fold_across_512_bits_consts = { |
| 128 | + 0x5f6843ca540df020, /* LO64_TERMS: (x^512 mod G) * x^0 */ |
| 129 | + 0xddf4b6981205b83f, /* HI64_TERMS: (x^576 mod G) * x^0 */ |
| 130 | + }, |
| 131 | + .fold_across_256_bits_consts = { |
| 132 | + 0x571bee0a227ef92b, /* LO64_TERMS: (x^256 mod G) * x^0 */ |
| 133 | + 0x44bef2a201b5200c, /* HI64_TERMS: (x^320 mod G) * x^0 */ |
| 134 | + }, |
| 135 | + .fold_across_128_bits_consts = { |
| 136 | + 0x05f5c3c7eb52fab6, /* LO64_TERMS: (x^128 mod G) * x^0 */ |
| 137 | + 0x4eb938a7d257740e, /* HI64_TERMS: (x^192 mod G) * x^0 */ |
| 138 | + }, |
| 139 | + .shuf_table = { |
| 140 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 141 | + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 142 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 143 | + }, |
| 144 | + .barrett_reduction_consts = { |
| 145 | + 0x42f0e1eba9ea3693, /* LO64_TERMS: (G - x^64) * x^0 */ |
| 146 | + 0x578d29d06cc4f872, /* HI64_TERMS: (floor(x^127 / G) * x) - x^64 */ |
| 147 | + }, |
| 148 | +}; |
| 149 | + |
| 150 | +/* |
| 151 | + * CRC folding constants generated for least-significant-bit-first CRC-64 using |
| 152 | + * G(x) = x^64 + x^63 + x^61 + x^59 + x^58 + x^56 + x^55 + x^52 + x^49 + x^48 + |
| 153 | + * x^47 + x^46 + x^44 + x^41 + x^37 + x^36 + x^34 + x^32 + x^31 + x^28 + |
| 154 | + * x^26 + x^23 + x^22 + x^19 + x^16 + x^13 + x^12 + x^10 + x^9 + x^6 + |
| 155 | + * x^4 + x^3 + x^0 |
| 156 | + */ |
| 157 | +static const struct { |
| 158 | + u64 fold_across_2048_bits_consts[2]; |
| 159 | + u64 fold_across_1024_bits_consts[2]; |
| 160 | + u64 fold_across_512_bits_consts[2]; |
| 161 | + u64 fold_across_256_bits_consts[2]; |
| 162 | + u64 fold_across_128_bits_consts[2]; |
| 163 | + u8 shuf_table[48]; |
| 164 | + u64 barrett_reduction_consts[2]; |
| 165 | +} crc64_lsb_0x9a6c9329ac4bc9b5_consts ____cacheline_aligned __maybe_unused = { |
| 166 | + .fold_across_2048_bits_consts = { |
| 167 | + 0x37ccd3e14069cabc, /* HI64_TERMS: (x^2111 mod G) * x^0 */ |
| 168 | + 0xa043808c0f782663, /* LO64_TERMS: (x^2047 mod G) * x^0 */ |
| 169 | + }, |
| 170 | + .fold_across_1024_bits_consts = { |
| 171 | + 0xa1ca681e733f9c40, /* HI64_TERMS: (x^1087 mod G) * x^0 */ |
| 172 | + 0x5f852fb61e8d92dc, /* LO64_TERMS: (x^1023 mod G) * x^0 */ |
| 173 | + }, |
| 174 | + .fold_across_512_bits_consts = { |
| 175 | + 0x0c32cdb31e18a84a, /* HI64_TERMS: (x^575 mod G) * x^0 */ |
| 176 | + 0x62242240ace5045a, /* LO64_TERMS: (x^511 mod G) * x^0 */ |
| 177 | + }, |
| 178 | + .fold_across_256_bits_consts = { |
| 179 | + 0xb0bc2e589204f500, /* HI64_TERMS: (x^319 mod G) * x^0 */ |
| 180 | + 0xe1e0bb9d45d7a44c, /* LO64_TERMS: (x^255 mod G) * x^0 */ |
| 181 | + }, |
| 182 | + .fold_across_128_bits_consts = { |
| 183 | + 0xeadc41fd2ba3d420, /* HI64_TERMS: (x^191 mod G) * x^0 */ |
| 184 | + 0x21e9761e252621ac, /* LO64_TERMS: (x^127 mod G) * x^0 */ |
| 185 | + }, |
| 186 | + .shuf_table = { |
| 187 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 188 | + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, |
| 189 | + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, |
| 190 | + }, |
| 191 | + .barrett_reduction_consts = { |
| 192 | + 0x27ecfa329aef9f77, /* HI64_TERMS: floor(x^127 / G) */ |
| 193 | + 0x34d926535897936a, /* LO64_TERMS: (G - x^64 - x^0) / x */ |
| 194 | + }, |
| 195 | +}; |
0 commit comments