* [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test
@ 2018-04-04 6:57 Abhinandan Gujjar
2018-04-20 13:00 ` Verma, Shally
0 siblings, 1 reply; 5+ messages in thread
From: Abhinandan Gujjar @ 2018-04-04 6:57 UTC (permalink / raw)
To: jerin.jacob, hemant.agrawal, akhil.goyal, dev
Cc: pablo.de.lara.guarch, declan.doherty, narender.vangati,
abhinandan.gujjar, nikhil.rao
Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
---
test/test/Makefile | 1 +
test/test/test_event_crypto_adapter.c | 866 ++++++++++++++++++++++++++++++++++
2 files changed, 867 insertions(+)
create mode 100644 test/test/test_event_crypto_adapter.c
diff --git a/test/test/Makefile b/test/test/Makefile
index a88cc38..e449daa 100644
--- a/test/test/Makefile
+++ b/test/test/Makefile
@@ -185,6 +185,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_EVENTDEV),y)
SRCS-y += test_eventdev.c
SRCS-y += test_event_ring.c
SRCS-y += test_event_eth_rx_adapter.c
+SRCS-y += test_event_crypto_adapter.c
endif
ifeq ($(CONFIG_RTE_LIBRTE_RAWDEV),y)
diff --git a/test/test/test_event_crypto_adapter.c b/test/test/test_event_crypto_adapter.c
new file mode 100644
index 0000000..a38e3cf
--- /dev/null
+++ b/test/test/test_event_crypto_adapter.c
@@ -0,0 +1,866 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2018 Intel Corporation
+ */
+
+#include <string.h>
+#include <rte_common.h>
+#include <rte_mempool.h>
+#include <rte_mbuf.h>
+#include <rte_cryptodev.h>
+#include <rte_eventdev.h>
+#include <rte_bus_vdev.h>
+#include <rte_event_crypto_adapter.h>
+#include "test.h"
+
+#define PKT_TRACE 0
+#define DEFAULT_NUM_XFORMS (2)
+#define NUM_MBUFS (8191)
+#define MBUF_CACHE_SIZE (256)
+#define MAXIMUM_IV_LENGTH (16)
+#define DEFAULT_NUM_OPS_INFLIGHT (128)
+#define TEST_PORT_ID 0
+#define ADAPTER_PORT_ID 1
+#define TEST_EV_APP_QUEUE_ID 0
+#define TEST_EV_CRYPTO_QUEUE_ID 1
+#define TEST_ADAPTER_ID 0
+#define TEST_CDEV_ID 0
+#define PACKET_LENGTH 64
+#define NB_TEST_PORTS 1
+#define NB_TEST_QUEUES 2
+#define MBUF_SIZE (sizeof(struct rte_mbuf) + \
+ RTE_PKTMBUF_HEADROOM + PACKET_LENGTH)
+#define IV_OFFSET (sizeof(struct rte_crypto_op) + \
+ sizeof(struct rte_crypto_sym_op) + \
+ DEFAULT_NUM_XFORMS * \
+ sizeof(struct rte_crypto_sym_xform))
+
+#define CRYPTODEV_NAME_NULL_PMD crypto_null
+
+static const uint8_t text_64B[] = {
+ 0x05, 0x15, 0x77, 0x32, 0xc9, 0x66, 0x91, 0x50,
+ 0x93, 0x9f, 0xbb, 0x4e, 0x2e, 0x5a, 0x02, 0xd0,
+ 0x2d, 0x9d, 0x31, 0x5d, 0xc8, 0x9e, 0x86, 0x36,
+ 0x54, 0x5c, 0x50, 0xe8, 0x75, 0x54, 0x74, 0x5e,
+ 0xd5, 0xa2, 0x84, 0x21, 0x2d, 0xc5, 0xf8, 0x1c,
+ 0x55, 0x1a, 0xba, 0x91, 0xce, 0xb5, 0xa3, 0x1e,
+ 0x31, 0xbf, 0xe9, 0xa1, 0x97, 0x5c, 0x2b, 0xd6,
+ 0x57, 0xa5, 0x9f, 0xab, 0xbd, 0xb0, 0x9b, 0x9c
+};
+
+struct event_crypto_adapter_test_params {
+ uint8_t cdev_id;
+ struct rte_mempool *mbuf_pool;
+ struct rte_mempool *op_mpool;
+ struct rte_mempool *session_mpool;
+ struct rte_cryptodev_config *config;
+ uint8_t crypto_event_port_id;
+};
+
+static struct event_crypto_adapter_test_params t_params;
+static uint8_t crypto_adapter_setup_done;
+static uint32_t slcore_id;
+static int evdev;
+
+
+static struct rte_mbuf *
+alloc_fill_mbuf(struct rte_mempool *mpool, const uint8_t *data,
+ size_t len, uint8_t blocksize)
+{
+ struct rte_mbuf *m = rte_pktmbuf_alloc(mpool);
+ size_t t_len = len - (blocksize ? (len % blocksize) : 0);
+
+ if (m) {
+ char *dst = rte_pktmbuf_append(m, t_len);
+
+ if (!dst) {
+ rte_pktmbuf_free(m);
+ return NULL;
+ }
+
+ rte_memcpy(dst, (const void *)data, t_len);
+ }
+ return m;
+}
+
+static int
+send_recv_ev(struct rte_event *ev)
+{
+ struct rte_crypto_op *op;
+ struct rte_event recv_ev;
+ int ret;
+
+
+ ret = rte_event_enqueue_burst(evdev, TEST_PORT_ID, ev, 1);
+ TEST_ASSERT_EQUAL(ret, 1, "Failed to send event to crypto adapter\n");
+
+ while (rte_event_dequeue_burst(evdev,
+ TEST_PORT_ID, &recv_ev, 1, 0) == 0)
+ rte_pause();
+
+ op = recv_ev.event_ptr;
+#if PKT_TRACE
+ struct rte_mbuf *m = op->sym->m_src;
+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m));
+#endif
+ rte_pktmbuf_free(op->sym->m_src);
+ rte_crypto_op_free(op);
+
+ return TEST_SUCCESS;
+}
+
+static int
+test_crypto_adapter_stats(void)
+{
+ struct rte_event_crypto_adapter_stats stats;
+
+ rte_event_crypto_adapter_stats_get(TEST_ADAPTER_ID, &stats);
+ printf(" +------------------------------------------------------+\n");
+ printf(" + Crypto adapter stats for instance %u:\n", TEST_ADAPTER_ID);
+ printf(" + Event port poll count %lu\n",
+ stats.event_poll_count);
+ printf(" + Event dequeue count %lu\n",
+ stats.event_dequeue_count);
+ printf(" + Cryptodev enqueue count %lu\n",
+ stats.crypto_enq_count);
+ printf(" + Cryptodev enqueue failed count %lu\n",
+ stats.crypto_enq_fail);
+ printf(" + Cryptodev dequeue count %lu\n",
+ stats.crypto_deq_count);
+ printf(" + Event enqueue count %lu\n",
+ stats.event_enqueue_count);
+ printf(" + Event enqueue retry count %lu\n",
+ stats.event_enq_retry_count);
+ printf(" + Event enqueue fail count %lu\n",
+ stats.event_enq_fail_count);
+ printf(" +------------------------------------------------------+\n");
+
+ rte_event_crypto_adapter_stats_reset(TEST_ADAPTER_ID);
+ return TEST_SUCCESS;
+}
+
+static int
+test_enq_deq_mode(uint8_t session_less)
+{
+ struct rte_crypto_sym_xform cipher_xform;
+ struct rte_cryptodev_sym_session *sess;
+ union rte_event_crypto_metadata m_data;
+ struct rte_crypto_sym_op *sym_op;
+ struct rte_crypto_op *op;
+ struct rte_mbuf *m;
+ struct rte_event ev;
+ int ret;
+ struct event_crypto_adapter_test_params *params = &t_params;
+
+ memset(&ev, 0, sizeof(ev));
+ memset(&m_data, 0, sizeof(m_data));
+ ev.queue_id = TEST_EV_CRYPTO_QUEUE_ID;
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.flow_id = 0xFFFF;
+
+ m = alloc_fill_mbuf(params->mbuf_pool, text_64B, PACKET_LENGTH, 0);
+ TEST_ASSERT_NOT_NULL(m, "Failed to allocate mbuf!\n");
+#if PKT_TRACE
+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m));
+#endif
+ /* Setup Cipher Parameters */
+ cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cipher_xform.next = NULL;
+
+ cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
+ cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+
+ sess = rte_cryptodev_sym_session_create(params->session_mpool);
+ TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
+
+ if (sess && !session_less) {
+ /* Copy/update required event information */
+ rte_memcpy(&m_data.response_info, &ev, sizeof(m_data));
+ m_data.request_info.cdev_id = params->cdev_id;
+ m_data.request_info.queue_pair_id = 0;
+ m_data.response_info.queue_id = TEST_EV_APP_QUEUE_ID;
+ rte_cryptodev_sym_session_set_private_data(sess, &m_data,
+ sizeof(m_data));
+ }
+
+ /* Create Crypto session*/
+ rte_cryptodev_sym_session_init(params->cdev_id, sess, &cipher_xform,
+ params->session_mpool);
+ op = rte_crypto_op_alloc(params->op_mpool,
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+ TEST_ASSERT_NOT_NULL(op,
+ "Failed to allocate symmetric crypto operation struct\n");
+
+ sym_op = op->sym;
+ if (session_less) {
+ struct rte_crypto_sym_xform *first_xform;
+
+ rte_crypto_op_sym_xforms_alloc(op, 1);
+ op->sess_type = RTE_CRYPTO_OP_SESSIONLESS;
+ first_xform = &cipher_xform;
+ sym_op->xform = first_xform;
+ uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH +
+ (sizeof(struct rte_crypto_sym_xform) * 2);
+ op->private_data_offset = len;
+ /* Copy/update required event information */
+ rte_memcpy(&m_data.response_info, &ev, sizeof(m_data));
+ m_data.request_info.cdev_id = params->cdev_id;
+ m_data.request_info.queue_pair_id = 0;
+ m_data.response_info.queue_id = TEST_EV_APP_QUEUE_ID;
+ rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
+ } else
+ rte_crypto_op_attach_sym_session(op, sess);
+
+ sym_op->m_src = m;
+ sym_op->cipher.data.offset = 0;
+ sym_op->cipher.data.length = PACKET_LENGTH;
+
+ /* Update event ptr with rte_crypo_op */
+ ev.event_ptr = op;
+
+ ret = send_recv_ev(&ev);
+ TEST_ASSERT_SUCCESS(ret, "Failed to send/receive event to "
+ "crypto adapter\n");
+
+ test_crypto_adapter_stats();
+
+ return TEST_SUCCESS;
+}
+
+static int
+test_run_adapter_as_service(void)
+{
+ uint32_t adapter_service_id;
+
+ TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_service_id_get(
+ TEST_ADAPTER_ID, &adapter_service_id),
+ "Failed to get event crypto adapter service id");
+
+ TEST_ASSERT_SUCCESS(rte_service_map_lcore_set(adapter_service_id,
+ slcore_id, 1), "Failed to map adapter service");
+
+ TEST_ASSERT_SUCCESS(rte_service_runstate_set(adapter_service_id, 1),
+ "Failed to start event crypto adapter service");
+
+ return TEST_SUCCESS;
+}
+
+static int
+test_sessionless_with_enq_deq_mode(void)
+{
+ enum rte_event_crypto_adapter_mode mode;
+ int ret;
+
+ test_run_adapter_as_service();
+ /* start the event crypto adapter */
+ mode = RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ;
+ TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID,
+ mode), "Failed to start event crypto adapter");
+
+ ret = test_enq_deq_mode(1);
+ TEST_ASSERT_SUCCESS(ret, "Sessionless - ENQ-DEQ mode test "
+ "failed!\n");
+ return TEST_SUCCESS;
+}
+
+static int
+test_session_with_enq_deq_mode(void)
+{
+ enum rte_event_crypto_adapter_mode mode;
+ int ret;
+
+ test_run_adapter_as_service();
+ mode = RTE_EVENT_CRYPTO_ADAPTER_ENQ_DEQ;
+ TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID,
+ mode), "Failed to start event crypto adapter");
+
+ ret = test_enq_deq_mode(0);
+ TEST_ASSERT_SUCCESS(ret, "Session based - ENQ-DEQ mode test "
+ "failed!\n");
+ return TEST_SUCCESS;
+}
+
+static int
+send_op_recv_ev(struct rte_crypto_op *op)
+{
+ struct event_crypto_adapter_test_params *params = &t_params;
+ struct rte_crypto_op *recv_op;
+ struct rte_event ev;
+ int ret;
+
+ ret = rte_cryptodev_enqueue_burst(params->cdev_id, 0, &op, 1);
+ TEST_ASSERT_EQUAL(ret, 1, "Failed to send event to crypto adapter\n");
+ memset(&ev, 0, sizeof(ev));
+
+ while (rte_event_dequeue_burst(evdev, TEST_PORT_ID, &ev, 1, 0) == 0)
+ rte_pause();
+
+ recv_op = ev.event_ptr;
+#if PKT_TRACE
+ struct rte_mbuf *m = recv_op->sym->m_src;
+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m));
+#endif
+ rte_pktmbuf_free(recv_op->sym->m_src);
+ rte_crypto_op_free(recv_op);
+
+ return TEST_SUCCESS;
+
+}
+
+static int
+test_deq_only_mode(uint8_t session_less)
+{
+ struct rte_crypto_sym_xform cipher_xform;
+ struct rte_cryptodev_sym_session *sess;
+ union rte_event_crypto_metadata m_data;
+ struct rte_crypto_sym_op *sym_op;
+ struct rte_event ev;
+ struct rte_crypto_op *op;
+ struct rte_mbuf *m;
+ int ret;
+ struct event_crypto_adapter_test_params *params = &t_params;
+
+ memset(&ev, 0, sizeof(ev));
+ memset(&m_data, 0, sizeof(m_data));
+ ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+ ev.flow_id = 0xFFFF;
+
+ m = alloc_fill_mbuf(params->mbuf_pool, text_64B, PACKET_LENGTH, 0);
+ TEST_ASSERT_NOT_NULL(m, "Failed to allocate mbuf!\n");
+#if PKT_TRACE
+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m));
+#endif
+ /* Setup Cipher Parameters */
+ cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER;
+ cipher_xform.next = NULL;
+
+ cipher_xform.cipher.algo = RTE_CRYPTO_CIPHER_NULL;
+ cipher_xform.cipher.op = RTE_CRYPTO_CIPHER_OP_ENCRYPT;
+
+ sess = rte_cryptodev_sym_session_create(params->session_mpool);
+ TEST_ASSERT_NOT_NULL(sess, "Session creation failed\n");
+ if (sess && !session_less) {
+ /* Copy/update required event information */
+ rte_memcpy(&m_data.response_info, &ev, sizeof(m_data));
+ m_data.response_info.queue_id = TEST_EV_APP_QUEUE_ID;
+ rte_cryptodev_sym_session_set_private_data(sess, &m_data,
+ sizeof(m_data));
+ }
+
+ /* Create Crypto session*/
+ rte_cryptodev_sym_session_init(params->cdev_id, sess, &cipher_xform,
+ params->session_mpool);
+
+ op = rte_crypto_op_alloc(params->op_mpool,
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC);
+ TEST_ASSERT_NOT_NULL(op,
+ "Failed to allocate symmetric crypto operation struct\n");
+
+ sym_op = op->sym;
+ if (session_less) {
+ struct rte_crypto_sym_xform *first_xform;
+
+ rte_crypto_op_sym_xforms_alloc(op, 1);
+ op->sess_type = RTE_CRYPTO_OP_SESSIONLESS;
+ first_xform = &cipher_xform;
+ sym_op->xform = first_xform;
+ uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH +
+ (sizeof(struct rte_crypto_sym_xform) * 2);
+ op->private_data_offset = len;
+ /* Copy/update required event information */
+ rte_memcpy(&m_data.response_info, &ev, sizeof(m_data));
+ m_data.response_info.queue_id = TEST_EV_APP_QUEUE_ID;
+ rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
+
+ } else
+ rte_crypto_op_attach_sym_session(op, sess);
+
+ sym_op->m_src = m;
+ sym_op->cipher.data.offset = 0;
+ sym_op->cipher.data.length = PACKET_LENGTH;
+
+ ret = send_op_recv_ev(op);
+ TEST_ASSERT_SUCCESS(ret, "Failed to enqueue op to cryptodev\n");
+
+ test_crypto_adapter_stats();
+
+ return TEST_SUCCESS;
+}
+
+static int
+test_sessionless_with_deq_only_mode(void)
+{
+ enum rte_event_crypto_adapter_mode mode;
+ uint32_t cap;
+ int ret;
+
+ ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID, evdev, &cap);
+ TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
+
+ if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT))
+ test_run_adapter_as_service();
+
+ /* start the event crypto adapter */
+ mode = RTE_EVENT_CRYPTO_ADAPTER_DEQ_ONLY;
+ TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID,
+ mode), "Failed to start event crypto adapter");
+
+ ret = test_deq_only_mode(1);
+ TEST_ASSERT_SUCCESS(ret, "Sessionless - DEQ only mode test "
+ "failed!\n");
+ return TEST_SUCCESS;
+}
+
+static int
+test_session_with_deq_only_mode(void)
+{
+ enum rte_event_crypto_adapter_mode mode;
+ uint32_t cap;
+ int ret;
+
+ ret = rte_event_crypto_adapter_caps_get(TEST_ADAPTER_ID, evdev, &cap);
+ TEST_ASSERT_SUCCESS(ret, "Failed to get adapter capabilities\n");
+
+ if (!(cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT))
+ test_run_adapter_as_service();
+
+ mode = RTE_EVENT_CRYPTO_ADAPTER_DEQ_ONLY;
+ TEST_ASSERT_SUCCESS(rte_event_crypto_adapter_start(TEST_ADAPTER_ID,
+ mode), "Failed to start event crypto adapter");
+
+ ret = test_deq_only_mode(0);
+ TEST_ASSERT_SUCCESS(ret, "Session based - DEQ only mode test "
+ "failed!\n");
+ return TEST_SUCCESS;
+}
+
+static int
+configure_cryptodev(void)
+{
+ struct event_crypto_adapter_test_params *params = &t_params;
+ struct rte_cryptodev_qp_conf qp_conf;
+ struct rte_cryptodev_config conf;
+ struct rte_cryptodev_info info;
+ unsigned int session_size;
+ uint8_t nb_devs;
+ int ret;
+ uint16_t qp_id = 0;
+
+ memset(params, 0, sizeof(*params));
+
+ params->mbuf_pool = rte_pktmbuf_pool_create(
+ "CRYPTO_ADAPTER_MBUFPOOL",
+ NUM_MBUFS, MBUF_CACHE_SIZE, 0, MBUF_SIZE,
+ rte_socket_id());
+ if (params->mbuf_pool == NULL) {
+ RTE_LOG(ERR, USER1, "Can't create CRYPTO_MBUFPOOL\n");
+ return TEST_FAILED;
+ }
+
+ params->op_mpool = rte_crypto_op_pool_create(
+ "EVENT_CRYPTO_SYM_OP_POOL",
+ RTE_CRYPTO_OP_TYPE_SYMMETRIC,
+ NUM_MBUFS, MBUF_CACHE_SIZE,
+ DEFAULT_NUM_XFORMS *
+ sizeof(struct rte_crypto_sym_xform) +
+ MAXIMUM_IV_LENGTH,
+ rte_socket_id());
+ if (params->op_mpool == NULL) {
+ RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
+ return TEST_FAILED;
+ }
+
+ /* Create a NULL crypto device */
+ nb_devs = rte_cryptodev_device_count_by_driver(
+ rte_cryptodev_driver_id_get(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD)));
+ if (!nb_devs) {
+ ret = rte_vdev_init(
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD), NULL);
+
+ TEST_ASSERT(ret == 0,
+ "Failed to create instance of"
+ " pmd : %s\n",
+ RTE_STR(CRYPTODEV_NAME_NULL_PMD));
+ }
+
+ nb_devs = rte_cryptodev_count();
+ if (!nb_devs) {
+ RTE_LOG(ERR, USER1, "No crypto devices found?\n");
+ return TEST_FAILED;
+ }
+
+ /* Set up a queue pair */
+ params->cdev_id = 0;
+ rte_cryptodev_info_get(params->cdev_id, &info);
+
+ conf.nb_queue_pairs = info.max_nb_queue_pairs;
+ conf.socket_id = SOCKET_ID_ANY;
+
+ session_size = rte_cryptodev_get_private_session_size(params->cdev_id);
+ session_size += sizeof(union rte_event_crypto_metadata);
+ /*
+ * Create mempool with maximum number of sessions * 2,
+ * to include the session headers
+ */
+ params->session_mpool = rte_mempool_create(
+ "CRYPTO_ADAPTER_SESSION_MP",
+ info.sym.max_nb_sessions * 2,
+ session_size,
+ 0, 0, NULL, NULL, NULL,
+ NULL, SOCKET_ID_ANY,
+ 0);
+
+ TEST_ASSERT_NOT_NULL(params->session_mpool,
+ "session mempool allocation failed\n");
+
+ TEST_ASSERT_SUCCESS(rte_cryptodev_configure(params->cdev_id,
+ &conf),
+ "Failed to configure cryptodev %u with %u qps\n",
+ params->cdev_id, conf.nb_queue_pairs);
+
+ qp_conf.nb_descriptors = DEFAULT_NUM_OPS_INFLIGHT;
+
+ TEST_ASSERT_SUCCESS(rte_cryptodev_queue_pair_setup(
+ params->cdev_id, qp_id, &qp_conf,
+ rte_cryptodev_socket_id(params->cdev_id),
+ params->session_mpool),
+ "Failed to setup queue pair %u on cryptodev %u\n",
+ qp_id, params->cdev_id);
+
+ return TEST_SUCCESS;
+}
+
+static inline void
+evdev_set_conf_values(struct rte_event_dev_config *dev_conf,
+ struct rte_event_dev_info *info)
+{
+ memset(dev_conf, 0, sizeof(struct rte_event_dev_config));
+ dev_conf->dequeue_timeout_ns = info->min_dequeue_timeout_ns;
+ dev_conf->nb_event_ports = NB_TEST_PORTS;
+ dev_conf->nb_event_queues = NB_TEST_QUEUES;
+ dev_conf->nb_event_queue_flows = info->max_event_queue_flows;
+ dev_conf->nb_event_port_dequeue_depth =
+ info->max_event_port_dequeue_depth;
+ dev_conf->nb_event_port_enqueue_depth =
+ info->max_event_port_enqueue_depth;
+ dev_conf->nb_event_port_enqueue_depth =
+ info->max_event_port_enqueue_depth;
+ dev_conf->nb_events_limit =
+ info->max_num_events;
+}
+
+static int
+configure_eventdev(void)
+{
+ const char *eventdev_name = "event_sw0";
+ struct rte_event_queue_conf queue_conf;
+ struct rte_event_dev_config devconf;
+ struct rte_event_dev_info info;
+ uint32_t queue_count;
+ uint32_t port_count;
+ int ret;
+ uint8_t qid;
+
+ evdev = rte_event_dev_get_dev_id(eventdev_name);
+ if (evdev < 0) {
+ if (rte_vdev_init(eventdev_name, NULL) < 0) {
+ RTE_LOG(DEBUG, USER1, "Error creating eventdev\n");
+ return TEST_FAILED;
+ }
+ evdev = rte_event_dev_get_dev_id(eventdev_name);
+ if (evdev < 0) {
+ RTE_LOG(DEBUG, USER1, "Error finding newly created "
+ "eventdev\n");
+ return TEST_FAILED;
+ }
+ }
+
+ ret = rte_event_dev_info_get(evdev, &info);
+ TEST_ASSERT_SUCCESS(ret, "Failed to get event dev info\n");
+
+ evdev_set_conf_values(&devconf, &info);
+
+ ret = rte_event_dev_configure(evdev, &devconf);
+ TEST_ASSERT_SUCCESS(ret, "Failed to configure eventdev\n");
+
+ /* Set up event queue */
+ ret = rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_QUEUE_COUNT,
+ &queue_count);
+ TEST_ASSERT_SUCCESS(ret, "Queue count get failed\n");
+ TEST_ASSERT_EQUAL(queue_count, 2, "Unexpected queue count\n");
+
+ qid = TEST_EV_APP_QUEUE_ID;
+ ret = rte_event_queue_setup(evdev, qid, NULL);
+ TEST_ASSERT_SUCCESS(ret, "Failed to setup queue=%d\n", qid);
+
+ queue_conf.nb_atomic_flows = info.max_event_queue_flows;
+ queue_conf.nb_atomic_order_sequences = 32;
+ queue_conf.schedule_type = RTE_SCHED_TYPE_ATOMIC;
+ queue_conf.priority = RTE_EVENT_DEV_PRIORITY_HIGHEST;
+ queue_conf.event_queue_cfg = RTE_EVENT_QUEUE_CFG_SINGLE_LINK;
+
+ qid = TEST_EV_CRYPTO_QUEUE_ID;
+ ret = rte_event_queue_setup(evdev, qid, &queue_conf);
+ TEST_ASSERT_SUCCESS(ret, "Failed to setup directed queue=%u\n", qid);
+
+ /* Set up event port */
+ ret = rte_event_dev_attr_get(evdev, RTE_EVENT_DEV_ATTR_PORT_COUNT,
+ &port_count);
+ TEST_ASSERT_SUCCESS(ret, "Port count get failed\n");
+ TEST_ASSERT_EQUAL(port_count, 1, "Unexpected port count\n");
+
+ ret = rte_event_port_setup(evdev, TEST_PORT_ID, NULL);
+ TEST_ASSERT_SUCCESS(ret, "Failed to setup port=%d\n", TEST_PORT_ID);
+
+ qid = TEST_EV_APP_QUEUE_ID;
+ ret = rte_event_port_link(evdev, TEST_PORT_ID, &qid, NULL, 1);
+ TEST_ASSERT(ret >= 0, "Failed to link queue port=%d\n", TEST_PORT_ID);
+
+ return TEST_SUCCESS;
+}
+
+static void
+test_crypto_adapter_free(void)
+{
+ rte_event_crypto_adapter_free(TEST_ADAPTER_ID);
+}
+
+static int
+test_crypto_adapter_create(void)
+{
+ struct event_crypto_adapter_test_params *params = &t_params;
+ struct rte_event_port_conf conf = {
+ .dequeue_depth = 8,
+ .enqueue_depth = 8,
+ .new_event_threshold = 1200,
+ };
+ int ret;
+
+ /* Create adapter with default port creation callback */
+ ret = rte_event_crypto_adapter_create(TEST_ADAPTER_ID,
+ params->cdev_id,
+ &conf);
+ TEST_ASSERT_SUCCESS(ret, "Failed to create event crypto adapter\n");
+
+ return TEST_SUCCESS;
+}
+
+static int
+test_crypto_adapter_qp_add_del(void)
+{
+ struct event_crypto_adapter_test_params *params = &t_params;
+ int ret;
+
+ ret = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ params->cdev_id, 0);
+ TEST_ASSERT_SUCCESS(ret, "Failed to create add queue pair\n");
+
+ ret = rte_event_crypto_adapter_queue_pair_del(TEST_ADAPTER_ID,
+ params->cdev_id, 0);
+ TEST_ASSERT_SUCCESS(ret, "Failed to delete add queue pair\n");
+
+ return TEST_SUCCESS;
+}
+
+static int
+configure_event_crypto_adapter(void)
+{
+ struct event_crypto_adapter_test_params *params = &t_params;
+ struct rte_event_port_conf conf = {
+ .dequeue_depth = 8,
+ .enqueue_depth = 8,
+ .new_event_threshold = 1200,
+ };
+ int ret;
+
+ /* Create adapter with default port creation callback */
+ ret = rte_event_crypto_adapter_create(TEST_ADAPTER_ID,
+ params->cdev_id,
+ &conf);
+ TEST_ASSERT_SUCCESS(ret, "Failed to create event crypto adapter\n");
+
+ ret = rte_event_crypto_adapter_queue_pair_add(TEST_ADAPTER_ID,
+ params->cdev_id, 0);
+ TEST_ASSERT_SUCCESS(ret, "Failed to add queue pair\n");
+
+ ret = rte_event_crypto_adapter_event_port_get(TEST_ADAPTER_ID,
+ ¶ms->crypto_event_port_id);
+ TEST_ASSERT_SUCCESS(ret, "Failed to get event port\n");
+
+ return TEST_SUCCESS;
+}
+
+static void
+test_crypto_adapter_stop(void)
+{
+ uint32_t evdev_service_id, adapter_service_id;
+
+ /* retrieve service ids */
+ rte_event_dev_service_id_get(evdev, &evdev_service_id);
+ rte_event_crypto_adapter_service_id_get(
+ TEST_ADAPTER_ID, &adapter_service_id);
+
+ /* stop services */
+ rte_service_runstate_set(evdev_service_id, 0);
+ rte_service_runstate_set(adapter_service_id, 0);
+ rte_service_lcore_stop(slcore_id);
+ rte_service_lcore_del(slcore_id);
+ rte_event_crypto_adapter_stop(TEST_ADAPTER_ID);
+ rte_event_dev_stop(evdev);
+}
+
+static int
+test_crypto_adapter_conf(void)
+{
+ uint32_t evdev_service_id;
+ uint8_t qid;
+ int ret;
+ struct event_crypto_adapter_test_params *params = &t_params;
+
+ if (!crypto_adapter_setup_done) {
+ ret = configure_event_crypto_adapter();
+ if (!ret) {
+ qid = TEST_EV_CRYPTO_QUEUE_ID;
+ ret = rte_event_port_link(evdev,
+ params->crypto_event_port_id, &qid, NULL, 1);
+ TEST_ASSERT(ret >= 0, "Failed to link queue %d "
+ "port=%u\n", qid,
+ params->crypto_event_port_id);
+ }
+ crypto_adapter_setup_done = 1;
+ }
+
+ /* retrieve service ids */
+ TEST_ASSERT_SUCCESS(rte_event_dev_service_id_get(evdev,
+ &evdev_service_id), "Failed to get event device "
+ "service id");
+
+ /* add a service core and start it */
+ TEST_ASSERT_SUCCESS(rte_service_lcore_add(slcore_id),
+ "Failed to add service core");
+ TEST_ASSERT_SUCCESS(rte_service_lcore_start(slcore_id),
+ "Failed to start service core");
+
+ /* map services to it */
+ TEST_ASSERT_SUCCESS(rte_service_map_lcore_set(evdev_service_id,
+ slcore_id, 1), "Failed to map evdev service");
+
+ /* set services to running */
+ TEST_ASSERT_SUCCESS(rte_service_runstate_set(evdev_service_id, 1),
+ "Failed to start evdev service");
+
+ /* start the eventdev */
+ TEST_ASSERT_SUCCESS(rte_event_dev_start(evdev),
+ "Failed to start event device");
+
+ return TEST_SUCCESS;
+}
+
+static int
+testsuite_setup(void)
+{
+ int ret;
+
+ slcore_id = rte_get_next_lcore(-1, 1, 0);
+ TEST_ASSERT_NOT_EQUAL(slcore_id, RTE_MAX_LCORE, "At least 2 lcores "
+ "are required to run this autotest\n");
+
+ /* Setup and start event device. */
+ ret = configure_eventdev();
+ TEST_ASSERT_SUCCESS(ret, "Failed to setup eventdev\n");
+
+ /* Setup and start crypto device. */
+ ret = configure_cryptodev();
+ TEST_ASSERT_SUCCESS(ret, "cryptodev initialization failed\n");
+
+ return TEST_SUCCESS;
+}
+
+static void
+crypto_teardown(void)
+{
+ struct event_crypto_adapter_test_params *params = &t_params;
+
+ /* Free mbuf mempool */
+ if (params->mbuf_pool != NULL) {
+ RTE_LOG(DEBUG, USER1, "CRYPTO_ADAPTER_MBUFPOOL count %u\n",
+ rte_mempool_avail_count(params->mbuf_pool));
+ rte_mempool_free(params->mbuf_pool);
+ params->mbuf_pool = NULL;
+ }
+
+ /* Free session mempool */
+ if (params->session_mpool != NULL) {
+ RTE_LOG(DEBUG, USER1, "CRYPTO_ADAPTER_SESSION_MP count %u\n",
+ rte_mempool_avail_count(params->session_mpool));
+ rte_mempool_free(params->session_mpool);
+ params->session_mpool = NULL;
+ }
+
+ /* Free ops mempool */
+ if (params->op_mpool != NULL) {
+ RTE_LOG(DEBUG, USER1, "EVENT_CRYPTO_SYM_OP_POOL count %u\n",
+ rte_mempool_avail_count(params->op_mpool));
+ rte_mempool_free(params->op_mpool);
+ params->op_mpool = NULL;
+ }
+}
+
+static void
+eventdev_teardown(void)
+{
+ rte_event_dev_stop(evdev);
+}
+
+static void
+testsuite_teardown(void)
+{
+ crypto_teardown();
+ eventdev_teardown();
+}
+
+static struct unit_test_suite service_tests = {
+ .suite_name = "Event crypto adapter test suite",
+ .setup = testsuite_setup,
+ .teardown = testsuite_teardown,
+ .unit_test_cases = {
+
+ TEST_CASE_ST(NULL, test_crypto_adapter_free,
+ test_crypto_adapter_create),
+
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_qp_add_del),
+
+ TEST_CASE_ST(test_crypto_adapter_create,
+ test_crypto_adapter_free,
+ test_crypto_adapter_stats),
+
+ TEST_CASE_ST(test_crypto_adapter_conf,
+ test_crypto_adapter_stop,
+ test_session_with_enq_deq_mode),
+
+ TEST_CASE_ST(test_crypto_adapter_conf,
+ test_crypto_adapter_stop,
+ test_sessionless_with_enq_deq_mode),
+
+ TEST_CASE_ST(test_crypto_adapter_conf,
+ test_crypto_adapter_stop,
+ test_session_with_deq_only_mode),
+
+ TEST_CASE_ST(test_crypto_adapter_conf,
+ test_crypto_adapter_stop,
+ test_sessionless_with_deq_only_mode),
+
+ TEST_CASES_END() /**< NULL terminate unit test array */
+ }
+};
+
+static int
+test_event_crypto_adapter(void)
+{
+ return unit_test_suite_runner(&service_tests);
+}
+
+REGISTER_TEST_COMMAND(event_crypto_adapter_autotest,
+ test_event_crypto_adapter);
--
1.9.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test
2018-04-04 6:57 [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test Abhinandan Gujjar
@ 2018-04-20 13:00 ` Verma, Shally
2018-04-20 15:31 ` Gujjar, Abhinandan S
0 siblings, 1 reply; 5+ messages in thread
From: Verma, Shally @ 2018-04-20 13:00 UTC (permalink / raw)
To: Abhinandan Gujjar, Jacob, Jerin, hemant.agrawal, akhil.goyal, dev
Cc: pablo.de.lara.guarch, declan.doherty, narender.vangati,
nikhil.rao, Athreya, Narayana Prasad, Murthy, Nidadavolu
HI
>-----Original Message-----
>From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Abhinandan Gujjar
>Sent: 04 April 2018 12:27
>To: Jacob, Jerin <Jerin.JacobKollanukkaran@cavium.com>; hemant.agrawal@nxp.com; akhil.goyal@nxp.com; dev@dpdk.org
>Cc: pablo.de.lara.guarch@intel.com; declan.doherty@intel.com; narender.vangati@intel.com; abhinandan.gujjar@intel.com;
>nikhil.rao@intel.com
>Subject: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test
>
>Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
//snip
>+++ b/test/test/test_event_crypto_adapter.c
>@@ -0,0 +1,866 @@
>+/* SPDX-License-Identifier: BSD-3-Clause
>+ * Copyright(c) 2018 Intel Corporation
>+ */
>+
//snip
>+static int
>+send_recv_ev(struct rte_event *ev)
>+{
>+ struct rte_crypto_op *op;
>+ struct rte_event recv_ev;
>+ int ret;
>+
>+
>+ ret = rte_event_enqueue_burst(evdev, TEST_PORT_ID, ev, 1);
[Shally] Shouldn't it enqueue to a port id returned by rte_event_crypto_adapter_event_port_get () as adapter will dequeue from that port from eventdev?
>+ TEST_ASSERT_EQUAL(ret, 1, "Failed to send event to crypto adapter\n");
>+
>+ while (rte_event_dequeue_burst(evdev,
>+ TEST_PORT_ID, &recv_ev, 1, 0) == 0)
>+ rte_pause();
>+
>+ op = recv_ev.event_ptr;
>+#if PKT_TRACE
>+ struct rte_mbuf *m = op->sym->m_src;
>+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m));
>+#endif
>+ rte_pktmbuf_free(op->sym->m_src);
>+ rte_crypto_op_free(op);
>+
>+ return TEST_SUCCESS;
>+}
//snip
--
>1.9.1
Thanks
Shally
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test
2018-04-20 13:00 ` Verma, Shally
@ 2018-04-20 15:31 ` Gujjar, Abhinandan S
2018-04-23 5:13 ` Verma, Shally
0 siblings, 1 reply; 5+ messages in thread
From: Gujjar, Abhinandan S @ 2018-04-20 15:31 UTC (permalink / raw)
To: Verma, Shally, Jacob, Jerin, hemant.agrawal, akhil.goyal, dev
Cc: De Lara Guarch, Pablo, Doherty, Declan, Vangati, Narender, Rao,
Nikhil, Athreya, Narayana Prasad, Murthy, Nidadavolu
Hi Shally,
> -----Original Message-----
> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
> Sent: Friday, April 20, 2018 6:31 PM
> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jacob, Jerin
> <Jerin.JacobKollanukkaran@cavium.com>; hemant.agrawal@nxp.com;
> akhil.goyal@nxp.com; dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>; Vangati, Narender
> <narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>; Athreya,
> Narayana Prasad <NarayanaPrasad.Athreya@cavium.com>; Murthy, Nidadavolu
> <Nidadavolu.Murthy@cavium.com>
> Subject: RE: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-
> test
>
> HI
>
> >-----Original Message-----
> >From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Abhinandan Gujjar
> >Sent: 04 April 2018 12:27
> >To: Jacob, Jerin <Jerin.JacobKollanukkaran@cavium.com>;
> >hemant.agrawal@nxp.com; akhil.goyal@nxp.com; dev@dpdk.org
> >Cc: pablo.de.lara.guarch@intel.com; declan.doherty@intel.com;
> >narender.vangati@intel.com; abhinandan.gujjar@intel.com;
> >nikhil.rao@intel.com
> >Subject: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter
> >auto-test
> >
> >Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
>
> //snip
>
> >+++ b/test/test/test_event_crypto_adapter.c
> >@@ -0,0 +1,866 @@
> >+/* SPDX-License-Identifier: BSD-3-Clause
> >+ * Copyright(c) 2018 Intel Corporation */
> >+
>
> //snip
>
> >+static int
> >+send_recv_ev(struct rte_event *ev)
> >+{
> >+ struct rte_crypto_op *op;
> >+ struct rte_event recv_ev;
> >+ int ret;
> >+
> >+
> >+ ret = rte_event_enqueue_burst(evdev, TEST_PORT_ID, ev, 1);
>
> [Shally] Shouldn't it enqueue to a port id returned by
> rte_event_crypto_adapter_event_port_get () as adapter will dequeue from that
> port from eventdev?
[Abhinandan]This is the local port of crypto adapter. The reason for exposing this for the application is
for enq-deq mode, application has to link its event queue to this port to start enqueuing events towards
the crypto adapter.
>
> >+ TEST_ASSERT_EQUAL(ret, 1, "Failed to send event to crypto
> >+adapter\n");
> >+
> >+ while (rte_event_dequeue_burst(evdev,
> >+ TEST_PORT_ID, &recv_ev, 1, 0) == 0)
> >+ rte_pause();
> >+
> >+ op = recv_ev.event_ptr;
> >+#if PKT_TRACE
> >+ struct rte_mbuf *m = op->sym->m_src;
> >+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m)); #endif
> >+ rte_pktmbuf_free(op->sym->m_src);
> >+ rte_crypto_op_free(op);
> >+
> >+ return TEST_SUCCESS;
> >+}
>
> //snip
> --
> >1.9.1
>
> Thanks
> Shally
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test
2018-04-20 15:31 ` Gujjar, Abhinandan S
@ 2018-04-23 5:13 ` Verma, Shally
2018-04-23 5:42 ` Gujjar, Abhinandan S
0 siblings, 1 reply; 5+ messages in thread
From: Verma, Shally @ 2018-04-23 5:13 UTC (permalink / raw)
To: Gujjar, Abhinandan S, Jacob, Jerin, hemant.agrawal, akhil.goyal, dev
Cc: De Lara Guarch, Pablo, Doherty, Declan, Vangati, Narender, Rao,
Nikhil, Athreya, Narayana Prasad, Murthy, Nidadavolu
>-----Original Message-----
>From: Gujjar, Abhinandan S [mailto:abhinandan.gujjar@intel.com]
>Sent: 20 April 2018 21:01
>To: Verma, Shally <Shally.Verma@cavium.com>; Jacob, Jerin <Jerin.JacobKollanukkaran@cavium.com>; hemant.agrawal@nxp.com;
>akhil.goyal@nxp.com; dev@dpdk.org
>Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty, Declan <declan.doherty@intel.com>; Vangati, Narender
><narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>; Athreya, Narayana Prasad
><NarayanaPrasad.Athreya@cavium.com>; Murthy, Nidadavolu <Nidadavolu.Murthy@cavium.com>
>Subject: RE: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test
>
>Hi Shally,
>
>> -----Original Message-----
>> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
>> Sent: Friday, April 20, 2018 6:31 PM
>> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jacob, Jerin
>> <Jerin.JacobKollanukkaran@cavium.com>; hemant.agrawal@nxp.com;
>> akhil.goyal@nxp.com; dev@dpdk.org
>> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty, Declan
>> <declan.doherty@intel.com>; Vangati, Narender
>> <narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>; Athreya,
>> Narayana Prasad <NarayanaPrasad.Athreya@cavium.com>; Murthy, Nidadavolu
>> <Nidadavolu.Murthy@cavium.com>
>> Subject: RE: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-
>> test
>>
>> HI
>>
>> >-----Original Message-----
>> >From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Abhinandan Gujjar
>> >Sent: 04 April 2018 12:27
>> >To: Jacob, Jerin <Jerin.JacobKollanukkaran@cavium.com>;
>> >hemant.agrawal@nxp.com; akhil.goyal@nxp.com; dev@dpdk.org
>> >Cc: pablo.de.lara.guarch@intel.com; declan.doherty@intel.com;
>> >narender.vangati@intel.com; abhinandan.gujjar@intel.com;
>> >nikhil.rao@intel.com
>> >Subject: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter
>> >auto-test
>> >
>> >Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
>>
>> //snip
>>
>> >+++ b/test/test/test_event_crypto_adapter.c
>> >@@ -0,0 +1,866 @@
>> >+/* SPDX-License-Identifier: BSD-3-Clause
>> >+ * Copyright(c) 2018 Intel Corporation */
>> >+
>>
>> //snip
>>
>> >+static int
>> >+send_recv_ev(struct rte_event *ev)
>> >+{
>> >+ struct rte_crypto_op *op;
>> >+ struct rte_event recv_ev;
>> >+ int ret;
>> >+
>> >+
>> >+ ret = rte_event_enqueue_burst(evdev, TEST_PORT_ID, ev, 1);
>>
>> [Shally] Shouldn't it enqueue to a port id returned by
>> rte_event_crypto_adapter_event_port_get () as adapter will dequeue from that
>> port from eventdev?
>[Abhinandan]This is the local port of crypto adapter. The reason for exposing this for the application is
>for enq-deq mode, application has to link its event queue to this port to start enqueuing events towards
>the crypto adapter.
[Shally] you mean TEST_PORT_ID is local port of crypto adapter?
As I see @code eca_default_config_cb() in patch 2/5, crypto adapter is set to use port_id = dev_conf.nb_event_ports; and
test app @ evdev_set_conf_values , sets dev_conf->nb_event_ports = NB_TEST_PORTS whose value is 1, which gives me impression
that crypto adapter local port would be 1, whereas, TEST_PORT_ID has value 0.
So, am confused, which port id test app should enqueue to? 0 or 1? Per my understanding, test app should use 1.
>>
>> >+ TEST_ASSERT_EQUAL(ret, 1, "Failed to send event to crypto
>> >+adapter\n");
>> >+
>> >+ while (rte_event_dequeue_burst(evdev,
>> >+ TEST_PORT_ID, &recv_ev, 1, 0) == 0)
>> >+ rte_pause();
>> >+
>> >+ op = recv_ev.event_ptr;
>> >+#if PKT_TRACE
>> >+ struct rte_mbuf *m = op->sym->m_src;
>> >+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m)); #endif
>> >+ rte_pktmbuf_free(op->sym->m_src);
>> >+ rte_crypto_op_free(op);
>> >+
>> >+ return TEST_SUCCESS;
>> >+}
>>
>> //snip
>> --
>> >1.9.1
>>
>> Thanks
>> Shally
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test
2018-04-23 5:13 ` Verma, Shally
@ 2018-04-23 5:42 ` Gujjar, Abhinandan S
0 siblings, 0 replies; 5+ messages in thread
From: Gujjar, Abhinandan S @ 2018-04-23 5:42 UTC (permalink / raw)
To: Verma, Shally, Jacob, Jerin, hemant.agrawal, akhil.goyal, dev
Cc: De Lara Guarch, Pablo, Doherty, Declan, Vangati, Narender, Rao,
Nikhil, Athreya, Narayana Prasad, Murthy, Nidadavolu
Hi Shally,
> -----Original Message-----
> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
> Sent: Monday, April 23, 2018 10:44 AM
> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jacob, Jerin
> <Jerin.JacobKollanukkaran@cavium.com>; hemant.agrawal@nxp.com;
> akhil.goyal@nxp.com; dev@dpdk.org
> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty, Declan
> <declan.doherty@intel.com>; Vangati, Narender
> <narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>; Athreya,
> Narayana Prasad <NarayanaPrasad.Athreya@cavium.com>; Murthy, Nidadavolu
> <Nidadavolu.Murthy@cavium.com>
> Subject: RE: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-
> test
>
>
>
> >-----Original Message-----
> >From: Gujjar, Abhinandan S [mailto:abhinandan.gujjar@intel.com]
> >Sent: 20 April 2018 21:01
> >To: Verma, Shally <Shally.Verma@cavium.com>; Jacob, Jerin
> ><Jerin.JacobKollanukkaran@cavium.com>; hemant.agrawal@nxp.com;
> >akhil.goyal@nxp.com; dev@dpdk.org
> >Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty,
> >Declan <declan.doherty@intel.com>; Vangati, Narender
> ><narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>;
> >Athreya, Narayana Prasad <NarayanaPrasad.Athreya@cavium.com>; Murthy,
> >Nidadavolu <Nidadavolu.Murthy@cavium.com>
> >Subject: RE: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto
> >adapter auto-test
> >
> >Hi Shally,
> >
> >> -----Original Message-----
> >> From: Verma, Shally [mailto:Shally.Verma@cavium.com]
> >> Sent: Friday, April 20, 2018 6:31 PM
> >> To: Gujjar, Abhinandan S <abhinandan.gujjar@intel.com>; Jacob, Jerin
> >> <Jerin.JacobKollanukkaran@cavium.com>; hemant.agrawal@nxp.com;
> >> akhil.goyal@nxp.com; dev@dpdk.org
> >> Cc: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty,
> >> Declan <declan.doherty@intel.com>; Vangati, Narender
> >> <narender.vangati@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>;
> >> Athreya, Narayana Prasad <NarayanaPrasad.Athreya@cavium.com>; Murthy,
> >> Nidadavolu <Nidadavolu.Murthy@cavium.com>
> >> Subject: RE: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto
> >> adapter auto- test
> >>
> >> HI
> >>
> >> >-----Original Message-----
> >> >From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Abhinandan
> >> >Gujjar
> >> >Sent: 04 April 2018 12:27
> >> >To: Jacob, Jerin <Jerin.JacobKollanukkaran@cavium.com>;
> >> >hemant.agrawal@nxp.com; akhil.goyal@nxp.com; dev@dpdk.org
> >> >Cc: pablo.de.lara.guarch@intel.com; declan.doherty@intel.com;
> >> >narender.vangati@intel.com; abhinandan.gujjar@intel.com;
> >> >nikhil.rao@intel.com
> >> >Subject: [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto
> >> >adapter auto-test
> >> >
> >> >Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
> >>
> >> //snip
> >>
> >> >+++ b/test/test/test_event_crypto_adapter.c
> >> >@@ -0,0 +1,866 @@
> >> >+/* SPDX-License-Identifier: BSD-3-Clause
> >> >+ * Copyright(c) 2018 Intel Corporation */
> >> >+
> >>
> >> //snip
> >>
> >> >+static int
> >> >+send_recv_ev(struct rte_event *ev)
> >> >+{
> >> >+ struct rte_crypto_op *op;
> >> >+ struct rte_event recv_ev;
> >> >+ int ret;
> >> >+
> >> >+
> >> >+ ret = rte_event_enqueue_burst(evdev, TEST_PORT_ID, ev, 1);
> >>
> >> [Shally] Shouldn't it enqueue to a port id returned by
> >> rte_event_crypto_adapter_event_port_get () as adapter will dequeue
> >> from that port from eventdev?
> >[Abhinandan]This is the local port of crypto adapter. The reason for
> >exposing this for the application is for enq-deq mode, application has
> >to link its event queue to this port to start enqueuing events towards the crypto
> adapter.
> [Shally] you mean TEST_PORT_ID is local port of crypto adapter?
No. TEST_PORT_ID is application's local port.
>
> As I see @code eca_default_config_cb() in patch 2/5, crypto adapter is set to
> use port_id = dev_conf.nb_event_ports; and test app @ evdev_set_conf_values
> , sets dev_conf->nb_event_ports = NB_TEST_PORTS whose value is 1, which
> gives me impression that crypto adapter local port would be 1, whereas,
> TEST_PORT_ID has value 0.
Initially evdev is configured with nb_event_ports = 1, then crypto adapter calls the callback
eca_default_config_cb() with the statement "dev_conf.nb_event_ports += 1;" and then
new event port is created which is used as local port for crypto adapter and same is exposed
to the application using rte_event_crypto_adapter_event_port_get() API.
> So, am confused, which port id test app should enqueue to? 0 or 1? Per my
> understanding, test app should use 1.
So, TEST_PORT_ID (port 0) is application's local port.
Port 1 which is created by crypto adapter is local port of the adapter.
In case of ENQ-DEQ mode:
Application uses port 0 to enqueue/dequeue events to/from crypto adapter.
Adapter uses port 1 for dequeue/enqueue events from/to application.
Application creates only one port that is its own local port and adapter creates its own.
Please ignore "ADAPTER_PORT_ID" which is not used in the code. I will remove it in next patch.
>
> >>
> >> >+ TEST_ASSERT_EQUAL(ret, 1, "Failed to send event to crypto
> >> >+adapter\n");
> >> >+
> >> >+ while (rte_event_dequeue_burst(evdev,
> >> >+ TEST_PORT_ID, &recv_ev, 1, 0) == 0)
> >> >+ rte_pause();
> >> >+
> >> >+ op = recv_ev.event_ptr;
> >> >+#if PKT_TRACE
> >> >+ struct rte_mbuf *m = op->sym->m_src;
> >> >+ rte_pktmbuf_dump(stdout, m, rte_pktmbuf_pkt_len(m)); #endif
> >> >+ rte_pktmbuf_free(op->sym->m_src);
> >> >+ rte_crypto_op_free(op);
> >> >+
> >> >+ return TEST_SUCCESS;
> >> >+}
> >>
> >> //snip
> >> --
> >> >1.9.1
> >>
> >> Thanks
> >> Shally
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-04-23 5:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04 6:57 [dpdk-dev] [dpdk-dev, v1, 3/5] test: add event crypto adapter auto-test Abhinandan Gujjar
2018-04-20 13:00 ` Verma, Shally
2018-04-20 15:31 ` Gujjar, Abhinandan S
2018-04-23 5:13 ` Verma, Shally
2018-04-23 5:42 ` Gujjar, Abhinandan S
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).