Skip to contentSkip to conversation

Shared Reed-Solomon ECC Library

RFC PATCH In review Thomas Gleixner 2 participants 3 messages Oct 1, 2004 – Oct 4, 2004 Library code

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Shared Reed-Solomon ECC Library

Hi,

the attached patch contains a shared Reed-Solomon Library analogous to the shared zlib.

(N)AND FLASH is gaining popularity and there are a lot of ASIC/SoC/FPGA controllers around which implement hardware support for Reed-Solomon error correction. As usual they use different implementations (polynomials etc.). So it's obvious to use a shared library for the common tasks of error correction.

A short scan through the kernel revealed that at least the ftape driver uses Reed-Solomon error correction. It could be easily converted to use the shared library code.

The encoder/decoder code is lifted from the GPL'd userspace RS-library written by Phil Karn. I modified/wrapped it to provide the different functions which we need in the MTD/NAND code.

The library is tested in extenso under various MTD/NAND configurations.

The lib should be usable for other purposes right out of the box. Adjustment for currently not implemented functionality is an easy task.

I'm willing to take the maintainership of the library.

Please apply,

tglx

lib/Kconfig +6 -0
diff -urN linux-2.6.9-rc2.org/lib/Kconfig linux-2.6.9-rc2/lib/Kconfig
@@ -39,5 +39,11 @@
 config ZLIB_DEFLATE
 	tristate
 
+#
+# reed solomon support is select'ed if needed
+#
+config REED_SOLOMON
+	tristate
+
 endmenu
 
lib/Makefile +1 -0
diff -urN linux-2.6.9-rc2.org/lib/Makefile linux-2.6.9-rc2/lib/Makefile
@@ -22,6 +22,7 @@
 
 obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate/
 obj-$(CONFIG_ZLIB_DEFLATE) += zlib_deflate/
+obj-$(CONFIG_REED_SOLOMON) += reed_solomon/
 
 hostprogs-y	:= gen_crc32table
 clean-files	:= crc32table.h
lib/reed_solomon/decode_rs.c +235 -0

235 lines not on this page · raw message

lib/reed_solomon/encode_rs.c +45 -0

45 lines not on this page · raw message

lib/reed_solomon/Makefile +6 -0
diff -urN linux-2.6.9-rc2.org/lib/reed_solomon/Makefile linux-2.6.9-rc2/lib/reed_solomon/Makefile
@@ -0,0 +1,6 @@
+#
+# This is a modified version of reed solomon lib, 
+#
+
+obj-$(CONFIG_REED_SOLOMON) += reed_solomon.o
+
lib/reed_solomon/reed_solomon.c +364 -0

364 lines not on this page · raw message

include/linux/rslib.h +99 -0

99 lines not on this page · raw message

#1 lore raw
Quoted 19 lines · Thomas Gleixner

Hi,

the attached patch contains a shared Reed-Solomon Library analogous to the shared zlib.

(N)AND FLASH is gaining popularity and there are a lot of ASIC/SoC/FPGA controllers around which implement hardware support for Reed-Solomon error correction. As usual they use different implementations (polynomials etc.). So it's obvious to use a shared library for the common tasks of error correction.

A short scan through the kernel revealed that at least the ftape driver uses Reed-Solomon error correction. It could be easily converted to use the shared library code.

The encoder/decoder code is lifted from the GPL'd userspace RS-library written by Phil Karn. I modified/wrapped it to provide the different functions which we need in the MTD/NAND code.

Quoted 6 lines

The library is tested in extenso under various MTD/NAND configurations.

The lib should be usable for other purposes right out of the box. Adjustment for currently not implemented functionality is an easy task.

I'm willing to take the maintainership of the library.

One use would be very reliable CD/DVD for backup. I believe there's a freshmeat project which addresses this problem, but a reliable optical device certainly sounds easy using this approach.

Signature · 3 lines
   -bill davidsen ([email protected])
"The secret to procrastination is to put things off until the
 last possible moment - but no longer"  -me
#2 lore raw
Quoted 6 lines · Bill Davidsen
Quoted 2 lines

the attached patch contains a shared Reed-Solomon Library analogous to the shared zlib.

One use would be very reliable CD/DVD for backup. I believe there's a freshmeat project which addresses this problem, but a reliable optical device certainly sounds easy using this approach.

Most data storage devices use RS codes for data integrity, including CD/DVD/HD devicesm but the ECC mechanisms are built into the device itself.
Modems and wireless communication devices use similar but more complex techniques based on polynomial encoding/decoding.

tglx