summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorKota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>2016-11-03 04:54:19 -0700
committerKota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>2016-12-06 17:08:55 -0800
commit8d067ab2f631b147745e5eb3cf85056042c1439e (patch)
treebd2aaa2b70ab17418f9e62eab525aae6425369af /include
parent0a2c06b8b446cbe4fda89c18c20b069728c70323 (diff)
downloadliberasurecode-8d067ab2f631b147745e5eb3cf85056042c1439e.tar.gz
ISA-L Cauchy support
This is for supporting ISA-L cauchy based matrix. The difference from isa_l_rs_vand is only the matrix to use the encode/decode calculation. As a known issue, isa_l_rs_vand backend has constraint for the combinations of the available fragment to be able to decode/reconstuct. (See related change in detail) To avoid the constraint, this patch adds another isa-l backend to use cauchy matrix and keep the backward compatibility, this is in another isa_l_rs_cauchy namespace. For implementation consieration, the code is almost same except the matrix generation fucntion so that this patch makes isa_l_common.c file for gathering common fucntions like init/encode/decode/reconstruct. And then the common init funciton takes an extra args "gen_matrix_func_name" for entry point to load the fucntion by dlsym from isa-l .so file. Co-Authored-By: Clay Gerrard <clay.gerrard@gmail.com> Related-Change: Icee788a0931fe692fe0de31fabc4ba450e338a87 Change-Id: I6eb150d9d0c3febf233570fa7729f9f72df2e9be
Diffstat (limited to 'include')
-rw-r--r--include/erasurecode/erasurecode.h1
-rw-r--r--include/isa_l/isa_l_common.h70
2 files changed, 71 insertions, 0 deletions
diff --git a/include/erasurecode/erasurecode.h b/include/erasurecode/erasurecode.h
index a17c45c..d1e8f4e 100644
--- a/include/erasurecode/erasurecode.h
+++ b/include/erasurecode/erasurecode.h
@@ -48,6 +48,7 @@ typedef enum {
EC_BACKEND_ISA_L_RS_VAND = 4,
EC_BACKEND_SHSS = 5,
EC_BACKEND_LIBERASURECODE_RS_VAND = 6,
+ EC_BACKEND_ISA_L_RS_CAUCHY = 7,
EC_BACKENDS_MAX,
} ec_backend_id_t;
diff --git a/include/isa_l/isa_l_common.h b/include/isa_l/isa_l_common.h
new file mode 100644
index 0000000..caad19a
--- /dev/null
+++ b/include/isa_l/isa_l_common.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright 2014 Kevin M Greenan
+ * Copyright 2014 Tushar Gohad
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice, this
+ * list of conditions and the following disclaimer in the documentation and/or
+ * other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY
+ * THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * isa_l_rs_vand backend implementation
+ *
+ * vi: set noai tw=79 ts=4 sw=4:
+ */
+
+#define ISA_L_W 8
+
+/* Forward declarations */
+typedef void (*ec_encode_data_func)(int, int, int, unsigned char*, unsigned char **, unsigned char **);
+typedef void (*ec_init_tables_func)(int, int, unsigned char*, unsigned char *);
+typedef void (*gf_gen_encoding_matrix_func)(unsigned char*, int, int);
+typedef int (*gf_invert_matrix_func)(unsigned char*, unsigned char*, const int);
+typedef unsigned char (*gf_mul_func)(unsigned char, unsigned char);
+
+typedef struct {
+ /* calls required for init */
+ ec_init_tables_func ec_init_tables;
+ gf_gen_encoding_matrix_func gf_gen_encoding_matrix;
+
+ /* calls required for encode */
+ ec_encode_data_func ec_encode_data;
+
+ /* calls required for decode and reconstruct */
+ gf_invert_matrix_func gf_invert_matrix;
+
+ /* multiplication function used by ISA-L */
+ gf_mul_func gf_mul;
+
+ /* fields needed to hold state */
+ unsigned char *matrix;
+ int k;
+ int m;
+ int w;
+} isa_l_descriptor;
+
+int isa_l_encode(void *desc, char **data, char **parity, int blocksize);
+int isa_l_decode(void *desc, char **data, char **parity, int *missing_idxs,
+ int blocksize);
+int isa_l_reconstruct(void *desc, char **data, char **parity,
+ int *missing_idxs, int destination_idx, int blocksize);
+int isa_l_min_fragments(void *desc, int *missing_idxs,
+ int *fragments_to_exclude, int *fragments_needed);
+int isa_l_element_size(void* desc);
+int isa_l_exit(void *desc);
+void * isa_l_common_init(struct ec_backend_args *args, void *backend_sohandle,
+ const char* gen_matrix_func_name);