xref: /illumos-gate/usr/src/cmd/raidz_test/raidz_test.h (revision fd5e5f438a15881f651587df3e961609eb00778d)
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  * Copyright 2020 Joyent, Inc.
25  */
26 
27 #ifndef	RAIDZ_TEST_H
28 #define	RAIDZ_TEST_H
29 
30 #include <sys/spa.h>
31 
32 static const char *raidz_impl_names[] = {
33 	"original",
34 	"scalar",
35 	"sse2",
36 	"ssse3",
37 	"avx2",
38 	"avx512f",
39 	"avx512bw",
40 	"aarch64_neon",
41 	"aarch64_neonx2",
42 	"powerpc_altivec",
43 	NULL
44 };
45 
46 typedef struct raidz_test_opts {
47 	size_t rto_ashift;
48 	size_t rto_offset;
49 	size_t rto_dcols;
50 	size_t rto_dsize;
51 	size_t rto_v;
52 	size_t rto_sweep;
53 	size_t rto_sweep_timeout;
54 	size_t rto_benchmark;
55 	size_t rto_sanity;
56 	size_t rto_gdb;
57 
58 	/* non-user options */
59 	boolean_t rto_should_stop;
60 
61 	zio_t *zio_golden;
62 	raidz_map_t *rm_golden;
63 } raidz_test_opts_t;
64 
65 static const raidz_test_opts_t rto_opts_defaults = {
66 	.rto_ashift = 9,
67 	.rto_offset = 1ULL << 0,
68 	.rto_dcols = 8,
69 	.rto_dsize = 1<<19,
70 	.rto_v = 0,
71 	.rto_sweep = 0,
72 	.rto_benchmark = 0,
73 	.rto_sanity = 0,
74 	.rto_gdb = 0,
75 	.rto_should_stop = B_FALSE
76 };
77 
78 extern raidz_test_opts_t rto_opts;
79 
80 #define	D_ALL	0
81 #define	D_INFO	1
82 #define	D_DEBUG	2
83 
84 #define	LOG(lvl, a...)				\
85 {						\
86 	if (rto_opts.rto_v >= lvl)		\
87 		(void) fprintf(stdout, a);	\
88 }						\
89 
90 #define	LOG_OPT(lvl, opt, a...)			\
91 {						\
92 	if (opt->rto_v >= lvl)			\
93 		(void) fprintf(stdout, a);	\
94 }						\
95 
96 #define	ERRMSG(a...)	(void) fprintf(stderr, a)
97 
98 
99 #define	DBLSEP "================\n"
100 #define	SEP    "----------------\n"
101 
102 
103 #define	raidz_alloc(size)	abd_alloc(size, B_FALSE)
104 #define	raidz_free(p, size)	abd_free(p)
105 
106 
107 void init_zio_abd(zio_t *zio);
108 
109 void run_raidz_benchmark(void);
110 
111 #endif /* RAIDZ_TEST_H */
112