summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/ec/src/ec-gf.h
diff options
context:
space:
mode:
authorXavier Hernandez <xhernandez@datalab.es>2014-08-04 20:50:31 +0200
committerVijay Bellur <vbellur@redhat.com>2014-09-11 22:44:12 -0700
commit26be0b3a9f334f33f1a6e53706045eb02983d713 (patch)
treec72f6018f60940d1da31ad50d4f2344555a959bf /xlators/cluster/ec/src/ec-gf.h
parent5157914bac0da41cba8fef10f9dfaef209e6e865 (diff)
ec: Removed SSE2 dependency
This patch implements the Galois Field multiplications using pure C code without any assembler support. This makes the ec xlator portable to other architectures. In the future it will be possible to use an optimized implementation of the multiplications using architecture dependent facilities (it will be automatically detected and configured). To allow bricks with different machine word sizes to be able to work seamlessly in the same volume, the minimum fragment length to be stored in any brick has been fixed to 512 bytes. Otherwise, different implementations will corrupt the data (SSE2 used 128 bytes, while new implementation would have used 64). This patch also removes the '-msse2' option added on patch http://review.gluster.org/8395/ Change-Id: Iaf6e4ef3dcfda6c68f48f16ca46fc4fb61a215f4 BUG: 1125166 Signed-off-by: Xavier Hernandez <xhernandez@datalab.es> Reviewed-on: http://review.gluster.org/8413 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/ec/src/ec-gf.h')
-rw-r--r--xlators/cluster/ec/src/ec-gf.h95
1 files changed, 7 insertions, 88 deletions
diff --git a/xlators/cluster/ec/src/ec-gf.h b/xlators/cluster/ec/src/ec-gf.h
index 664feb46ce5..2563a203f08 100644
--- a/xlators/cluster/ec/src/ec-gf.h
+++ b/xlators/cluster/ec/src/ec-gf.h
@@ -18,97 +18,16 @@
<http://www.gnu.org/licenses/>.
*/
-/*
- * File automatically generated on Thu Jan 26 12:08:19 2012
- *
- * DO NOT MODIFY
- *
- * Multiplications in a GF(2^8) with modulus 0x11D using XOR's
- *
- */
-
-#ifndef __EC_GF_H__
-#define __EC_GF_H__
+#ifndef __EC_GF8_H__
+#define __EC_GF8_H__
#define EC_GF_BITS 8
#define EC_GF_MOD 0x11D
-#define ec_gf_load(addr) \
- do \
- { \
- __asm__ __volatile__ \
- ( \
- "\tmovdqa 0*16(%0), %%xmm0\n" \
- "\tmovdqa 1*16(%0), %%xmm1\n" \
- "\tmovdqa 2*16(%0), %%xmm2\n" \
- "\tmovdqa 3*16(%0), %%xmm3\n" \
- "\tmovdqa 4*16(%0), %%xmm4\n" \
- "\tmovdqa 5*16(%0), %%xmm5\n" \
- "\tmovdqa 6*16(%0), %%xmm6\n" \
- "\tmovdqa 7*16(%0), %%xmm7\n" \
- : \
- : "r" (addr) \
- : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" \
- ); \
- } while (0)
-
-#define ec_gf_store(addr) \
- do \
- { \
- __asm__ __volatile__ \
- ( \
- "\tmovdqa %%xmm0, 0*16(%0)\n" \
- "\tmovdqa %%xmm1, 1*16(%0)\n" \
- "\tmovdqa %%xmm2, 2*16(%0)\n" \
- "\tmovdqa %%xmm3, 3*16(%0)\n" \
- "\tmovdqa %%xmm4, 4*16(%0)\n" \
- "\tmovdqa %%xmm5, 5*16(%0)\n" \
- "\tmovdqa %%xmm6, 6*16(%0)\n" \
- "\tmovdqa %%xmm7, 7*16(%0)\n" \
- : \
- : "r" (addr) \
- : "memory" \
- ); \
- } while (0)
-
-#define ec_gf_clear() \
- do \
- { \
- __asm__ __volatile__ \
- ( \
- "\tpxor %xmm0, %xmm0\n" \
- "\tpxor %xmm1, %xmm1\n" \
- "\tpxor %xmm2, %xmm2\n" \
- "\tpxor %xmm3, %xmm3\n" \
- "\tpxor %xmm4, %xmm4\n" \
- "\tpxor %xmm5, %xmm5\n" \
- "\tpxor %xmm6, %xmm6\n" \
- "\tpxor %xmm7, %xmm7\n" \
- : \
- : \
- : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" \
- ); \
- } while (0)
-
-#define ec_gf_xor(addr) \
- do \
- { \
- __asm__ __volatile__ \
- ( \
- "\tpxor 0*16(%0), %%xmm0\n" \
- "\tpxor 1*16(%0), %%xmm1\n" \
- "\tpxor 2*16(%0), %%xmm2\n" \
- "\tpxor 3*16(%0), %%xmm3\n" \
- "\tpxor 4*16(%0), %%xmm4\n" \
- "\tpxor 5*16(%0), %%xmm5\n" \
- "\tpxor 6*16(%0), %%xmm6\n" \
- "\tpxor 7*16(%0), %%xmm7\n" \
- : \
- : "r" (addr) \
- : "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" \
- ); \
- } while (0)
+#define EC_GF_SIZE (1 << EC_GF_BITS)
+#define EC_GF_WORD_SIZE sizeof(uint64_t)
-extern void (* ec_gf_mul_table[])(void);
+extern void (* ec_gf_muladd[])(uint8_t * out, uint8_t * in,
+ unsigned int width);
-#endif /* __EC_GF_H__ */
+#endif /* __EC_GF8_H__ */