+#define DECLARE_CKSUM_NAME const char *const cksum_name[] = {"crc32", "adler", \
+ "crc32c", "reserved", "t10ip512", "t10ip4K", "t10crc512", "t10crc4K"}
+
+typedef __u16 (obd_dif_csum_fn) (void *, unsigned int);
+
+__u16 obd_dif_crc_fn(void *data, unsigned int len);
+__u16 obd_dif_ip_fn(void *data, unsigned int len);
+int obd_page_dif_generate_buffer(const char *obd_name, struct page *page,
+ __u32 offset, __u32 length,
+ __u16 *guard_start, int guard_number,
+ int *used_number, int sector_size,
+ obd_dif_csum_fn *fn);
+/*
+ * If checksum type is one T10 checksum types, init the csum_fn and sector
+ * size. Otherwise, init them to NULL/zero.
+ */
+static inline void obd_t10_cksum2dif(enum cksum_types cksum_type,
+ obd_dif_csum_fn **fn, int *sector_size)
+{
+ *fn = NULL;
+ *sector_size = 0;
+
+#if IS_ENABLED(CONFIG_CRC_T10DIF)
+ switch (cksum_type) {
+ case OBD_CKSUM_T10IP512:
+ *fn = obd_dif_ip_fn;
+ *sector_size = 512;
+ break;
+ case OBD_CKSUM_T10IP4K:
+ *fn = obd_dif_ip_fn;
+ *sector_size = 4096;
+ break;
+ case OBD_CKSUM_T10CRC512:
+ *fn = obd_dif_crc_fn;
+ *sector_size = 512;
+ break;
+ case OBD_CKSUM_T10CRC4K:
+ *fn = obd_dif_crc_fn;
+ *sector_size = 4096;
+ break;
+ default:
+ break;
+ }
+#endif /* CONFIG_CRC_T10DIF */
+}
+
+enum obd_t10_cksum_type {
+ OBD_T10_CKSUM_UNKNOWN = 0,
+ OBD_T10_CKSUM_IP512,
+ OBD_T10_CKSUM_IP4K,
+ OBD_T10_CKSUM_CRC512,
+ OBD_T10_CKSUM_CRC4K,
+ OBD_T10_CKSUM_MAX
+};