From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 39E5FA04B6; Mon, 12 Oct 2020 16:12:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4BB0F1D918; Mon, 12 Oct 2020 16:10:32 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by dpdk.org (Postfix) with ESMTP id 2AC7A1D8D6; Mon, 12 Oct 2020 16:10:25 +0200 (CEST) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0BF45200E0D; Mon, 12 Oct 2020 16:10:24 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 6A415200E29; Mon, 12 Oct 2020 16:10:20 +0200 (CEST) Received: from lsv03273.swis.in-blr01.nxp.com (lsv03273.swis.in-blr01.nxp.com [92.120.147.113]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 266F04032B; Mon, 12 Oct 2020 16:10:13 +0200 (CEST) From: Akhil Goyal To: dev@dpdk.org, techboard@dpdk.org Cc: thomas@monjalon.net, anoobj@marvell.com, hemant.agrawal@nxp.com, declan.doherty@intel.com, david.coyle@intel.com, Franck Lenormand Date: Mon, 12 Oct 2020 19:40:05 +0530 Message-Id: <20201012141006.31463-8-akhil.goyal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201012141006.31463-1-akhil.goyal@nxp.com> References: <20201011213403.21169-1-akhil.goyal@nxp.com> <20201012141006.31463-1-akhil.goyal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v3 7/8] test/crypto: Modify test_pdcp_proto to take parameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: Franck Lenormand The function test_pdcp_proto was relying to heavily on the structure of test vectors for PDCP making it difficult to be reusable. The function is changed to take all the test parameters as input and does not need access to the tests vectors anymore. Signed-off-by: Franck Lenormand --- app/test/test_cryptodev.c | 183 ++++++++++++++++++++++---------------- 1 file changed, 104 insertions(+), 79 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index ac2a36bc2..7cea914f9 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -7121,14 +7121,18 @@ security_proto_supported(enum rte_security_session_action_type action, * on input_vec. Checks the output of the crypto operation against * output_vec. */ -static int -test_pdcp_proto(int i, int oop, - enum rte_crypto_cipher_operation opc, - enum rte_crypto_auth_operation opa, - uint8_t *input_vec, - unsigned int input_vec_len, - uint8_t *output_vec, - unsigned int output_vec_len) +static int test_pdcp_proto(int i, int oop, enum rte_crypto_cipher_operation opc, + enum rte_crypto_auth_operation opa, + const uint8_t *input_vec, unsigned int input_vec_len, + const uint8_t *output_vec, + unsigned int output_vec_len, + enum rte_crypto_cipher_algorithm cipher_alg, + const uint8_t *cipher_key, uint32_t cipher_key_len, + enum rte_crypto_auth_algorithm auth_alg, + const uint8_t *auth_key, uint32_t auth_key_len, + uint8_t bearer, enum rte_security_pdcp_domain domain, + uint8_t packet_direction, uint8_t sn_size, + uint32_t hfn, uint32_t hfn_threshold, uint8_t sdap) { struct crypto_testsuite_params *ts_params = &testsuite_params; struct crypto_unittest_params *ut_params = &unittest_params; @@ -7143,7 +7147,7 @@ test_pdcp_proto(int i, int oop, sec_cap_idx.action = ut_params->type; sec_cap_idx.protocol = RTE_SECURITY_PROTOCOL_PDCP; - sec_cap_idx.pdcp.domain = pdcp_test_params[i].domain; + sec_cap_idx.pdcp.domain = domain; if (rte_security_capability_get(ctx, &sec_cap_idx) == NULL) return -ENOTSUP; @@ -7169,24 +7173,22 @@ test_pdcp_proto(int i, int oop, /* Setup Cipher Parameters */ ut_params->cipher_xform.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - ut_params->cipher_xform.cipher.algo = pdcp_test_params[i].cipher_alg; + ut_params->cipher_xform.cipher.algo = cipher_alg; ut_params->cipher_xform.cipher.op = opc; - ut_params->cipher_xform.cipher.key.data = pdcp_test_crypto_key[i]; - ut_params->cipher_xform.cipher.key.length = - pdcp_test_params[i].cipher_key_len; + ut_params->cipher_xform.cipher.key.data = cipher_key; + ut_params->cipher_xform.cipher.key.length = cipher_key_len; ut_params->cipher_xform.cipher.iv.length = - pdcp_test_packet_direction[i] ? 4 : 0; + packet_direction ? 4 : 0; ut_params->cipher_xform.cipher.iv.offset = IV_OFFSET; /* Setup HMAC Parameters if ICV header is required */ - if (pdcp_test_params[i].auth_alg != 0) { + if (auth_alg != 0) { ut_params->auth_xform.type = RTE_CRYPTO_SYM_XFORM_AUTH; ut_params->auth_xform.next = NULL; - ut_params->auth_xform.auth.algo = pdcp_test_params[i].auth_alg; + ut_params->auth_xform.auth.algo = auth_alg; ut_params->auth_xform.auth.op = opa; - ut_params->auth_xform.auth.key.data = pdcp_test_auth_key[i]; - ut_params->auth_xform.auth.key.length = - pdcp_test_params[i].auth_key_len; + ut_params->auth_xform.auth.key.data = auth_key; + ut_params->auth_xform.auth.key.length = auth_key_len; ut_params->cipher_xform.next = &ut_params->auth_xform; } else { @@ -7197,22 +7199,22 @@ test_pdcp_proto(int i, int oop, .action_type = ut_params->type, .protocol = RTE_SECURITY_PROTOCOL_PDCP, {.pdcp = { - .bearer = pdcp_test_bearer[i], - .domain = pdcp_test_params[i].domain, - .pkt_dir = pdcp_test_packet_direction[i], - .sn_size = pdcp_test_data_sn_size[i], - .hfn = pdcp_test_packet_direction[i] ? - 0 : pdcp_test_hfn[i], - /** - * hfn can be set as pdcp_test_hfn[i] - * if hfn_ovrd is not set. Here, PDCP - * packet direction is just used to - * run half of the cases with session - * HFN and other half with per packet - * HFN. - */ - .hfn_threshold = pdcp_test_hfn_threshold[i], - .hfn_ovrd = pdcp_test_packet_direction[i] ? 1 : 0, + .bearer = bearer, + .domain = domain, + .pkt_dir = packet_direction, + .sn_size = sn_size, + .hfn = packet_direction ? 0 : hfn, + /** + * hfn can be set as pdcp_test_hfn[i] + * if hfn_ovrd is not set. Here, PDCP + * packet direction is just used to + * run half of the cases with session + * HFN and other half with per packet + * HFN. + */ + .hfn_threshold = hfn_threshold, + .hfn_ovrd = packet_direction ? 1 : 0, + .sdap_enabled = sdap, } }, .crypto_xform = &ut_params->cipher_xform }; @@ -7241,7 +7243,7 @@ test_pdcp_proto(int i, int oop, uint32_t *per_pkt_hfn = rte_crypto_op_ctod_offset(ut_params->op, uint32_t *, IV_OFFSET); - *per_pkt_hfn = pdcp_test_packet_direction[i] ? pdcp_test_hfn[i] : 0; + *per_pkt_hfn = packet_direction ? hfn : 0; rte_security_attach_session(ut_params->op, ut_params->sec_session); @@ -7582,74 +7584,97 @@ test_pdcp_proto_SGL(int i, int oop, int test_pdcp_proto_cplane_encap(int i) { - return test_pdcp_proto(i, 0, - RTE_CRYPTO_CIPHER_OP_ENCRYPT, - RTE_CRYPTO_AUTH_OP_GENERATE, - pdcp_test_data_in[i], - pdcp_test_data_in_len[i], - pdcp_test_data_out[i], - pdcp_test_data_in_len[i]+4); + return test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_ENCRYPT, RTE_CRYPTO_AUTH_OP_GENERATE, + pdcp_test_data_in[i], pdcp_test_data_in_len[i], + pdcp_test_data_out[i], pdcp_test_data_in_len[i] + 4, + pdcp_test_params[i].cipher_alg, pdcp_test_crypto_key[i], + pdcp_test_params[i].cipher_key_len, + pdcp_test_params[i].auth_alg, pdcp_test_auth_key[i], + pdcp_test_params[i].auth_key_len, pdcp_test_bearer[i], + pdcp_test_params[i].domain, pdcp_test_packet_direction[i], + pdcp_test_data_sn_size[i], pdcp_test_hfn[i], + pdcp_test_hfn_threshold[i], SDAP_DISABLED); } int test_pdcp_proto_uplane_encap(int i) { - return test_pdcp_proto(i, 0, - RTE_CRYPTO_CIPHER_OP_ENCRYPT, - RTE_CRYPTO_AUTH_OP_GENERATE, - pdcp_test_data_in[i], - pdcp_test_data_in_len[i], - pdcp_test_data_out[i], - pdcp_test_data_in_len[i]); - + return test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_ENCRYPT, RTE_CRYPTO_AUTH_OP_GENERATE, + pdcp_test_data_in[i], pdcp_test_data_in_len[i], + pdcp_test_data_out[i], pdcp_test_data_in_len[i], + pdcp_test_params[i].cipher_alg, pdcp_test_crypto_key[i], + pdcp_test_params[i].cipher_key_len, + pdcp_test_params[i].auth_alg, pdcp_test_auth_key[i], + pdcp_test_params[i].auth_key_len, pdcp_test_bearer[i], + pdcp_test_params[i].domain, pdcp_test_packet_direction[i], + pdcp_test_data_sn_size[i], pdcp_test_hfn[i], + pdcp_test_hfn_threshold[i], SDAP_DISABLED); } int test_pdcp_proto_uplane_encap_with_int(int i) { - return test_pdcp_proto(i, 0, - RTE_CRYPTO_CIPHER_OP_ENCRYPT, - RTE_CRYPTO_AUTH_OP_GENERATE, - pdcp_test_data_in[i], - pdcp_test_data_in_len[i], - pdcp_test_data_out[i], - pdcp_test_data_in_len[i] + 4); + return test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_ENCRYPT, RTE_CRYPTO_AUTH_OP_GENERATE, + pdcp_test_data_in[i], pdcp_test_data_in_len[i], + pdcp_test_data_out[i], pdcp_test_data_in_len[i] + 4, + pdcp_test_params[i].cipher_alg, pdcp_test_crypto_key[i], + pdcp_test_params[i].cipher_key_len, + pdcp_test_params[i].auth_alg, pdcp_test_auth_key[i], + pdcp_test_params[i].auth_key_len, pdcp_test_bearer[i], + pdcp_test_params[i].domain, pdcp_test_packet_direction[i], + pdcp_test_data_sn_size[i], pdcp_test_hfn[i], + pdcp_test_hfn_threshold[i], SDAP_DISABLED); } int test_pdcp_proto_cplane_decap(int i) { - return test_pdcp_proto(i, 0, - RTE_CRYPTO_CIPHER_OP_DECRYPT, - RTE_CRYPTO_AUTH_OP_VERIFY, - pdcp_test_data_out[i], - pdcp_test_data_in_len[i] + 4, - pdcp_test_data_in[i], - pdcp_test_data_in_len[i]); + return test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_DECRYPT, RTE_CRYPTO_AUTH_OP_VERIFY, + pdcp_test_data_out[i], pdcp_test_data_in_len[i] + 4, + pdcp_test_data_in[i], pdcp_test_data_in_len[i], + pdcp_test_params[i].cipher_alg, pdcp_test_crypto_key[i], + pdcp_test_params[i].cipher_key_len, + pdcp_test_params[i].auth_alg, pdcp_test_auth_key[i], + pdcp_test_params[i].auth_key_len, pdcp_test_bearer[i], + pdcp_test_params[i].domain, pdcp_test_packet_direction[i], + pdcp_test_data_sn_size[i], pdcp_test_hfn[i], + pdcp_test_hfn_threshold[i], SDAP_DISABLED); } int test_pdcp_proto_uplane_decap(int i) { - return test_pdcp_proto(i, 0, - RTE_CRYPTO_CIPHER_OP_DECRYPT, - RTE_CRYPTO_AUTH_OP_VERIFY, - pdcp_test_data_out[i], - pdcp_test_data_in_len[i], - pdcp_test_data_in[i], - pdcp_test_data_in_len[i]); + return test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_DECRYPT, RTE_CRYPTO_AUTH_OP_VERIFY, + pdcp_test_data_out[i], pdcp_test_data_in_len[i], + pdcp_test_data_in[i], pdcp_test_data_in_len[i], + pdcp_test_params[i].cipher_alg, pdcp_test_crypto_key[i], + pdcp_test_params[i].cipher_key_len, + pdcp_test_params[i].auth_alg, pdcp_test_auth_key[i], + pdcp_test_params[i].auth_key_len, pdcp_test_bearer[i], + pdcp_test_params[i].domain, pdcp_test_packet_direction[i], + pdcp_test_data_sn_size[i], pdcp_test_hfn[i], + pdcp_test_hfn_threshold[i], SDAP_DISABLED); } int test_pdcp_proto_uplane_decap_with_int(int i) { - return test_pdcp_proto(i, 0, - RTE_CRYPTO_CIPHER_OP_DECRYPT, - RTE_CRYPTO_AUTH_OP_VERIFY, - pdcp_test_data_out[i], - pdcp_test_data_in_len[i] + 4, - pdcp_test_data_in[i], - pdcp_test_data_in_len[i]); + return test_pdcp_proto( + i, 0, RTE_CRYPTO_CIPHER_OP_DECRYPT, RTE_CRYPTO_AUTH_OP_VERIFY, + pdcp_test_data_out[i], pdcp_test_data_in_len[i] + 4, + pdcp_test_data_in[i], pdcp_test_data_in_len[i], + pdcp_test_params[i].cipher_alg, pdcp_test_crypto_key[i], + pdcp_test_params[i].cipher_key_len, + pdcp_test_params[i].auth_alg, pdcp_test_auth_key[i], + pdcp_test_params[i].auth_key_len, pdcp_test_bearer[i], + pdcp_test_params[i].domain, pdcp_test_packet_direction[i], + pdcp_test_data_sn_size[i], pdcp_test_hfn[i], + pdcp_test_hfn_threshold[i], SDAP_DISABLED); } static int -- 2.17.1