1 | // SPDX-License-Identifier: GPL-2.0-or-later |
---|---|
2 | /* |
3 | * RISC-V optimized CRC-T10DIF function |
4 | * |
5 | * Copyright 2025 Google LLC |
6 | */ |
7 | |
8 | #include <asm/hwcap.h> |
9 | #include <asm/alternative-macros.h> |
10 | #include <linux/crc-t10dif.h> |
11 | #include <linux/module.h> |
12 | |
13 | #include "crc-clmul.h" |
14 | |
15 | u16 crc_t10dif_arch(u16 crc, const u8 *p, size_t len) |
16 | { |
17 | if (riscv_has_extension_likely(RISCV_ISA_EXT_ZBC)) |
18 | return crc16_msb_clmul(crc, p, len, consts: &crc16_msb_0x8bb7_consts); |
19 | return crc_t10dif_generic(crc, p, len); |
20 | } |
21 | EXPORT_SYMBOL(crc_t10dif_arch); |
22 | |
23 | MODULE_DESCRIPTION("RISC-V optimized CRC-T10DIF function"); |
24 | MODULE_LICENSE("GPL"); |
25 |