summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2024-12-02 04:20:46 +0300
committerEric Biggers <ebiggers@google.com>2024-12-02 04:23:13 +0300
commit0961c3bcefa64d5f0999e2b703391862c733bb52 (patch)
tree0bd98a15d64963236f3a438198895ed92fe93655 /include/linux
parentbe3c45b070cba3be4dd248b38d4798e3e2859451 (diff)
downloadlinux-0961c3bcefa64d5f0999e2b703391862c733bb52.tar.xz
lib/crc-t10dif: add support for arch overrides
Following what was done for CRC32, add support for architecture-specific override of the CRC-T10DIF library. This will allow the CRC-T10DIF library functions to access architecture-optimized code directly. Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20241202012056.209768-3-ebiggers@kernel.org Signed-off-by: Eric Biggers <ebiggers@google.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/crc-t10dif.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/crc-t10dif.h b/include/linux/crc-t10dif.h
index 206ba2305483..16787c1cee21 100644
--- a/include/linux/crc-t10dif.h
+++ b/include/linux/crc-t10dif.h
@@ -7,10 +7,13 @@
#define CRC_T10DIF_DIGEST_SIZE 2
#define CRC_T10DIF_BLOCK_SIZE 1
+u16 crc_t10dif_arch(u16 crc, const u8 *p, size_t len);
u16 crc_t10dif_generic(u16 crc, const u8 *p, size_t len);
static inline u16 crc_t10dif_update(u16 crc, const u8 *p, size_t len)
{
+ if (IS_ENABLED(CONFIG_CRC_T10DIF_ARCH))
+ return crc_t10dif_arch(crc, p, len);
return crc_t10dif_generic(crc, p, len);
}
@@ -19,4 +22,13 @@ static inline u16 crc_t10dif(const u8 *p, size_t len)
return crc_t10dif_update(0, p, len);
}
+#if IS_ENABLED(CONFIG_CRC_T10DIF_ARCH)
+bool crc_t10dif_is_optimized(void);
+#else
+static inline bool crc_t10dif_is_optimized(void)
+{
+ return false;
+}
+#endif
+
#endif