1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_CRC_T10DIF_H
3 #define _LINUX_CRC_T10DIF_H
4 
5 #include <linux/types.h>
6 
7 u16 crc_t10dif_arch(u16 crc, const u8 *p, size_t len);
8 u16 crc_t10dif_generic(u16 crc, const u8 *p, size_t len);
9 
crc_t10dif_update(u16 crc,const u8 * p,size_t len)10 static inline u16 crc_t10dif_update(u16 crc, const u8 *p, size_t len)
11 {
12 	if (IS_ENABLED(CONFIG_CRC_T10DIF_ARCH))
13 		return crc_t10dif_arch(crc, p, len);
14 	return crc_t10dif_generic(crc, p, len);
15 }
16 
crc_t10dif(const u8 * p,size_t len)17 static inline u16 crc_t10dif(const u8 *p, size_t len)
18 {
19 	return crc_t10dif_update(0, p, len);
20 }
21 
22 #endif
23