lib/crc/riscv/crc-t10dif.h
raw| 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 | |
| 11 | #include "crc-clmul.h" |
| 12 | |
| 13 | static inline u16 crc_t10dif_arch(u16 crc, const u8 *p, size_t len) |
| 14 | { |
| 15 | if (riscv_has_extension_likely(RISCV_ISA_EXT_ZBC)) |
| 16 | return crc16_msb_clmul(crc, p, len, &crc16_msb_0x8bb7_consts); |
| 17 | return crc_t10dif_generic(crc, p, len); |
| 18 | } |