From patchwork Mon Sep 27 15:29:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shijith Thotton X-Patchwork-Id: 99830 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 01324A0C46; Mon, 27 Sep 2021 17:31:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AF097410DA; Mon, 27 Sep 2021 17:31:32 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 01BEA40E3C; Mon, 27 Sep 2021 17:31:31 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 18RDdk34027608; Mon, 27 Sep 2021 08:31:31 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=wNcT/oYspM48jzQnxRJ7BlvZi6knDkUuXhe5NSvPMVk=; b=Ry0ez16sRMnMdZydUh+zFN38p/9xDOHXPMcVgwJc/jCgK8/g2rMYAci++rxL/AHE5XTU YttSgImQblsAiQ2YCpGB0RfDsLreBGQuqBTch3zaBkViE9hccwfpryRVKxWo9T7kZqq5 5iqNm5/O8QXR/rt5HJc+A0J7lILeFZF5lFvpSTSJJZ0VR2sjxvWgXSLF/3RFW06hJIe+ FWlbQoiZJTMWnhnhsP8xXC0+A9LGH65XfrcS85BKk2X5VW/ETDGn8+aky2r+7nN8UJYz bufQMFAyYeEcuDam0E1VOgR5d9prx5h2aZiXydhYJa8kidU3DrNzya28tNuERg6moEPj 5g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com with ESMTP id 3bbdmjrmtt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Mon, 27 Sep 2021 08:31:31 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Mon, 27 Sep 2021 08:31:27 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Mon, 27 Sep 2021 08:31:27 -0700 Received: from localhost.localdomain (unknown [10.28.34.29]) by maili.marvell.com (Postfix) with ESMTP id AD2C63F709D; Mon, 27 Sep 2021 08:31:25 -0700 (PDT) From: Shijith Thotton To: CC: , Shijith Thotton , , , Abhinandan Gujjar Date: Mon, 27 Sep 2021 20:59:13 +0530 Message-ID: X-Mailer: git-send-email 2.25.1 In-Reply-To: <2c543df71bc79ff363c1aa501e0bf5a88cb448a7.1632731708.git.sthotton@marvell.com> References: <2c543df71bc79ff363c1aa501e0bf5a88cb448a7.1632731708.git.sthotton@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 4u9c6YjYrW8-mpARhXwNuA-1tJgZv9-i X-Proofpoint-ORIG-GUID: 4u9c6YjYrW8-mpARhXwNuA-1tJgZv9-i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-09-27_06,2021-09-24_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH] test/event_crypto: fix event crypto metadata write X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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") Signed-off-by: Shijith Thotton Acked-by: Abhinandan Gujjar --- app/test/test_event_crypto_adapter.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/app/test/test_event_crypto_adapter.c b/app/test/test_event_crypto_adapter.c index 279aa3abf5..3d7e9fb93c 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)); }