From: Shijith Thotton Date: Mon, 27 Sep 2021 15:29:13 +0000 (+0530) Subject: test/event_crypto: fix event crypto metadata write X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=67c8baecaee2ef312330102544b1f1e892a95502;p=dpdk.git test/event_crypto: fix event crypto metadata write Using memcpy to update event crypto metadata fields (request/response) will result in one overwriting the other. To avoid this, fields of each structure should be updated one by one. Fixes: 3c2c535ecfc0 ("test: add event crypto adapter auto-test") Cc: stable@dpdk.org Signed-off-by: Shijith Thotton Acked-by: Abhinandan Gujjar --- diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 3ad20921e2..0c7ebe6981 100644 --- a/app/test/test_event_crypto_adapter.c +++ b/app/test/test_event_crypto_adapter.c @@ -212,10 +212,10 @@ test_op_forward_mode(uint8_t session_less) 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)); } @@ -231,10 +231,9 @@ test_op_forward_mode(uint8_t session_less) 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)); } @@ -405,8 +404,7 @@ test_op_new_mode(uint8_t session_less) 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)); } @@ -425,8 +423,7 @@ test_op_new_mode(uint8_t session_less) 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)); }