Skip to contentSkip to conversation

lib: Add support for DIF CRC

PATCH In review Martin K. Petersen 2 participants 3 messages Jan 29, 2008 – Jan 30, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib: Add support for DIF CRC

Add support for the T10 Data Integrity Field CRC.

include/linux/crc-t10dif.h new file +9 -0
diff -r f5ec697e8b10 include/linux/crc-t10dif.h
@@ -0,0 +1,9 @@
+#ifndef _LINUX_CRC_T10DIF_H
+#define _LINUX_CRC_T10DIF_H
+
+#include <linux/types.h>
+
+const __u16 t10_dif_crc_table[256];
+__u16 crc_t10dif(unsigned char const *, size_t);
+
+#endif
lib/Kconfig +7 -0
diff -r f5ec697e8b10 lib/Kconfig
@@ -22,6 +22,13 @@ config CRC16
 	  modules require CRC16 functions, but a module built outside
 	  the kernel tree does. Such modules that use library CRC16
 	  functions require M here.
+
+config CRC_T10DIF
+	tristate "CRC calculation for the T10 Data Integrity Field"
+	help
+	  This option is only needed if a module that's not in the
+	  kernel tree needs to calculate CRC checks for use with the
+	  SCSI data integrity subsystem.
 
 config CRC_ITU_T
 	tristate "CRC ITU-T V.41 functions"
lib/Makefile +1 -0
diff -r f5ec697e8b10 lib/Makefile
@@ -44,6 +44,7 @@ obj-$(CONFIG_BITREVERSE) += bitrev.o
 obj-$(CONFIG_BITREVERSE) += bitrev.o
 obj-$(CONFIG_CRC_CCITT)	+= crc-ccitt.o
 obj-$(CONFIG_CRC16)	+= crc16.o
+obj-$(CONFIG_CRC_T10DIF)+= crc-t10dif.o
 obj-$(CONFIG_CRC_ITU_T)	+= crc-itu-t.o
 obj-$(CONFIG_CRC32)	+= crc32.o
 obj-$(CONFIG_CRC7)	+= crc7.o
lib/crc-t10dif.c new file +68 -0

68 lines not on this page · raw message

#1 lore raw

include/linux/crc-t10dif.h line 7

Quoted 10 lines · Martin K. Petersen
include/linux/crc-t10dif.h new file +7 -0
@@ -0,0 +1,9 @@
+#ifndef _LINUX_CRC_T10DIF_H
+#define _LINUX_CRC_T10DIF_H
+
+#include <linux/types.h>
+
+const __u16 t10_dif_crc_table[256];
+__u16 crc_t10dif(unsigned char const *, size_t);

'const unsigned char *', like the
rest of all code does.

include/linux/crc-t10dif.h line 8

Quoted 1 line
include/linux/crc-t10dif.h new file +1 -0
+++ b/lib/crc-t10dif.c	Tue Jan 29 13:26:19 2008 -0500

Do we already have some users for the T10DIF CRC?

#2 lore raw
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Jan" == Jan Engelhardt <[email protected]> writes:

Jan> 'const unsigned char *', like the rest of all code does.

Updated patch follows.

Jan> Do we already have some users for the T10DIF CRC?

This is a runt patch given that it doesn't fit in block and SCSI. The remaining bits will come in through those trees.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering