Auto-detect missing hw support for crc32c and fallback to software
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
diff --git a/options.c b/options.c
index f470b45..fb18748 100644
--- a/options.c
+++ b/options.c
@@ -16,6 +16,8 @@
#include "lib/fls.h"
#include "options.h"
+#include "crc/crc32c.h"
+
/*
* Check if mmap/mmaphuge has a :/foo/bar/file at the end. If so, return that.
*/
@@ -225,6 +227,21 @@
return 0;
}
+static int str_verify_cb(void *data, const char *mem)
+{
+ struct thread_data *td = data;
+
+ if (td->o.verify != VERIFY_CRC32C_INTEL)
+ return 0;
+
+ if (!crc32c_intel_works()) {
+ log_info("fio: System does not support hw accelerated crc32c. Falling back to sw crc32c.\n");
+ td->o.verify = VERIFY_CRC32C;
+ }
+
+ return 0;
+}
+
static int fio_clock_source_cb(void *data, const char *str)
{
struct thread_data *td = data;
@@ -1298,6 +1315,7 @@
.type = FIO_OPT_STR,
.off1 = td_var_offset(verify),
.help = "Verify data written",
+ .cb = str_verify_cb,
.def = "0",
.posval = {
{ .ival = "0",