Blame SOURCES/genwqe-user-4.0.18-fix-for-genweq_chksum.patch

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