aboutsummaryrefslogtreecommitdiffstats
path: root/include/zfs_fletcher.h
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-10-07 12:44:12 -0700
committerGitHub <[email protected]>2016-10-07 12:44:12 -0700
commit482cd9ee69e88710e9241fac220501ea4e101d19 (patch)
tree9bb11d4140ea21a20fad830916cda2861bd47a28 /include/zfs_fletcher.h
parent48f783de792727c26f43983155bac057c296e44d (diff)
parent5bf703b8f381b6a8a89a2c251ba04dc9db59bcd6 (diff)
Fletcher4: Incremental updates and ctx calculation
Fixes ABI issues with fletcher4 code, adds support for incremental updates, and adds ztest method for testing. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Chunwei Chen <[email protected]> Signed-off-by: Gvozden Neskovic <[email protected]> Closes #5164
Diffstat (limited to 'include/zfs_fletcher.h')
-rw-r--r--include/zfs_fletcher.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/include/zfs_fletcher.h b/include/zfs_fletcher.h
index 83f92a096..85c2b5a7e 100644
--- a/include/zfs_fletcher.h
+++ b/include/zfs_fletcher.h
@@ -62,12 +62,43 @@ void fletcher_4_init(void);
void fletcher_4_fini(void);
+
+/* Internal fletcher ctx */
+
+typedef struct zfs_fletcher_sse {
+ uint64_t v[2] __attribute__((aligned(16)));
+} zfs_fletcher_sse_t;
+
+typedef struct zfs_fletcher_avx {
+ uint64_t v[4] __attribute__((aligned(32)));
+} zfs_fletcher_avx_t;
+
+typedef struct zfs_fletcher_avx512 {
+ uint64_t v[8] __attribute__((aligned(64)));
+} zfs_fletcher_avx512_t;
+
+
+typedef union fletcher_4_ctx {
+ zio_cksum_t scalar;
+
+#if defined(HAVE_SSE2) || (defined(HAVE_SSE2) && defined(HAVE_SSSE3))
+ zfs_fletcher_sse_t sse[4];
+#endif
+#if defined(HAVE_AVX) && defined(HAVE_AVX2)
+ zfs_fletcher_avx_t avx[4];
+#endif
+#if defined(__x86_64) && defined(HAVE_AVX512F)
+ zfs_fletcher_avx512_t avx512[4];
+#endif
+} fletcher_4_ctx_t;
+
/*
* fletcher checksum struct
*/
-typedef void (*fletcher_4_init_f)(zio_cksum_t *);
-typedef void (*fletcher_4_fini_f)(zio_cksum_t *);
-typedef void (*fletcher_4_compute_f)(const void *, uint64_t, zio_cksum_t *);
+typedef void (*fletcher_4_init_f)(fletcher_4_ctx_t *);
+typedef void (*fletcher_4_fini_f)(fletcher_4_ctx_t *, zio_cksum_t *);
+typedef void (*fletcher_4_compute_f)(fletcher_4_ctx_t *,
+ const void *, uint64_t);
typedef struct fletcher_4_func {
fletcher_4_init_f init_native;
@@ -80,6 +111,7 @@ typedef struct fletcher_4_func {
const char *name;
} fletcher_4_ops_t;
+
#if defined(HAVE_SSE2)
extern const fletcher_4_ops_t fletcher_4_sse2_ops;
#endif