diff options
author | Eric Biggers <ebiggers@google.com> | 2025-02-10 20:26:44 +0300 |
---|---|---|
committer | Eric Biggers <ebiggers@google.com> | 2025-02-10 20:49:18 +0300 |
commit | 31c89102cf39fb7a171283f35c41f57bf422a4df (patch) | |
tree | 5e7e434fe4e5d778f18fc86f4db1579918b00e04 /scripts/generate_rust_analyzer.py | |
parent | 968e9bc4cef87054741db81a0d94d5c1f67d518a (diff) | |
download | linux-31c89102cf39fb7a171283f35c41f57bf422a4df.tar.xz |
scripts/gen-crc-consts: add gen-crc-consts.py
Add a Python script that generates constants for computing the given CRC
variant(s) using x86's pclmulqdq or vpclmulqdq instructions.
This is specifically tuned for x86's crc-pclmul-template.S. However,
other architectures with a 64x64 => 128-bit carryless multiplication
instruction should be able to use the generated constants too. (Some
tweaks may be warranted based on the exact instructions available on
each arch, so the script may grow an arch argument in the future.)
The script also supports generating the tables needed for table-based
CRC computation. Thus, it can also be used to reproduce the tables like
t10_dif_crc_table[] and crc16_table[] that are currently hardcoded in
the source with no generation script explicitly documented.
Python is used rather than C since it enables implementing the CRC math
in the simplest way possible, using arbitrary precision integers. The
outputs of this script are intended to be checked into the repo, so
Python will continue to not be required to build the kernel, and the
script has been optimized for simplicity rather than performance.
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20250210174540.161705-3-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions