erasure_code: expose base implementation of init_tables

Expose ec_init_tables_base(), which should be used
with ec_encode_data_base() and ec_encode_data_update_base().

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit is contained in:
Pablo de Lara 2023-11-14 17:09:01 +00:00 committed by Tomasz Kantecki
parent 65e89717df
commit f971f02309
5 changed files with 28 additions and 14 deletions

View File

@ -58,3 +58,8 @@ int gf_vect_mul(int len, unsigned char *a, void *src, void *dest)
{
return gf_vect_mul_base(len, a, (unsigned char *)src, (unsigned char *)dest);
}
void ec_init_tables(int k, int rows, unsigned char *a, unsigned char *g_tbls)
{
return ec_init_tables_base(k, rows, a, g_tbls);
}

View File

@ -60,7 +60,7 @@ typedef unsigned char u8;
void ec_encode_perf(int m, int k, u8 * a, u8 * g_tbls, u8 ** buffs)
{
ec_init_tables(k, m - k, &a[k * k], g_tbls);
ec_init_tables_base(k, m - k, &a[k * k], g_tbls);
ec_encode_data_base(TEST_LEN(m), k, m - k, g_tbls, buffs, &buffs[k]);
}
@ -88,7 +88,7 @@ int ec_decode_perf(int m, int k, u8 * a, u8 * g_tbls, u8 ** buffs, u8 * src_in_e
c[k * i + j] = d[k * src_err_list[i] + j];
// Recover data
ec_init_tables(k, nerrs, c, g_tbls);
ec_init_tables_base(k, nerrs, c, g_tbls);
ec_encode_data_base(TEST_LEN(m), k, nerrs, g_tbls, recov, temp_buffs);
return 0;

View File

@ -278,7 +278,7 @@ int main(int argc, char *argv[])
gf_gen_rs_matrix(encode_matrix, m, k);
// Generate g_tbls from encode matrix encode_matrix
ec_init_tables(k, m - k, &encode_matrix[k * k], g_tbls);
ec_init_tables_base(k, m - k, &encode_matrix[k * k], g_tbls);
// Perform matrix dot_prod for EC encoding
// using g_tbls from encode matrix encode_matrix
@ -304,7 +304,7 @@ int main(int argc, char *argv[])
}
// Recover data
ec_init_tables(k, nerrs, decode_matrix, g_tbls);
ec_init_tables_base(k, nerrs, decode_matrix, g_tbls);
ec_encode_data_base(TEST_LEN, k, nerrs, g_tbls, recov, &temp_buffs[k]);
for (i = 0; i < nerrs; i++) {
@ -346,7 +346,7 @@ int main(int argc, char *argv[])
gf_gen_cauchy1_matrix(encode_matrix, m, k);
// Generate g_tbls from encode matrix encode_matrix
ec_init_tables(k, m - k, &encode_matrix[k * k], g_tbls);
ec_init_tables_base(k, m - k, &encode_matrix[k * k], g_tbls);
// Perform matrix dot_prod for EC encoding
// using g_tbls from encode matrix encode_matrix
@ -372,7 +372,7 @@ int main(int argc, char *argv[])
}
// Recover data
ec_init_tables(k, nerrs, decode_matrix, g_tbls);
ec_init_tables_base(k, nerrs, decode_matrix, g_tbls);
ec_encode_data_base(TEST_LEN, k, nerrs, g_tbls, recov, &temp_buffs[k]);
for (i = 0; i < nerrs; i++) {
@ -417,7 +417,7 @@ int main(int argc, char *argv[])
// Make parity vects
// Generate g_tbls from encode matrix a
ec_init_tables(k, m - k, &encode_matrix[k * k], g_tbls);
ec_init_tables_base(k, m - k, &encode_matrix[k * k], g_tbls);
// Perform matrix dot_prod for EC encoding
// using g_tbls from encode matrix a
ec_encode_data_base(TEST_LEN, k, m - k, g_tbls, buffs, &buffs[k]);
@ -442,7 +442,7 @@ int main(int argc, char *argv[])
}
// Recover data
ec_init_tables(k, nerrs, decode_matrix, g_tbls);
ec_init_tables_base(k, nerrs, decode_matrix, g_tbls);
ec_encode_data_base(TEST_LEN, k, nerrs, g_tbls, recov, &temp_buffs[k]);
for (i = 0; i < nerrs; i++) {
@ -500,7 +500,7 @@ int main(int argc, char *argv[])
// Make parity vects
// Generate g_tbls from encode matrix a
ec_init_tables(k, m - k, &encode_matrix[k * k], g_tbls);
ec_init_tables_base(k, m - k, &encode_matrix[k * k], g_tbls);
// Perform matrix dot_prod for EC encoding
// using g_tbls from encode matrix a
ec_encode_data_base(size, k, m - k, g_tbls, efence_buffs,
@ -526,7 +526,7 @@ int main(int argc, char *argv[])
}
// Recover data
ec_init_tables(k, nerrs, decode_matrix, g_tbls);
ec_init_tables_base(k, nerrs, decode_matrix, g_tbls);
ec_encode_data_base(size, k, nerrs, g_tbls, recov, &temp_buffs[k]);
for (i = 0; i < nerrs; i++) {
@ -593,7 +593,7 @@ int main(int argc, char *argv[])
// Make parity vects
// Generate g_tbls from encode matrix a
ec_init_tables(k, m - k, &encode_matrix[k * k], g_tbls);
ec_init_tables_base(k, m - k, &encode_matrix[k * k], g_tbls);
// Perform matrix dot_prod for EC encoding
// using g_tbls from encode matrix a
ec_encode_data_base(size, k, m - k, g_tbls, ubuffs, &ubuffs[k]);
@ -618,7 +618,7 @@ int main(int argc, char *argv[])
}
// Recover data
ec_init_tables(k, nerrs, decode_matrix, g_tbls);
ec_init_tables_base(k, nerrs, decode_matrix, g_tbls);
ec_encode_data_base(size, k, nerrs, g_tbls, recov, &temp_ubuffs[k]);
for (i = 0; i < nerrs; i++) {
@ -705,7 +705,7 @@ int main(int argc, char *argv[])
// Make parity vects
// Generate g_tbls from encode matrix a
ec_init_tables(k, m - k, &encode_matrix[k * k], g_tbls);
ec_init_tables_base(k, m - k, &encode_matrix[k * k], g_tbls);
// Perform matrix dot_prod for EC encoding
// using g_tbls from encode matrix a
ec_encode_data_base(size, k, m - k, g_tbls, buffs, &buffs[k]);
@ -729,7 +729,7 @@ int main(int argc, char *argv[])
}
// Recover data
ec_init_tables(k, nerrs, decode_matrix, g_tbls);
ec_init_tables_base(k, nerrs, decode_matrix, g_tbls);
ec_encode_data_base(size, k, nerrs, g_tbls, recov, &temp_buffs[k]);
for (i = 0; i < nerrs; i++) {

View File

@ -73,6 +73,14 @@ extern "C" {
void ec_init_tables(int k, int rows, unsigned char* a, unsigned char* gftbls);
/**
* @brief Initialize tables for fast Erasure Code encode and decode, runs baseline version.
*
* Baseline version of ec_encode_data() with same parameters.
*/
void ec_init_tables_base(int k, int rows, unsigned char* a, unsigned char* gftbls);
/**
* @brief Generate or decode erasure codes on blocks of data, runs appropriate version.
*

View File

@ -120,3 +120,4 @@ crc64_rocksoft_norm_base @115
crc64_rocksoft_refl_base @116
crc64_rocksoft_norm @117
crc64_rocksoft_refl @118
ec_init_tables_base @119