]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - cmd/raidz_test/raidz_test.h
Add AltiVec RAID-Z
[FreeBSD/FreeBSD.git] / cmd / raidz_test / raidz_test.h
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21
22 /*
23  * Copyright (C) 2016 Gvozden Nešković. All rights reserved.
24  */
25
26 #ifndef RAIDZ_TEST_H
27 #define RAIDZ_TEST_H
28
29 #include <sys/spa.h>
30
31 static const char *raidz_impl_names[] = {
32         "original",
33         "scalar",
34         "sse2",
35         "ssse3",
36         "avx2",
37         "avx512f",
38         "avx512bw",
39         "aarch64_neon",
40         "aarch64_neonx2",
41         "powerpc_altivec",
42         NULL
43 };
44
45 typedef struct raidz_test_opts {
46         size_t rto_ashift;
47         size_t rto_offset;
48         size_t rto_dcols;
49         size_t rto_dsize;
50         size_t rto_v;
51         size_t rto_sweep;
52         size_t rto_sweep_timeout;
53         size_t rto_benchmark;
54         size_t rto_sanity;
55         size_t rto_gdb;
56
57         /* non-user options */
58         boolean_t rto_should_stop;
59
60         zio_t *zio_golden;
61         raidz_map_t *rm_golden;
62 } raidz_test_opts_t;
63
64 static const raidz_test_opts_t rto_opts_defaults = {
65         .rto_ashift = 9,
66         .rto_offset = 1ULL << 0,
67         .rto_dcols = 8,
68         .rto_dsize = 1<<19,
69         .rto_v = 0,
70         .rto_sweep = 0,
71         .rto_benchmark = 0,
72         .rto_sanity = 0,
73         .rto_gdb = 0,
74         .rto_should_stop = B_FALSE
75 };
76
77 extern raidz_test_opts_t rto_opts;
78
79 static inline size_t ilog2(size_t a)
80 {
81         return (a > 1 ? 1 + ilog2(a >> 1) : 0);
82 }
83
84
85 #define D_ALL   0
86 #define D_INFO  1
87 #define D_DEBUG 2
88
89 #define LOG(lvl, a...)                          \
90 {                                               \
91         if (rto_opts.rto_v >= lvl)              \
92                 (void) fprintf(stdout, a);      \
93 }                                               \
94
95 #define LOG_OPT(lvl, opt, a...)                 \
96 {                                               \
97         if (opt->rto_v >= lvl)                  \
98                 (void) fprintf(stdout, a);      \
99 }                                               \
100
101 #define ERR(a...)       (void) fprintf(stderr, a)
102
103
104 #define DBLSEP "================\n"
105 #define SEP    "----------------\n"
106
107
108 #define raidz_alloc(size)       abd_alloc(size, B_FALSE)
109 #define raidz_free(p, size)     abd_free(p)
110
111
112 void init_zio_abd(zio_t *zio);
113
114 void run_raidz_benchmark(void);
115
116 #endif /* RAIDZ_TEST_H */