From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by dpdk.org (Postfix) with ESMTP id 3BFD22C65 for ; Thu, 10 Mar 2016 14:52:22 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP; 10 Mar 2016 05:52:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,316,1455004800"; d="scan'208";a="761640996" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 10 Mar 2016 05:52:19 -0800 Received: from linux.site (sisvmlab045.ir.intel.com [10.237.216.57]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u2ADqJ7Z020021; Thu, 10 Mar 2016 13:52:19 GMT Received: by linux.site (Postfix, from userid 11342333) id AA22BE3BBE; Thu, 10 Mar 2016 13:43:50 +0000 (GMT) From: Fiona Trahe To: dev@dpdk.org Date: Thu, 10 Mar 2016 13:42:57 +0000 Message-Id: <1457617381-8296-2-git-send-email-fiona.trahe@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1457351422-7617-1-git-send-email-fiona.trahe@intel.com> References: <1457351422-7617-1-git-send-email-fiona.trahe@intel.com> Cc: Declan Doherty Subject: [dpdk-dev] [PATCH v8 1/5] cryptodev: code cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Mar 2016 13:52:23 -0000 - Fixed >80char lines in test file - Removed unused elements from stats struct - Removed unused objects in rte_cryptodev_pmd.h - Renamed variables - Replaced leading spaces with tabs - Improved performance results display in test Signed-off-by: Fiona Trahe Signed-off-by: Declan Doherty --- app/test/test_cryptodev.c | 151 ++++++++++----------- app/test/test_cryptodev.h | 5 +- app/test/test_cryptodev_perf.c | 54 +++++--- drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c | 28 ++-- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c | 12 +- drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h | 2 +- lib/librte_cryptodev/rte_cryptodev.h | 35 +---- lib/librte_cryptodev/rte_cryptodev_pmd.h | 10 +- 8 files changed, 139 insertions(+), 158 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 62f8fb0..1a0f204 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -165,7 +165,8 @@ testsuite_setup(void) ts_params->mbuf_ol_pool = rte_pktmbuf_offload_pool_create( "MBUF_OFFLOAD_POOL", NUM_MBUFS, MBUF_CACHE_SIZE, - DEFAULT_NUM_XFORMS * sizeof(struct rte_crypto_xform), + DEFAULT_NUM_XFORMS * + sizeof(struct rte_crypto_xform), rte_socket_id()); if (ts_params->mbuf_ol_pool == NULL) { RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n"); @@ -679,76 +680,77 @@ static uint8_t aes_cbc_iv[] = { /* ***** AES-CBC / HMAC-SHA1 Hash Tests ***** */ static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_ciphertext[] = { - 0x8B, 0X4D, 0XDA, 0X1B, 0XCF, 0X04, 0XA0, 0X31, - 0XB4, 0XBF, 0XBD, 0X68, 0X43, 0X20, 0X7E, 0X76, - 0XB1, 0X96, 0X8B, 0XA2, 0X7C, 0XA2, 0X83, 0X9E, - 0X39, 0X5A, 0X2F, 0X7E, 0X92, 0XB4, 0X48, 0X1A, - 0X3F, 0X6B, 0X5D, 0XDF, 0X52, 0X85, 0X5F, 0X8E, - 0X42, 0X3C, 0XFB, 0XE9, 0X1A, 0X24, 0XD6, 0X08, - 0XDD, 0XFD, 0X16, 0XFB, 0XE9, 0X55, 0XEF, 0XF0, - 0XA0, 0X8D, 0X13, 0XAB, 0X81, 0XC6, 0X90, 0X01, - 0XB5, 0X18, 0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0x0D, + 0x73, 0x4C, 0xEE, 0x98, 0xCB, 0x7C, 0x58, 0x7E, + 0x20, 0x75, 0x1E, 0xB7, 0xC9, 0xF8, 0xF2, 0x0E, + 0x63, 0x9E, 0x05, 0x78, 0x1A, 0xB6, 0xA8, 0x7A, + 0xF9, 0x98, 0x6A, 0xA6, 0x46, 0x84, 0x2E, 0xF6, + 0x4B, 0xDC, 0x9B, 0x8F, 0x9B, 0x8F, 0xEE, 0xB4, + 0xAA, 0x3F, 0xEE, 0xC0, 0x37, 0x27, 0x76, 0xC7, + 0x95, 0xBB, 0x26, 0x74, 0x69, 0x12, 0x7F, 0xF1, + 0xBB, 0xFF, 0xAE, 0xB5, 0x99, 0x6E, 0xCB, 0x0C }; static const uint8_t catch_22_quote_2_512_bytes_AES_CBC_HMAC_SHA1_digest[] = { - 0x9a, 0X4f, 0X88, 0X1b, 0Xb6, 0X8f, 0Xd8, 0X60, - 0X42, 0X1a, 0X7d, 0X3d, 0Xf5, 0X82, 0X80, 0Xf1, - 0X18, 0X8c, 0X1d, 0X32 }; + 0x9a, 0x4f, 0x88, 0x1b, 0xb6, 0x8f, 0xd8, 0x60, + 0x42, 0x1a, 0x7d, 0x3d, 0xf5, 0x82, 0x80, 0xf1, + 0x18, 0x8c, 0x1d, 0x32 +}; static int @@ -775,7 +777,6 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) ut_params->cipher_xform.cipher.key.length = CIPHER_KEY_LENGTH_AES_CBC; /* Setup HMAC Parameters */ - ut_params->auth_xform.type = RTE_CRYPTO_XFORM_AUTH; ut_params->auth_xform.next = NULL; @@ -785,8 +786,9 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) ut_params->auth_xform.auth.key.data = hmac_sha1_key; ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA1; - /* Create Crypto session*/ - ut_params->sess = rte_cryptodev_session_create(ts_params->valid_devs[0], + /* Create crypto session*/ + ut_params->sess = rte_cryptodev_session_create( + ts_params->valid_devs[0], &ut_params->cipher_xform); TEST_ASSERT_NOT_NULL(ut_params->sess, "Session creation failed"); @@ -832,7 +834,7 @@ test_AES_CBC_HMAC_SHA1_encrypt_digest(void) CIPHER_IV_LENGTH_AES_CBC, catch_22_quote_2_512_bytes_AES_CBC_ciphertext, QUOTE_512_BYTES, - "Ciphertext data not as expected"); + "ciphertext data not as expected"); TEST_ASSERT_BUFFERS_ARE_EQUAL( rte_pktmbuf_mtod(ut_params->obuf, uint8_t *) + @@ -1239,7 +1241,6 @@ test_AES_CBC_HMAC_SHA256_decrypt_digest_verify(void) TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, "Digest verification failed"); - return TEST_SUCCESS; } @@ -1361,7 +1362,6 @@ test_AES_CBC_HMAC_SHA512_encrypt_digest(void) DIGEST_BYTE_LENGTH_SHA512, "Generated digest data not as expected"); - return TEST_SUCCESS; } @@ -1417,6 +1417,7 @@ test_AES_CBC_HMAC_SHA512_decrypt_create_session_params( ut_params->auth_xform.auth.key.data = hmac_sha512_key; ut_params->auth_xform.auth.key.length = HMAC_KEY_LENGTH_SHA512; ut_params->auth_xform.auth.digest_length = DIGEST_BYTE_LENGTH_SHA512; + return TEST_SUCCESS; } @@ -1490,8 +1491,6 @@ test_AES_CBC_HMAC_SHA512_decrypt_perform(struct rte_cryptodev_session *sess, TEST_ASSERT_EQUAL(ut_params->op->status, RTE_CRYPTO_OP_STATUS_SUCCESS, "Digest verification failed"); - - return TEST_SUCCESS; } diff --git a/app/test/test_cryptodev.h b/app/test/test_cryptodev.h index 034393e..083266a 100644 --- a/app/test/test_cryptodev.h +++ b/app/test/test_cryptodev.h @@ -47,8 +47,9 @@ #define DEFAULT_NUM_XFORMS (2) #define NUM_MBUFS (8191) #define MBUF_CACHE_SIZE (250) -#define MBUF_SIZE (2048 + DIGEST_BYTE_LENGTH_SHA512 + \ - sizeof(struct rte_mbuf) + RTE_PKTMBUF_HEADROOM) +#define MBUF_DATAPAYLOAD_SIZE (2048 + DIGEST_BYTE_LENGTH_SHA512) +#define MBUF_SIZE (sizeof(struct rte_mbuf) + \ + RTE_PKTMBUF_HEADROOM + MBUF_DATAPAYLOAD_SIZE) #define BYTE_LENGTH(x) (x/8) /* HASH DIGEST LENGTHS */ diff --git a/app/test/test_cryptodev_perf.c b/app/test/test_cryptodev_perf.c index 728bcf0..87f0670 100644 --- a/app/test/test_cryptodev_perf.c +++ b/app/test/test_cryptodev_perf.c @@ -1741,7 +1741,7 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num) /* Generate Crypto op data structure(s) */ for (b = 0; b < num_to_submit ; b++) { tx_mbufs[b] = setup_test_string(ts_params->mbuf_mp, - (const char *)data_params[0].expected.ciphertext, + (const char *)data_params[0].expected.ciphertext, data_params[0].length, 0); TEST_ASSERT_NOT_NULL(tx_mbufs[b], "Failed to allocate tx_buf"); @@ -1814,7 +1814,8 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num) rte_delay_ms(1); start_cycles = rte_rdtsc_precise(); - burst_received = rte_cryptodev_dequeue_burst(dev_num, + burst_received = + rte_cryptodev_dequeue_burst(dev_num, 0, rx_mbufs, burst_size); if (burst_received == 0) failed_polls++; @@ -1823,11 +1824,15 @@ test_perf_crypto_qp_vary_burst_size(uint16_t dev_num) end_cycles = rte_rdtsc_precise(); total_cycles += end_cycles - start_cycles; } + while (num_received != num_to_submit) { - if (gbl_cryptodev_preftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) - rte_cryptodev_enqueue_burst(dev_num, 0, NULL, 0); + if (gbl_cryptodev_preftest_devtype == + RTE_CRYPTODEV_AESNI_MB_PMD) + rte_cryptodev_enqueue_burst(dev_num, 0, + NULL, 0); - burst_received = rte_cryptodev_dequeue_burst(dev_num, + burst_received = + rte_cryptodev_dequeue_burst(dev_num, 0, rx_mbufs, burst_size); if (burst_received == 0) failed_polls++; @@ -1861,10 +1866,10 @@ test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(uint16_t dev_num) { uint16_t index; uint32_t burst_sent, burst_received; - uint32_t b, num_sent, num_received, throughput; + uint32_t b, num_sent, num_received; uint64_t failed_polls, retries, start_cycles, end_cycles; const uint64_t mhz = rte_get_tsc_hz()/1000000; - double mmps; + double throughput, mmps; struct rte_mbuf *rx_mbufs[DEFAULT_BURST_SIZE], *tx_mbufs[DEFAULT_BURST_SIZE]; struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -1904,7 +1909,7 @@ test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(uint16_t dev_num) "AES128_CBC_SHA256_HMAC requests with a constant burst " "size of %u while varying payload sizes", DEFAULT_BURST_SIZE); printf("\nDev No\tQP No\tReq Size(B)\tNum Sent\tNum Received\t" - "Mrps\tThoughput(Mbps)"); + "Mrps\tThoughput(Gbps)"); printf("\tRetries (Attempted a burst, but the device was busy)"); for (index = 0; index < MAX_PACKET_SIZE_INDEX; index++) { num_sent = 0; @@ -1957,15 +1962,19 @@ test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(uint16_t dev_num) } start_cycles = rte_rdtsc_precise(); while (num_sent < DEFAULT_NUM_REQS_TO_SUBMIT) { - burst_sent = rte_cryptodev_enqueue_burst(dev_num, 0, tx_mbufs, - ((DEFAULT_NUM_REQS_TO_SUBMIT-num_sent) < DEFAULT_BURST_SIZE) ? - DEFAULT_NUM_REQS_TO_SUBMIT-num_sent : DEFAULT_BURST_SIZE); + burst_sent = rte_cryptodev_enqueue_burst(dev_num, + 0, tx_mbufs, + ((DEFAULT_NUM_REQS_TO_SUBMIT-num_sent) + < DEFAULT_BURST_SIZE) ? + DEFAULT_NUM_REQS_TO_SUBMIT-num_sent : + DEFAULT_BURST_SIZE); if (burst_sent == 0) retries++; else num_sent += burst_sent; - burst_received = rte_cryptodev_dequeue_burst(dev_num, + burst_received = + rte_cryptodev_dequeue_burst(dev_num, 0, rx_mbufs, DEFAULT_BURST_SIZE); if (burst_received == 0) failed_polls++; @@ -1973,10 +1982,13 @@ test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(uint16_t dev_num) num_received += burst_received; } while (num_received != DEFAULT_NUM_REQS_TO_SUBMIT) { - if (gbl_cryptodev_preftest_devtype == RTE_CRYPTODEV_AESNI_MB_PMD) - rte_cryptodev_enqueue_burst(dev_num, 0, NULL, 0); + if (gbl_cryptodev_preftest_devtype == + RTE_CRYPTODEV_AESNI_MB_PMD) + rte_cryptodev_enqueue_burst(dev_num, 0, + NULL, 0); - burst_received = rte_cryptodev_dequeue_burst(dev_num, 0, + burst_received = + rte_cryptodev_dequeue_burst(dev_num, 0, rx_mbufs, DEFAULT_BURST_SIZE); if (burst_received == 0) failed_polls++; @@ -1984,11 +1996,14 @@ test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(uint16_t dev_num) num_received += burst_received; } end_cycles = rte_rdtsc_precise(); - mmps = (double)num_received*mhz/(end_cycles - start_cycles); - throughput = mmps*data_params[index].length*8; + mmps = ((double)num_received * mhz) / + (end_cycles - start_cycles); + throughput = (mmps * data_params[index].length * 8) / 1000; + printf("\n%u\t%u\t%u\t\t%u\t%u", dev_num, 0, - data_params[index].length, num_sent, num_received); - printf("\t%.2f\t%u", mmps, throughput); + data_params[index].length, + num_sent, num_received); + printf("\t%.2f\t%.2f", mmps, throughput); printf("\t\t%"PRIu64, retries); for (b = 0; b < DEFAULT_BURST_SIZE ; b++) { struct rte_mbuf_offload *ol = tx_mbufs[b]->offload_ops; @@ -2002,6 +2017,7 @@ test_perf_AES_CBC_HMAC_SHA256_encrypt_digest_vary_req_size(uint16_t dev_num) rte_pktmbuf_free(tx_mbufs[b]); } } + printf("\n"); return TEST_SUCCESS; } diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c index c7d884c..f2afdb6 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd.c @@ -377,17 +377,21 @@ process_crypto_op(struct aesni_mb_qp *qp, struct rte_mbuf *m, job->auth_tag_output = (uint8_t *)rte_pktmbuf_append(m, get_digest_byte_length(job->hash_alg)); - if (job->auth_tag_output) - memset(job->auth_tag_output, 0, - sizeof(get_digest_byte_length(job->hash_alg))); - else + if (job->auth_tag_output == NULL) { + MB_LOG_ERR("failed to allocate space in output mbuf " + "for temp digest"); return NULL; + } + + memset(job->auth_tag_output, 0, + sizeof(get_digest_byte_length(job->hash_alg))); + } else { job->auth_tag_output = c_op->digest.data; } /* - * Multiple buffer library current only support returning a truncated + * Multi-buffer library current only support returning a truncated * digest length as specified in the relevant IPsec RFCs */ job->auth_tag_output_len_in_bytes = @@ -489,7 +493,7 @@ handle_completed_jobs(struct aesni_mb_qp *qp, JOB_AES_HMAC *job) if (m) rte_ring_enqueue(qp->processed_pkts, (void *)m); else - qp->qp_stats.dequeue_err_count++; + qp->stats.dequeue_err_count++; job = (*qp->ops->job.get_completed_job)(&qp->mb_mgr); } @@ -513,19 +517,19 @@ aesni_mb_pmd_enqueue_burst(void *queue_pair, struct rte_mbuf **bufs, for (i = 0; i < nb_bufs; i++) { ol = rte_pktmbuf_offload_get(bufs[i], RTE_PKTMBUF_OL_CRYPTO); if (unlikely(ol == NULL)) { - qp->qp_stats.enqueue_err_count++; + qp->stats.enqueue_err_count++; goto flush_jobs; } sess = get_session(qp, &ol->op.crypto); if (unlikely(sess == NULL)) { - qp->qp_stats.enqueue_err_count++; + qp->stats.enqueue_err_count++; goto flush_jobs; } job = process_crypto_op(qp, bufs[i], &ol->op.crypto, sess); if (unlikely(job == NULL)) { - qp->qp_stats.enqueue_err_count++; + qp->stats.enqueue_err_count++; goto flush_jobs; } @@ -543,7 +547,7 @@ aesni_mb_pmd_enqueue_burst(void *queue_pair, struct rte_mbuf **bufs, if (processed_jobs == 0) goto flush_jobs; else - qp->qp_stats.enqueued_count += processed_jobs; + qp->stats.enqueued_count += processed_jobs; return i; flush_jobs: @@ -553,7 +557,7 @@ flush_jobs: */ job = (*qp->ops->job.flush_job)(&qp->mb_mgr); if (job) - qp->qp_stats.enqueued_count += handle_completed_jobs(qp, job); + qp->stats.enqueued_count += handle_completed_jobs(qp, job); return i; } @@ -568,7 +572,7 @@ aesni_mb_pmd_dequeue_burst(void *queue_pair, nb_dequeued = rte_ring_dequeue_burst(qp->processed_pkts, (void **)bufs, nb_bufs); - qp->qp_stats.dequeued_count += nb_dequeued; + qp->stats.dequeued_count += nb_dequeued; return nb_dequeued; } diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c index e43b898..76a85ff 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_ops.c @@ -76,11 +76,11 @@ aesni_mb_pmd_stats_get(struct rte_cryptodev *dev, for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { struct aesni_mb_qp *qp = dev->data->queue_pairs[qp_id]; - stats->enqueued_count += qp->qp_stats.enqueued_count; - stats->dequeued_count += qp->qp_stats.dequeued_count; + stats->enqueued_count += qp->stats.enqueued_count; + stats->dequeued_count += qp->stats.dequeued_count; - stats->enqueue_err_count += qp->qp_stats.enqueue_err_count; - stats->dequeue_err_count += qp->qp_stats.dequeue_err_count; + stats->enqueue_err_count += qp->stats.enqueue_err_count; + stats->dequeue_err_count += qp->stats.dequeue_err_count; } } @@ -93,7 +93,7 @@ aesni_mb_pmd_stats_reset(struct rte_cryptodev *dev) for (qp_id = 0; qp_id < dev->data->nb_queue_pairs; qp_id++) { struct aesni_mb_qp *qp = dev->data->queue_pairs[qp_id]; - memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); + memset(&qp->stats, 0, sizeof(qp->stats)); } } @@ -196,7 +196,7 @@ aesni_mb_pmd_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id, qp->sess_mp = dev->data->session_pool; - memset(&qp->qp_stats, 0, sizeof(qp->qp_stats)); + memset(&qp->stats, 0, sizeof(qp->stats)); /* Initialise multi-buffer manager */ (*qp->ops->job.init_mgr)(&qp->mb_mgr); diff --git a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h index 2f98609..304c85c 100644 --- a/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h +++ b/drivers/crypto/aesni_mb/rte_aesni_mb_pmd_private.h @@ -150,7 +150,7 @@ struct aesni_mb_qp { /**< Ring for placing process packets */ struct rte_mempool *sess_mp; /**< Session Mempool */ - struct rte_cryptodev_stats qp_stats; + struct rte_cryptodev_stats stats; /**< Queue pair statistics */ } __rte_cache_aligned; diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 892375d..0ccd1b8 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -130,17 +130,6 @@ struct rte_cryptodev_qp_conf { typedef void (*rte_cryptodev_cb_fn)(uint8_t dev_id, enum rte_cryptodev_event_type event, void *cb_arg); -#ifdef RTE_CRYPTODEV_PERF -/** - * Crypto Device performance counter statistics structure. This structure is - * used for RDTSC counters for measuring crypto operations. - */ -struct rte_cryptodev_perf_stats { - uint64_t t_accumlated; /**< Accumulated time processing operation */ - uint64_t t_min; /**< Max time */ - uint64_t t_max; /**< Min time */ -}; -#endif /** Crypto Device statistics */ struct rte_cryptodev_stats { @@ -153,29 +142,8 @@ struct rte_cryptodev_stats { /**< Total error count on operations enqueued */ uint64_t dequeue_err_count; /**< Total error count on operations dequeued */ +}; -#ifdef RTE_CRYPTODEV_DETAILED_STATS - struct { - uint64_t encrypt_ops; /**< Count of encrypt operations */ - uint64_t encrypt_bytes; /**< Number of bytes encrypted */ - - uint64_t decrypt_ops; /**< Count of decrypt operations */ - uint64_t decrypt_bytes; /**< Number of bytes decrypted */ - } cipher; /**< Cipher operations stats */ - - struct { - uint64_t generate_ops; /**< Count of generate operations */ - uint64_t bytes_hashed; /**< Number of bytes hashed */ - - uint64_t verify_ops; /**< Count of verify operations */ - uint64_t bytes_verified;/**< Number of bytes verified */ - } hash; /**< Hash operations stats */ -#endif - -#ifdef RTE_CRYPTODEV_PERF - struct rte_cryptodev_perf_stats op_perf; /**< Operations stats */ -#endif -} __rte_cache_aligned; /** * Create a virtual crypto device @@ -632,7 +600,6 @@ extern struct rte_cryptodev_session * rte_cryptodev_session_create(uint8_t dev_id, struct rte_crypto_xform *xform); - /** * Free the memory associated with a previously allocated session. * diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index 8270afa..a16d109 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -56,11 +56,6 @@ extern "C" { #include "rte_crypto.h" #include "rte_cryptodev.h" -struct rte_cryptodev_stats; -struct rte_cryptodev_info; -struct rte_cryptodev_qp_conf; - -enum rte_cryptodev_event_type; #ifdef RTE_LIBRTE_CRYPTODEV_DEBUG #define RTE_PMD_DEBUG_TRACE(...) \ @@ -80,7 +75,6 @@ struct rte_cryptodev_session { }; struct rte_cryptodev_driver; -struct rte_cryptodev; /** * Initialisation function of a crypto driver invoked for each matching @@ -427,9 +421,9 @@ struct rte_cryptodev_ops { cryptodev_info_get_t dev_infos_get; /**< Get device info. */ cryptodev_stats_get_t stats_get; - /**< Get generic device statistics. */ + /**< Get device statistics. */ cryptodev_stats_reset_t stats_reset; - /**< Reset generic device statistics. */ + /**< Reset device statistics. */ cryptodev_queue_pair_setup_t queue_pair_setup; /**< Set up a device queue pair. */ -- 2.1.0