mirror of
https://github.com/intel/isa-l.git
synced 2024-12-13 09:52:56 +01:00
raid: Fix doc and base functions for min sources
The raid functions xor_gen, pq_gen and check functions must have at least two sources. Fixes #175 Change-Id: I2e4509e037c2b1dc88f3f7449d80f4c763e1e124 Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
This commit is contained in:
parent
ebb78fc99e
commit
2c705a26cb
@ -52,7 +52,7 @@ extern "C" {
|
||||
* This function determines what instruction sets are enabled and
|
||||
* selects the appropriate version at runtime.
|
||||
*
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 2.
|
||||
* @param len Length of each vector in bytes.
|
||||
* @param array Array of pointers to source and dest. For XOR the dest is
|
||||
* the last pointer. ie array[vects-1]. Src and dest
|
||||
@ -70,7 +70,7 @@ int xor_gen(int vects, int len, void **array);
|
||||
* This function determines what instruction sets are enabled and
|
||||
* selects the appropriate version at runtime.
|
||||
*
|
||||
* @param vects Number of vectors in array.
|
||||
* @param vects Number of vectors in array. Must be > 1.
|
||||
* @param len Length of each vector in bytes.
|
||||
* @param array Array of pointers to vectors. Src and dest pointers
|
||||
* must be aligned to 16B.
|
||||
@ -87,7 +87,7 @@ int xor_check(int vects, int len, void **array);
|
||||
* This function determines what instruction sets are enabled and
|
||||
* selects the appropriate version at runtime.
|
||||
*
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 32B aligned.
|
||||
* @param array Array of pointers to source and dest. For P+Q the dest
|
||||
* is the last two pointers. ie array[vects-2],
|
||||
@ -107,7 +107,7 @@ int pq_gen(int vects, int len, void **array);
|
||||
* This function determines what instruction sets are enabled and
|
||||
* selects the appropriate version at runtime.
|
||||
*
|
||||
* @param vects Number of vectors in array including P&Q.
|
||||
* @param vects Number of vectors in array including P&Q. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 16B aligned.
|
||||
* @param array Array of pointers to source and P, Q. P and Q parity
|
||||
* are assumed to be the last two pointers in the array.
|
||||
@ -127,7 +127,7 @@ int pq_check(int vects, int len, void **array);
|
||||
* @brief Generate XOR parity vector from N sources.
|
||||
* @requires SSE4.1
|
||||
*
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 2.
|
||||
* @param len Length of each vector in bytes.
|
||||
* @param array Array of pointers to source and dest. For XOR the dest is
|
||||
* the last pointer. ie array[vects-1]. Src and dest pointers
|
||||
@ -143,7 +143,7 @@ int xor_gen_sse(int vects, int len, void **array);
|
||||
* @brief Generate XOR parity vector from N sources.
|
||||
* @requires AVX
|
||||
*
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 2.
|
||||
* @param len Length of each vector in bytes.
|
||||
* @param array Array of pointers to source and dest. For XOR the dest is
|
||||
* the last pointer. ie array[vects-1]. Src and dest pointers
|
||||
@ -159,7 +159,7 @@ int xor_gen_avx(int vects, int len, void **array);
|
||||
* @brief Checks that array has XOR parity sum of 0 across all vectors.
|
||||
* @requires SSE4.1
|
||||
*
|
||||
* @param vects Number of vectors in array.
|
||||
* @param vects Number of vectors in array. Must be > 1.
|
||||
* @param len Length of each vector in bytes.
|
||||
* @param array Array of pointers to vectors. Src and dest pointers
|
||||
* must be aligned to 16B.
|
||||
@ -174,7 +174,7 @@ int xor_check_sse(int vects, int len, void **array);
|
||||
* @brief Generate P+Q parity vectors from N sources.
|
||||
* @requires SSE4.1
|
||||
*
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 16B aligned.
|
||||
* @param array Array of pointers to source and dest. For P+Q the dest
|
||||
* is the last two pointers. ie array[vects-2],
|
||||
@ -192,7 +192,7 @@ int pq_gen_sse(int vects, int len, void **array);
|
||||
* @brief Generate P+Q parity vectors from N sources.
|
||||
* @requires AVX
|
||||
*
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 16B aligned.
|
||||
* @param array Array of pointers to source and dest. For P+Q the dest
|
||||
* is the last two pointers. ie array[vects-2],
|
||||
@ -210,7 +210,7 @@ int pq_gen_avx(int vects, int len, void **array);
|
||||
* @brief Generate P+Q parity vectors from N sources.
|
||||
* @requires AVX2
|
||||
*
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 32B aligned.
|
||||
* @param array Array of pointers to source and dest. For P+Q the dest
|
||||
* is the last two pointers. ie array[vects-2],
|
||||
@ -228,7 +228,7 @@ int pq_gen_avx2(int vects, int len, void **array);
|
||||
* @brief Checks that array of N sources, P and Q are consistent across all vectors.
|
||||
* @requires SSE4.1
|
||||
*
|
||||
* @param vects Number of vectors in array including P&Q.
|
||||
* @param vects Number of vectors in array including P&Q. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 16B aligned.
|
||||
* @param array Array of pointers to source and P, Q. P and Q parity
|
||||
are assumed to be the last two pointers in the array.
|
||||
@ -242,7 +242,7 @@ int pq_check_sse(int vects, int len, void **array);
|
||||
|
||||
/**
|
||||
* @brief Generate P+Q parity vectors from N sources, runs baseline version.
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 16B aligned.
|
||||
* @param array Array of pointers to source and dest. For P+Q the dest
|
||||
* is the last two pointers. ie array[vects-2],
|
||||
@ -258,7 +258,7 @@ int pq_gen_base(int vects, int len, void **array);
|
||||
|
||||
/**
|
||||
* @brief Generate XOR parity vector from N sources, runs baseline version.
|
||||
* @param vects Number of source+dest vectors in array.
|
||||
* @param vects Number of source+dest vectors in array. Must be > 2.
|
||||
* @param len Length of each vector in bytes.
|
||||
* @param array Array of pointers to source and dest. For XOR the dest is
|
||||
* the last pointer. ie array[vects-1]. Src and dest pointers
|
||||
@ -273,7 +273,7 @@ int xor_gen_base(int vects, int len, void **array);
|
||||
/**
|
||||
* @brief Checks that array has XOR parity sum of 0 across all vectors, runs baseline version.
|
||||
*
|
||||
* @param vects Number of vectors in array.
|
||||
* @param vects Number of vectors in array. Must be > 1.
|
||||
* @param len Length of each vector in bytes.
|
||||
* @param array Array of pointers to vectors. Src and dest pointers
|
||||
* must be aligned to 16B.
|
||||
@ -287,7 +287,7 @@ int xor_check_base(int vects, int len, void **array);
|
||||
/**
|
||||
* @brief Checks that array of N sources, P and Q are consistent across all vectors, runs baseline version.
|
||||
*
|
||||
* @param vects Number of vectors in array including P&Q.
|
||||
* @param vects Number of vectors in array including P&Q. Must be > 3.
|
||||
* @param len Length of each vector in bytes. Must be 16B aligned.
|
||||
* @param array Array of pointers to source and P, Q. P and Q parity
|
||||
* are assumed to be the last two pointers in the array.
|
||||
|
@ -47,6 +47,9 @@ int pq_gen_base(int vects, int len, void **array)
|
||||
unsigned long **src = (unsigned long **)array;
|
||||
int blocks = len / sizeof(long);
|
||||
|
||||
if (vects < 4)
|
||||
return 1; // Must have at least 2 src and 2 dest
|
||||
|
||||
for (i = 0; i < blocks; i++) {
|
||||
q = p = src[vects - 3][i];
|
||||
|
||||
@ -69,6 +72,9 @@ int pq_check_base(int vects, int len, void **array)
|
||||
unsigned char p, q, s;
|
||||
unsigned char **src = (unsigned char **)array;
|
||||
|
||||
if (vects < 4)
|
||||
return 1; // Must have at least 2 src and 2 dest
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
q = p = src[vects - 3][i];
|
||||
|
||||
@ -94,6 +100,9 @@ int xor_gen_base(int vects, int len, void **array)
|
||||
unsigned char parity;
|
||||
unsigned char **src = (unsigned char **)array;
|
||||
|
||||
if (vects < 3)
|
||||
return 1; // Must have at least 2 src and 1 dest
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
parity = src[0][i];
|
||||
for (j = 1; j < vects - 1; j++)
|
||||
@ -113,6 +122,9 @@ int xor_check_base(int vects, int len, void **array)
|
||||
unsigned char parity;
|
||||
unsigned char **src = (unsigned char **)array;
|
||||
|
||||
if (vects < 2)
|
||||
return 1; // Must have at least 2 src
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
parity = 0;
|
||||
for (j = 0; j < vects; j++)
|
||||
|
Loading…
Reference in New Issue
Block a user