|
|
b38c1b |
diff -up genwqe-user-4.0.18/include/libcard.h.than genwqe-user-4.0.18/include/libcard.h
|
|
|
b38c1b |
--- genwqe-user-4.0.18/include/libcard.h.than 2018-01-08 17:27:16.700411025 +0100
|
|
|
b38c1b |
+++ genwqe-user-4.0.18/include/libcard.h 2018-01-08 17:27:37.967613946 +0100
|
|
|
b38c1b |
@@ -46,8 +46,6 @@ extern "C" {
|
|
|
b38c1b |
/** Version Information and Error Codes */
|
|
|
b38c1b |
/*****************************************************************************/
|
|
|
b38c1b |
|
|
|
b38c1b |
-#define GENWQE_LIB_VERS_STRING "3.0.23"
|
|
|
b38c1b |
-
|
|
|
b38c1b |
/**< library error codes */
|
|
|
b38c1b |
#define GENWQE_OK 0
|
|
|
b38c1b |
#define GENWQE_ERRNO (-201)
|
|
|
b38c1b |
diff -up genwqe-user-4.0.18/tools/genwqe_cksum.c.than genwqe-user-4.0.18/tools/genwqe_cksum.c
|
|
|
b38c1b |
--- genwqe-user-4.0.18/tools/genwqe_cksum.c.than 2018-01-08 17:27:48.265227999 +0100
|
|
|
b38c1b |
+++ genwqe-user-4.0.18/tools/genwqe_cksum.c 2018-01-08 21:58:31.043951221 +0100
|
|
|
b38c1b |
@@ -1,5 +1,5 @@
|
|
|
b38c1b |
/*
|
|
|
b38c1b |
- * Copyright 2015, International Business Machines
|
|
|
b38c1b |
+ * Copyright 2017, International Business Machines
|
|
|
b38c1b |
*
|
|
|
b38c1b |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
b38c1b |
* you may not use this file except in compliance with the License.
|
|
|
b38c1b |
@@ -21,11 +21,13 @@
|
|
|
b38c1b |
#include <time.h>
|
|
|
b38c1b |
#include <signal.h>
|
|
|
b38c1b |
#include <zlib.h>
|
|
|
b38c1b |
+#include <time.h>
|
|
|
b38c1b |
#include <sys/time.h>
|
|
|
b38c1b |
#include <asm/byteorder.h>
|
|
|
b38c1b |
|
|
|
b38c1b |
#include <sched.h>
|
|
|
b38c1b |
|
|
|
b38c1b |
+#include "libddcb.h"
|
|
|
b38c1b |
#include "genwqe_tools.h"
|
|
|
b38c1b |
#include "force_cpu.h"
|
|
|
b38c1b |
#include "libcard.h"
|
|
|
b38c1b |
@@ -34,11 +36,19 @@
|
|
|
b38c1b |
int verbose_flag = 0;
|
|
|
b38c1b |
static int debug_flag = 0;
|
|
|
b38c1b |
|
|
|
b38c1b |
-static int DATA_BUF_SIZE = 4096 * 512;
|
|
|
b38c1b |
-static int use_sglist = 0;
|
|
|
b38c1b |
-static int use_adler32 = 0;
|
|
|
b38c1b |
-static int check_result = 0;
|
|
|
b38c1b |
-static const char *version = GENWQE_LIB_VERS_STRING;
|
|
|
b38c1b |
+#define DEFAULT_DATA_BUF_SIZE (2 * 1024 * 1024) // 2 MB Buffer
|
|
|
b38c1b |
+
|
|
|
b38c1b |
+static const char *version = GIT_VERSION;
|
|
|
b38c1b |
+
|
|
|
b38c1b |
+static uint64_t get_us(void)
|
|
|
b38c1b |
+{
|
|
|
b38c1b |
+ uint64_t t;
|
|
|
b38c1b |
+ struct timespec now;
|
|
|
b38c1b |
+
|
|
|
b38c1b |
+ clock_gettime(CLOCK_MONOTONIC_RAW, &now;;
|
|
|
b38c1b |
+ t = now.tv_sec * 1000000 + now.tv_nsec / 1000;
|
|
|
b38c1b |
+ return t;
|
|
|
b38c1b |
+}
|
|
|
b38c1b |
|
|
|
b38c1b |
/**
|
|
|
b38c1b |
* @brief prints valid command line options
|
|
|
b38c1b |
@@ -48,15 +58,16 @@ static const char *version = GENWQE_LIB_
|
|
|
b38c1b |
static void usage(const char *prog)
|
|
|
b38c1b |
{
|
|
|
b38c1b |
printf("Usage: %s [-h] [-v, --verbose] [-C, --card <cardno>|RED]\n"
|
|
|
b38c1b |
- "\t[-V, --version]\n"
|
|
|
b38c1b |
- "\t[-X, --cpu <only run on this CPU number>]\n"
|
|
|
b38c1b |
- "\t[-D, --debug <create extended debug data on failure>]\n"
|
|
|
b38c1b |
- "\t[-G, --use-sglist use the scatter gather list support]\n"
|
|
|
b38c1b |
- "\t[-c, --check-result] check result against the software\n"
|
|
|
b38c1b |
- "\t[-s, --bufsize <bufsize/default is 4KiB>]\n"
|
|
|
b38c1b |
- "\t[-a, --adler32] use adler32 instead of crc32\n"
|
|
|
b38c1b |
- "\t[-i, --pgoffs_i <offs>] byte offset for input buffer\n"
|
|
|
b38c1b |
- "\t[FILE]...\n"
|
|
|
b38c1b |
+ "\t-C, --card <cardno> use cardno for operation (default 0)\n"
|
|
|
b38c1b |
+ "\t-A, --accel = GENWQE | CAPI. (CAPI only for ppc64le)\n"
|
|
|
b38c1b |
+ "\t-V, --version show Software Version\n"
|
|
|
b38c1b |
+ "\t-X, --cpu <only run on this CPU number>\n"
|
|
|
b38c1b |
+ "\t-D, --debug <create extended debug data on failure>\n"
|
|
|
b38c1b |
+ "\t-G, --use-sglist use the scatter gather list support\n"
|
|
|
b38c1b |
+ "\t-c, --check-result] check result against the software\n"
|
|
|
b38c1b |
+ "\t-s, --bufsize <bufsize/default is 4KiB>\n"
|
|
|
b38c1b |
+ "\t-a, --adler32 use adler32 instead of crc32\n"
|
|
|
b38c1b |
+ "\tFILE...\n"
|
|
|
b38c1b |
"\n"
|
|
|
b38c1b |
"This utility sends memcopy/checksum DDCBs to the application\n"
|
|
|
b38c1b |
"chip unit. The CRC32 is compatible to zlib. The UNIX program\n"
|
|
|
b38c1b |
@@ -88,23 +99,24 @@ static inline uint64_t str_to_num(char *
|
|
|
b38c1b |
return num;
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
-static int genwqe_card_cksum(card_handle_t card,
|
|
|
b38c1b |
- struct genwqe_ddcb_cmd *cmd,
|
|
|
b38c1b |
- void *src, size_t n,
|
|
|
b38c1b |
+static int accel_cksum(accel_t accel,
|
|
|
b38c1b |
+ struct ddcb_cmd *cmd,
|
|
|
b38c1b |
+ void *src, void *dest, size_t n,
|
|
|
b38c1b |
uint32_t *crc32,
|
|
|
b38c1b |
uint32_t *adler32,
|
|
|
b38c1b |
uint32_t *inp_processed,
|
|
|
b38c1b |
- struct genwqe_debug_data *debug_data)
|
|
|
b38c1b |
+ int use_sglist)
|
|
|
b38c1b |
{
|
|
|
b38c1b |
int rc;
|
|
|
b38c1b |
struct asiv_memcpy *asiv;
|
|
|
b38c1b |
struct asv_memcpy *asv;
|
|
|
b38c1b |
+ uint64_t ats_type;
|
|
|
b38c1b |
|
|
|
b38c1b |
- genwqe_ddcb_cmd_init(cmd);
|
|
|
b38c1b |
- cmd->ddata_addr = (unsigned long)debug_data;
|
|
|
b38c1b |
+ ddcb_cmd_init(cmd);
|
|
|
b38c1b |
+ cmd->ddata_addr = 0ull;
|
|
|
b38c1b |
cmd->acfunc = DDCB_ACFUNC_APP; /* goto accelerator */
|
|
|
b38c1b |
cmd->cmd = ZCOMP_CMD_ZEDC_MEMCOPY;
|
|
|
b38c1b |
- cmd->cmdopts = 0x0001; /* discard output for cksum */
|
|
|
b38c1b |
+ cmd->cmdopts = 0x0000; /* use memcopy */
|
|
|
b38c1b |
cmd->asiv_length= 0x40 - 0x20;
|
|
|
b38c1b |
cmd->asv_length = 0xC0 - 0x80; /* try to absorb all */
|
|
|
b38c1b |
|
|
|
b38c1b |
@@ -112,37 +124,56 @@ static int genwqe_card_cksum(card_handle
|
|
|
b38c1b |
asiv = (struct asiv_memcpy *)&cmd->asiv;
|
|
|
b38c1b |
asiv->inp_buff = __cpu_to_be64((unsigned long)src);
|
|
|
b38c1b |
asiv->inp_buff_len = __cpu_to_be32((uint32_t)n);
|
|
|
b38c1b |
- asiv->outp_buff = __cpu_to_be64(0);
|
|
|
b38c1b |
- asiv->outp_buff_len = __cpu_to_be32(0);
|
|
|
b38c1b |
+ asiv->outp_buff = __cpu_to_be64((unsigned long)dest);
|
|
|
b38c1b |
+ asiv->outp_buff_len = __cpu_to_be32((uint32_t)n);
|
|
|
b38c1b |
asiv->in_adler32 = __cpu_to_be32(*adler32);
|
|
|
b38c1b |
asiv->in_crc32 = __cpu_to_be32(*crc32);
|
|
|
b38c1b |
|
|
|
b38c1b |
- if (use_sglist) {
|
|
|
b38c1b |
- cmd->ats = __cpu_to_be64(
|
|
|
b38c1b |
- ATS_SET_FLAGS(struct asiv_memcpy, inp_buff,
|
|
|
b38c1b |
- ATS_TYPE_SGL_RD));
|
|
|
b38c1b |
- } else {
|
|
|
b38c1b |
- cmd->ats = __cpu_to_be64(
|
|
|
b38c1b |
- ATS_SET_FLAGS(struct asiv_memcpy, inp_buff,
|
|
|
b38c1b |
- ATS_TYPE_FLAT_RD));
|
|
|
b38c1b |
+ if (use_sglist)
|
|
|
b38c1b |
+ ats_type = ATS_TYPE_SGL_RD;
|
|
|
b38c1b |
+ else ats_type = ATS_TYPE_FLAT_RD;
|
|
|
b38c1b |
+ cmd->ats = ATS_SET_FLAGS(struct asiv_memcpy, inp_buff, ats_type);
|
|
|
b38c1b |
+ if (use_sglist)
|
|
|
b38c1b |
+ ats_type = ATS_TYPE_SGL_RDWR;
|
|
|
b38c1b |
+ else ats_type = ATS_TYPE_FLAT_RDWR;
|
|
|
b38c1b |
+ cmd->ats |= ATS_SET_FLAGS(struct asiv_memcpy, outp_buff, ats_type);
|
|
|
b38c1b |
+
|
|
|
b38c1b |
+ if (verbose_flag) {
|
|
|
b38c1b |
+ fprintf(stderr, "ATS: 0x%llx use_sglist: %d\n", (long long)cmd->ats, use_sglist);
|
|
|
b38c1b |
+ fprintf(stderr, "Src: %p\n", src);
|
|
|
b38c1b |
+ fprintf(stderr, "Dest: %p\n", dest);
|
|
|
b38c1b |
+ fprintf(stderr, "Len: 0x%x\n", (uint32_t)n);
|
|
|
b38c1b |
+ }
|
|
|
b38c1b |
+
|
|
|
b38c1b |
+ if (verbose_flag > 1) {
|
|
|
b38c1b |
+ fprintf(stderr, "\n Dump Data @ %p\n", cmd);
|
|
|
b38c1b |
+ ddcb_hexdump(stderr, cmd, sizeof(struct ddcb_cmd));
|
|
|
b38c1b |
+ }
|
|
|
b38c1b |
+ cmd->disp_ts = get_us(); /* @ 0x30 SW Usage */
|
|
|
b38c1b |
+ rc = accel_ddcb_execute(accel, cmd, NULL, NULL);
|
|
|
b38c1b |
+ cmd->disp_ts = get_us() - cmd->disp_ts;
|
|
|
b38c1b |
+ if (verbose_flag > 1) {
|
|
|
b38c1b |
+ fprintf(stderr, "\n Dump Data @ %p\n", cmd);
|
|
|
b38c1b |
+ ddcb_hexdump(stderr, cmd, sizeof(struct ddcb_cmd));
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
- rc = genwqe_card_execute_ddcb(card, cmd);
|
|
|
b38c1b |
-
|
|
|
b38c1b |
asv = (struct asv_memcpy *)&cmd->asv;
|
|
|
b38c1b |
*crc32 = __be32_to_cpu(asv->out_crc32);
|
|
|
b38c1b |
*adler32 = __be32_to_cpu(asv->out_adler32);
|
|
|
b38c1b |
*inp_processed = __be32_to_cpu(asv->inp_processed);
|
|
|
b38c1b |
|
|
|
b38c1b |
if (verbose_flag)
|
|
|
b38c1b |
- fprintf(stderr, " crc32=%u adler32=%u inp_processed=%u\n",
|
|
|
b38c1b |
- *crc32, *adler32, *inp_processed);
|
|
|
b38c1b |
+ fprintf(stderr, " crc32=%u adler32=%u inp_processed=%u in %lld usec\n",
|
|
|
b38c1b |
+ *crc32, *adler32, *inp_processed, (long long)cmd->disp_ts);
|
|
|
b38c1b |
|
|
|
b38c1b |
return rc;
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
-static int process_in_file(card_handle_t card, const char *in_f,
|
|
|
b38c1b |
- uint8_t *ibuf, int ibuf_size)
|
|
|
b38c1b |
+static int process_in_file(accel_t accel, const char *in_f,
|
|
|
b38c1b |
+ uint8_t *ibuf, void *obuf, int ibuf_size,
|
|
|
b38c1b |
+ int check_result,
|
|
|
b38c1b |
+ int use_sglist,
|
|
|
b38c1b |
+ int use_adler)
|
|
|
b38c1b |
{
|
|
|
b38c1b |
int rc, size_f;
|
|
|
b38c1b |
struct stat st;
|
|
|
b38c1b |
@@ -150,15 +181,12 @@ static int process_in_file(card_handle_t
|
|
|
b38c1b |
uint32_t crc = 0, m_crc32 = 0; /* defined start value of 0 */
|
|
|
b38c1b |
uint32_t m_adler32 = 1; /* defined start value of 1 */
|
|
|
b38c1b |
uint32_t m_inp_processed;
|
|
|
b38c1b |
- struct genwqe_ddcb_cmd cmd;
|
|
|
b38c1b |
- struct genwqe_debug_data debug_data;
|
|
|
b38c1b |
+ struct ddcb_cmd cmd;
|
|
|
b38c1b |
int xerrno;
|
|
|
b38c1b |
|
|
|
b38c1b |
if (check_result)
|
|
|
b38c1b |
crc = crc32(0L, Z_NULL, 0); /* start value */
|
|
|
b38c1b |
|
|
|
b38c1b |
- memset(&debug_data, 0, sizeof(debug_data));
|
|
|
b38c1b |
-
|
|
|
b38c1b |
if (stat(in_f, &st) == -1) {
|
|
|
b38c1b |
fprintf(stderr, "err: stat on input file (%s)\n",
|
|
|
b38c1b |
strerror(errno));
|
|
|
b38c1b |
@@ -184,19 +212,15 @@ static int process_in_file(card_handle_t
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
if (check_result)
|
|
|
b38c1b |
- crc = crc32(crc, ibuf, tocopy); /* software */
|
|
|
b38c1b |
+ crc = crc32(crc, ibuf, tocopy); /* software */
|
|
|
b38c1b |
|
|
|
b38c1b |
- rc = genwqe_card_cksum(card, &cmd, ibuf, tocopy, /* hardware */
|
|
|
b38c1b |
+ rc = accel_cksum(accel, &cmd, ibuf, obuf, tocopy, /* hardware */
|
|
|
b38c1b |
&m_crc32, &m_adler32, &m_inp_processed,
|
|
|
b38c1b |
- debug_flag ? &debug_data : NULL);
|
|
|
b38c1b |
+ use_sglist);
|
|
|
b38c1b |
xerrno = errno;
|
|
|
b38c1b |
|
|
|
b38c1b |
- if (debug_flag && verbose_flag)
|
|
|
b38c1b |
- genwqe_print_debug_data(stdout, &debug_data,
|
|
|
b38c1b |
- GENWQE_DD_ALL);
|
|
|
b38c1b |
-
|
|
|
b38c1b |
/* Did the ioctl succeed? */
|
|
|
b38c1b |
- if (rc != GENWQE_OK) {
|
|
|
b38c1b |
+ if (rc != DDCB_OK) {
|
|
|
b38c1b |
struct asv_runtime_dma_error *d;
|
|
|
b38c1b |
|
|
|
b38c1b |
fprintf(stderr,
|
|
|
b38c1b |
@@ -204,10 +228,6 @@ static int process_in_file(card_handle_t
|
|
|
b38c1b |
" errno=%d %s\n", card_strerror(rc),
|
|
|
b38c1b |
rc, xerrno, strerror(xerrno));
|
|
|
b38c1b |
|
|
|
b38c1b |
- if (debug_flag && !verbose_flag)
|
|
|
b38c1b |
- genwqe_print_debug_data(stdout, &debug_data,
|
|
|
b38c1b |
- GENWQE_DD_ALL);
|
|
|
b38c1b |
-
|
|
|
b38c1b |
fprintf(stderr, " RETC: %03x %s ATTN: %x PROGR: %x\n"
|
|
|
b38c1b |
" from card CRC32: %08x ADLER: %08x\n"
|
|
|
b38c1b |
" DEQUEUE=%016llx CMPLT=%016llx DISP=%016llx\n",
|
|
|
b38c1b |
@@ -234,14 +254,22 @@ static int process_in_file(card_handle_t
|
|
|
b38c1b |
__be16_to_cpu(d->wdmae_be16),
|
|
|
b38c1b |
__be16_to_cpu(d->wsge_be16));
|
|
|
b38c1b |
}
|
|
|
b38c1b |
- genwqe_hexdump(stderr, cmd.asv, sizeof(cmd.asv));
|
|
|
b38c1b |
+ ddcb_hexdump(stderr, cmd.asv, sizeof(cmd.asv));
|
|
|
b38c1b |
exit(EXIT_FAILURE);
|
|
|
b38c1b |
- }
|
|
|
b38c1b |
+ } else
|
|
|
b38c1b |
+ pr_info(" RETC: %03x %s ATTN: %x PROGR: %x\n"
|
|
|
b38c1b |
+ " from card CRC32: %08x ADLER: %08x\n"
|
|
|
b38c1b |
+ " DEQUEUE=%016llx CMPLT=%016llx DISP=%016llx\n",
|
|
|
b38c1b |
+ cmd.retc, retc_strerror(cmd.retc),
|
|
|
b38c1b |
+ cmd.attn, cmd.progress, m_crc32, m_adler32,
|
|
|
b38c1b |
+ (long long)cmd.deque_ts,
|
|
|
b38c1b |
+ (long long)cmd.cmplt_ts,
|
|
|
b38c1b |
+ (long long)cmd.disp_ts);
|
|
|
b38c1b |
|
|
|
b38c1b |
size_f -= tocopy;
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
- if (use_adler32)
|
|
|
b38c1b |
+ if (use_adler)
|
|
|
b38c1b |
printf("%u %llu %s\n", m_adler32, (long long)st.st_size, in_f);
|
|
|
b38c1b |
else
|
|
|
b38c1b |
printf("%u %llu %s\n", m_crc32, (long long)st.st_size, in_f);
|
|
|
b38c1b |
@@ -259,12 +287,16 @@ static int process_in_file(card_handle_t
|
|
|
b38c1b |
int main(int argc, char *argv[])
|
|
|
b38c1b |
{
|
|
|
b38c1b |
int card_no = 0, err_code;
|
|
|
b38c1b |
- card_handle_t card;
|
|
|
b38c1b |
- uint8_t *ibuf, *ibuf4k;
|
|
|
b38c1b |
+ accel_t accel;
|
|
|
b38c1b |
+ uint8_t *ibuf, *obuf;
|
|
|
b38c1b |
unsigned int page_size = sysconf(_SC_PAGESIZE);
|
|
|
b38c1b |
const char *in_f = NULL;
|
|
|
b38c1b |
int cpu = -1;
|
|
|
b38c1b |
- int pgoffs_i = 0;
|
|
|
b38c1b |
+ int card_type = DDCB_TYPE_GENWQE;
|
|
|
b38c1b |
+ int check_result = 0;
|
|
|
b38c1b |
+ int use_sglist = 0;
|
|
|
b38c1b |
+ int use_adler = 0;
|
|
|
b38c1b |
+ int data_buf_size = DEFAULT_DATA_BUF_SIZE;
|
|
|
b38c1b |
|
|
|
b38c1b |
while (1) {
|
|
|
b38c1b |
int ch;
|
|
|
b38c1b |
@@ -275,13 +307,13 @@ int main(int argc, char *argv[])
|
|
|
b38c1b |
|
|
|
b38c1b |
/* options */
|
|
|
b38c1b |
{ "card", required_argument, NULL, 'C' },
|
|
|
b38c1b |
+ { "accel", required_argument, NULL, 'A' },
|
|
|
b38c1b |
{ "cpu", required_argument, NULL, 'X' },
|
|
|
b38c1b |
{ "use-sglist", no_argument, NULL, 'G' },
|
|
|
b38c1b |
{ "use-adler32", no_argument, NULL, 'a' },
|
|
|
b38c1b |
{ "check-result", no_argument, NULL, 'c' },
|
|
|
b38c1b |
|
|
|
b38c1b |
{ "bufsize", required_argument, NULL, 's' },
|
|
|
b38c1b |
- { "pgoffs_i", required_argument, NULL, 'i' },
|
|
|
b38c1b |
|
|
|
b38c1b |
/* misc/support */
|
|
|
b38c1b |
{ "version", no_argument, NULL, 'V' },
|
|
|
b38c1b |
@@ -291,7 +323,7 @@ int main(int argc, char *argv[])
|
|
|
b38c1b |
{ 0, no_argument, NULL, 0 },
|
|
|
b38c1b |
};
|
|
|
b38c1b |
|
|
|
b38c1b |
- ch = getopt_long(argc, argv, "acC:X:Gs:i:vDVh",
|
|
|
b38c1b |
+ ch = getopt_long(argc, argv, "acC:X:Gs:A:vDVh",
|
|
|
b38c1b |
long_options, &option_index);
|
|
|
b38c1b |
if (ch == -1) /* all params processed ? */
|
|
|
b38c1b |
break;
|
|
|
b38c1b |
@@ -305,6 +337,23 @@ int main(int argc, char *argv[])
|
|
|
b38c1b |
}
|
|
|
b38c1b |
card_no = strtol(optarg, (char **)NULL, 0);
|
|
|
b38c1b |
break;
|
|
|
b38c1b |
+ case 'A':
|
|
|
b38c1b |
+ if (strcmp(optarg, "GENWQE") == 0) {
|
|
|
b38c1b |
+ card_type = DDCB_TYPE_GENWQE;
|
|
|
b38c1b |
+ break;
|
|
|
b38c1b |
+ }
|
|
|
b38c1b |
+ if (strcmp(optarg, "CAPI") == 0) {
|
|
|
b38c1b |
+ card_type = DDCB_TYPE_CAPI;
|
|
|
b38c1b |
+ break;
|
|
|
b38c1b |
+ }
|
|
|
b38c1b |
+ /* use numeric card_type value */
|
|
|
b38c1b |
+ card_type = strtol(optarg, (char **)NULL, 0);
|
|
|
b38c1b |
+ if ((DDCB_TYPE_GENWQE != card_type) &&
|
|
|
b38c1b |
+ (DDCB_TYPE_CAPI != card_type)) {
|
|
|
b38c1b |
+ usage(argv[0]);
|
|
|
b38c1b |
+ exit(EXIT_FAILURE);
|
|
|
b38c1b |
+ }
|
|
|
b38c1b |
+ break;
|
|
|
b38c1b |
case 'X':
|
|
|
b38c1b |
cpu = strtoul(optarg, (char **)NULL, 0);
|
|
|
b38c1b |
break;
|
|
|
b38c1b |
@@ -312,17 +361,13 @@ int main(int argc, char *argv[])
|
|
|
b38c1b |
use_sglist++;
|
|
|
b38c1b |
break;
|
|
|
b38c1b |
case 'a':
|
|
|
b38c1b |
- use_adler32 = 1;
|
|
|
b38c1b |
+ use_adler = 1;
|
|
|
b38c1b |
break;
|
|
|
b38c1b |
case 'c':
|
|
|
b38c1b |
check_result++;
|
|
|
b38c1b |
break;
|
|
|
b38c1b |
-
|
|
|
b38c1b |
- case 'i':
|
|
|
b38c1b |
- pgoffs_i = strtol(optarg, (char **)NULL, 0);
|
|
|
b38c1b |
- break;
|
|
|
b38c1b |
case 's':
|
|
|
b38c1b |
- DATA_BUF_SIZE = str_to_num(optarg);
|
|
|
b38c1b |
+ data_buf_size = str_to_num(optarg);
|
|
|
b38c1b |
break;
|
|
|
b38c1b |
|
|
|
b38c1b |
case 'h':
|
|
|
b38c1b |
@@ -345,46 +390,60 @@ int main(int argc, char *argv[])
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
switch_cpu(cpu, verbose_flag);
|
|
|
b38c1b |
+ ddcb_debug(verbose_flag - 1);
|
|
|
b38c1b |
genwqe_card_lib_debug(verbose_flag);
|
|
|
b38c1b |
+ if (ACCEL_REDUNDANT == card_no) {
|
|
|
b38c1b |
+ if (1 != use_sglist) {
|
|
|
b38c1b |
+ pr_info("I have to set Option -G set when in "
|
|
|
b38c1b |
+ "redundant card mode!\n");
|
|
|
b38c1b |
+ use_sglist = 1;
|
|
|
b38c1b |
+ }
|
|
|
b38c1b |
+ }
|
|
|
b38c1b |
|
|
|
b38c1b |
- card = genwqe_card_open(card_no, GENWQE_MODE_RDWR, &err_code,
|
|
|
b38c1b |
- 0x475a4950, GENWQE_APPL_ID_MASK);
|
|
|
b38c1b |
- if (card == NULL) {
|
|
|
b38c1b |
- printf("err: genwqe card: %s/%d; %s\n",
|
|
|
b38c1b |
- card_strerror(err_code), err_code, strerror(errno));
|
|
|
b38c1b |
+ accel = accel_open(card_no, card_type, DDCB_MODE_RDWR | DDCB_MODE_ASYNC,
|
|
|
b38c1b |
+ &err_code, 0, DDCB_APPL_ID_IGNORE);
|
|
|
b38c1b |
+ if (accel == NULL) {
|
|
|
b38c1b |
+ printf("Err: (card: %d type: %d) Faild to open card:%s/%d; %s\n",
|
|
|
b38c1b |
+ card_no, card_type,
|
|
|
b38c1b |
+ card_strerror(err_code), err_code, strerror(errno));
|
|
|
b38c1b |
exit(EXIT_FAILURE);
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
if (use_sglist) {
|
|
|
b38c1b |
- ibuf4k = memalign(page_size, DATA_BUF_SIZE + pgoffs_i);
|
|
|
b38c1b |
+ ibuf = memalign(page_size, data_buf_size);
|
|
|
b38c1b |
+ obuf = memalign(page_size, data_buf_size);
|
|
|
b38c1b |
if (use_sglist > 1) {
|
|
|
b38c1b |
- genwqe_pin_memory(card, ibuf4k, DATA_BUF_SIZE +
|
|
|
b38c1b |
- pgoffs_i, 0);
|
|
|
b38c1b |
+ accel_pin_memory(accel, ibuf, data_buf_size, 0);
|
|
|
b38c1b |
+ accel_pin_memory(accel, obuf, data_buf_size, 0);
|
|
|
b38c1b |
}
|
|
|
b38c1b |
} else {
|
|
|
b38c1b |
- ibuf4k = genwqe_card_malloc(card, DATA_BUF_SIZE + pgoffs_i);
|
|
|
b38c1b |
+ ibuf = accel_malloc(accel, data_buf_size);
|
|
|
b38c1b |
+ obuf = accel_malloc(accel, data_buf_size);
|
|
|
b38c1b |
}
|
|
|
b38c1b |
- if (DATA_BUF_SIZE != 0 && ibuf4k == NULL) {
|
|
|
b38c1b |
+
|
|
|
b38c1b |
+ if ((ibuf == NULL) || (obuf == NULL)) {
|
|
|
b38c1b |
pr_err("cannot allocate memory\n");
|
|
|
b38c1b |
exit(EXIT_FAILURE);
|
|
|
b38c1b |
}
|
|
|
b38c1b |
- ibuf = ibuf4k + pgoffs_i;
|
|
|
b38c1b |
|
|
|
b38c1b |
while (optind < argc) { /* input file */
|
|
|
b38c1b |
in_f = argv[optind++];
|
|
|
b38c1b |
- process_in_file(card, in_f, ibuf, DATA_BUF_SIZE);
|
|
|
b38c1b |
+ process_in_file(accel, in_f, ibuf, obuf, data_buf_size,
|
|
|
b38c1b |
+ check_result, use_sglist, use_adler);
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
if (use_sglist) {
|
|
|
b38c1b |
if (use_sglist > 1) {
|
|
|
b38c1b |
- genwqe_unpin_memory(card, ibuf4k, DATA_BUF_SIZE +
|
|
|
b38c1b |
- pgoffs_i);
|
|
|
b38c1b |
+ accel_unpin_memory(accel, ibuf, data_buf_size);
|
|
|
b38c1b |
+ accel_unpin_memory(accel, obuf, data_buf_size);
|
|
|
b38c1b |
}
|
|
|
b38c1b |
- free(ibuf4k);
|
|
|
b38c1b |
+ free(ibuf);
|
|
|
b38c1b |
+ free(obuf);
|
|
|
b38c1b |
} else {
|
|
|
b38c1b |
- genwqe_card_free(card, ibuf4k, DATA_BUF_SIZE + pgoffs_i);
|
|
|
b38c1b |
+ accel_free(accel, ibuf, data_buf_size);
|
|
|
b38c1b |
+ accel_free(accel, obuf, data_buf_size);
|
|
|
b38c1b |
}
|
|
|
b38c1b |
|
|
|
b38c1b |
- genwqe_card_close(card);
|
|
|
b38c1b |
+ accel_close(accel);
|
|
|
b38c1b |
exit(EXIT_SUCCESS);
|
|
|
b38c1b |
}
|