Initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
--- a/v1.0/tool/nss_crypto_bench.c
|
||||
+++ b/v1.0/tool/nss_crypto_bench.c
|
||||
@@ -75,8 +75,8 @@ static DECLARE_WAIT_QUEUE_HEAD(tx_comp);
|
||||
static DECLARE_WAIT_QUEUE_HEAD(tx_start);
|
||||
static struct task_struct *tx_thread = NULL;
|
||||
|
||||
-static struct timeval init_time;
|
||||
-static struct timeval comp_time;
|
||||
+static struct timespec64 init_time;
|
||||
+static struct timespec64 comp_time;
|
||||
static spinlock_t op_lock;
|
||||
static nss_crypto_handle_t crypto_hdl;
|
||||
|
||||
@@ -782,7 +782,7 @@ static int crypto_bench_tx(void *arg)
|
||||
crypto_bench_debug("#");
|
||||
|
||||
/* get start time */
|
||||
- do_gettimeofday(&init_time);
|
||||
+ ktime_get_real_ts64(&init_time);
|
||||
|
||||
/**
|
||||
* Request submission
|
||||
@@ -812,8 +812,8 @@ static int crypto_bench_tx(void *arg)
|
||||
* Calculate time and output the Mbps
|
||||
*/
|
||||
|
||||
- init_usecs = (init_time.tv_sec * 1000 * 1000) + init_time.tv_usec;
|
||||
- comp_usecs = (comp_time.tv_sec * 1000 * 1000) + comp_time.tv_usec;
|
||||
+ init_usecs = (init_time.tv_sec * 1000 * 1000) + (init_time.tv_nsec / NSEC_PER_USEC);
|
||||
+ comp_usecs = (comp_time.tv_sec * 1000 * 1000) + (comp_time.tv_nsec / NSEC_PER_USEC);
|
||||
delta_usecs = comp_usecs - init_usecs;
|
||||
|
||||
reqs_completed = param.num_reqs - atomic_read(&tx_reqs);
|
||||
@@ -870,7 +870,7 @@ static void crypto_bench_done(struct nss
|
||||
nss_crypto_buf_free(crypto_hdl, buf);
|
||||
|
||||
if (atomic_dec_and_test(&tx_reqs)) {
|
||||
- do_gettimeofday(&comp_time);
|
||||
+ ktime_get_real_ts64(&comp_time);
|
||||
|
||||
wake_up_interruptible(&tx_comp);
|
||||
param.num_loops--;
|
||||
@@ -0,0 +1,57 @@
|
||||
--- a/v1.0/src/nss_crypto_if.c
|
||||
+++ b/v1.0/src/nss_crypto_if.c
|
||||
@@ -370,15 +370,16 @@ void nss_crypto_transform_done(struct ne
|
||||
struct nss_crypto_buf *buf = (struct nss_crypto_buf *)skb->data;
|
||||
struct nss_crypto_buf_node *entry;
|
||||
void *addr;
|
||||
+ struct device *cdev = gbl_crypto_ctrl.eng[0].dev;
|
||||
|
||||
if (likely(buf->data_in == buf->data_out)) {
|
||||
- dma_unmap_single(NULL, buf->data_in, buf->data_len, DMA_BIDIRECTIONAL);
|
||||
+ dma_unmap_single(cdev, buf->data_in, buf->data_len, DMA_BIDIRECTIONAL);
|
||||
} else {
|
||||
- dma_unmap_single(NULL, buf->data_in, buf->data_len, DMA_TO_DEVICE);
|
||||
- dma_unmap_single(NULL, buf->data_out, buf->data_len, DMA_FROM_DEVICE);
|
||||
+ dma_unmap_single(cdev, buf->data_in, buf->data_len, DMA_TO_DEVICE);
|
||||
+ dma_unmap_single(cdev, buf->data_out, buf->data_len, DMA_FROM_DEVICE);
|
||||
}
|
||||
|
||||
- dma_unmap_single(NULL, buf->iv_addr, L1_CACHE_BYTES, DMA_BIDIRECTIONAL);
|
||||
+ dma_unmap_single(cdev, buf->iv_addr, L1_CACHE_BYTES, DMA_BIDIRECTIONAL);
|
||||
|
||||
addr = phys_to_virt(buf->iv_addr);
|
||||
entry = container_of(addr, struct nss_crypto_buf_node, results);
|
||||
@@ -531,6 +532,7 @@ nss_crypto_status_t nss_crypto_transform
|
||||
uint32_t paddr;
|
||||
void *vaddr;
|
||||
size_t len;
|
||||
+ struct device *cdev = gbl_crypto_ctrl.eng[0].dev;
|
||||
|
||||
if (!buf->cb_fn) {
|
||||
nss_crypto_warn("%p:no buffer(%p) callback present\n", crypto, buf);
|
||||
@@ -544,7 +546,7 @@ nss_crypto_status_t nss_crypto_transform
|
||||
*/
|
||||
vaddr = (void *)buf->data_in;
|
||||
len = buf->data_len;
|
||||
- paddr = dma_map_single(NULL, vaddr, len, DMA_TO_DEVICE);
|
||||
+ paddr = dma_map_single(cdev, vaddr, len, DMA_TO_DEVICE);
|
||||
buf->data_in = paddr;
|
||||
|
||||
if (vaddr == (void *)buf->data_out) {
|
||||
@@ -555,14 +557,14 @@ nss_crypto_status_t nss_crypto_transform
|
||||
*/
|
||||
vaddr = (void *)buf->data_out;
|
||||
len = buf->data_len;
|
||||
- paddr = dma_map_single(NULL, vaddr, len, DMA_FROM_DEVICE);
|
||||
+ paddr = dma_map_single(cdev, vaddr, len, DMA_FROM_DEVICE);
|
||||
buf->data_out = paddr;
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to map the results into IV
|
||||
*/
|
||||
- paddr = dma_map_single(NULL, entry->results, L1_CACHE_BYTES, DMA_BIDIRECTIONAL);
|
||||
+ paddr = dma_map_single(cdev, entry->results, L1_CACHE_BYTES, DMA_BIDIRECTIONAL);
|
||||
buf->hash_addr = paddr;
|
||||
buf->iv_addr = paddr;
|
||||
|
||||
Reference in New Issue
Block a user