* All rights reserved.
*/
+#include "test.h"
#include <string.h>
#include <rte_common.h>
#include <rte_mempool.h>
#include <rte_mbuf.h>
#include <rte_cryptodev.h>
+
+#ifdef RTE_EXEC_ENV_WINDOWS
+static int
+test_event_crypto_adapter(void)
+{
+ printf("event_crypto_adapter not supported on Windows, skipping test\n");
+ return TEST_SKIPPED;
+}
+
+#else
+
#include <rte_eventdev.h>
#include <rte_bus_vdev.h>
#include <rte_service.h>
#include <rte_event_crypto_adapter.h>
-#include "test.h"
#define PKT_TRACE 0
#define NUM 1
if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
/* Fill in private user data information */
- rte_memcpy(&m_data.response_info, &response_info,
- sizeof(response_info));
- rte_memcpy(&m_data.request_info, &request_info,
- sizeof(request_info));
+ m_data.request_info.cdev_id = request_info.cdev_id;
+ m_data.request_info.queue_pair_id =
+ request_info.queue_pair_id;
+ m_data.response_info.event = response_info.event;
rte_cryptodev_sym_session_set_user_data(sess,
&m_data, sizeof(m_data));
}
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);
+ uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH;
op->private_data_offset = len;
/* Fill in private data information */
- rte_memcpy(&m_data.response_info, &response_info,
- sizeof(response_info));
- rte_memcpy(&m_data.request_info, &request_info,
- sizeof(request_info));
+ m_data.request_info.cdev_id = request_info.cdev_id;
+ m_data.request_info.queue_pair_id = request_info.queue_pair_id;
+ m_data.response_info.event = response_info.event;
rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
}
if (cap & RTE_EVENT_CRYPTO_ADAPTER_CAP_SESSION_PRIVATE_DATA) {
/* Fill in private user data information */
- rte_memcpy(&m_data.response_info, &response_info,
- sizeof(m_data));
+ m_data.response_info.event = response_info.event;
rte_cryptodev_sym_session_set_user_data(sess,
&m_data, sizeof(m_data));
}
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);
+ uint32_t len = IV_OFFSET + MAXIMUM_IV_LENGTH;
op->private_data_offset = len;
/* Fill in private data information */
- rte_memcpy(&m_data.response_info, &response_info,
- sizeof(m_data));
+ m_data.response_info.event = response_info.event;
rte_memcpy((uint8_t *)op + len, &m_data, sizeof(m_data));
}
NUM_MBUFS, MBUF_CACHE_SIZE,
DEFAULT_NUM_XFORMS *
sizeof(struct rte_crypto_sym_xform) +
- MAXIMUM_IV_LENGTH,
+ MAXIMUM_IV_LENGTH +
+ sizeof(union rte_event_crypto_metadata),
rte_socket_id());
if (params.op_mpool == NULL) {
RTE_LOG(ERR, USER1, "Can't create CRYPTO_OP_POOL\n");
rte_service_runstate_set(evdev_service_id, 0);
rte_service_lcore_stop(slcore_id);
rte_service_lcore_del(slcore_id);
+ rte_cryptodev_stop(TEST_CDEV_ID);
+ rte_event_dev_stop(evdev);
+ } else {
+ rte_cryptodev_stop(TEST_CDEV_ID);
rte_event_dev_stop(evdev);
}
}
TEST_ASSERT_SUCCESS(rte_event_dev_start(evdev),
"Failed to start event device");
+ /* start the cryptodev */
+ TEST_ASSERT_SUCCESS(rte_cryptodev_start(TEST_CDEV_ID),
+ "Failed to start crypto device");
+
return TEST_SUCCESS;
}
return unit_test_suite_runner(&functional_testsuite);
}
+#endif /* !RTE_EXEC_ENV_WINDOWS */
+
REGISTER_TEST_COMMAND(event_crypto_adapter_autotest,
test_event_crypto_adapter);