From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CAE5842B83; Tue, 23 May 2023 21:51:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9D67B42D75; Tue, 23 May 2023 21:50:35 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 5563A42D67 for ; Tue, 23 May 2023 21:50:34 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34NCN6XD030947; Tue, 23 May 2023 12:50: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=D4vr8dWnbZ7jbovyiCWdTLAu220LFqS1WU/QkNNlQzw=; b=QzOuSaZ9a1qFWU4+9BoDW3quh4XjQ1niOMNEnrUb/mG/qGHGtGqMStuoqBa3JBovHmIf YicGQTKjZpmc4lDmgfN76Y3x1v03f6Q8Y8K+UeiWdc2XDEfiWqH8HwVqYEN6MUy2qd3P 5hVljNF+tV5m+3G1eS9r7kW1n0EE6T6FRNysGMkxB94853Yrsklu0dk2Exq/4CIj4ODb Gxk6CE6D6lMenDSzCRgM+xCvDhs02uHzZVXwkTs8cn1/ba3iF241+lu1jr4C52KxRowf 3IvMnFYo2W2xFkxz/gCC7amO4/bviDg09D/pZ1o5ztNVCb+fq+2NDiSiPTVe528YnBN5 Pw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qrm46mc9f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 23 May 2023 12:50:31 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 23 May 2023 12:50:29 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 23 May 2023 12:50:29 -0700 Received: from localhost.localdomain (unknown [10.28.36.102]) by maili.marvell.com (Postfix) with ESMTP id 26B445B6925; Tue, 23 May 2023 12:50:25 -0700 (PDT) From: Akhil Goyal To: , Akhil Goyal CC: , , , , , , , , Subject: [PATCH 11/13] test/security: verify MACsec Rx rekey Date: Wed, 24 May 2023 01:19:16 +0530 Message-ID: <20230523194918.1940212-12-gakhil@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230523194918.1940212-1-gakhil@marvell.com> References: <20220928124516.93050-5-gakhil@marvell.com> <20230523194918.1940212-1-gakhil@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: rirZBMiB6egRmTdHXmFJkcyIdgUJrnTO X-Proofpoint-GUID: rirZBMiB6egRmTdHXmFJkcyIdgUJrnTO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-23_12,2023-05-23_02,2023-05-22_02 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 From: Ankur Dwivedi This patch enables the Rx rekey test case for MACSEC. Signed-off-by: Ankur Dwivedi --- app/test/test_security_inline_macsec.c | 50 +++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/app/test/test_security_inline_macsec.c b/app/test/test_security_inline_macsec.c index a4c64429b3..6f9cec333d 100644 --- a/app/test/test_security_inline_macsec.c +++ b/app/test/test_security_inline_macsec.c @@ -906,8 +906,14 @@ test_macsec(const struct mcs_test_vector *td[], enum mcs_op op, const struct mcs if (op == MCS_DECAP || op == MCS_ENCAP_DECAP || op == MCS_VERIFY_ONLY || op == MCS_AUTH_VERIFY) { for (an = 0; an < RTE_SECURITY_MACSEC_NUM_AN; an++) { + if (opts->rekey_en && an == + (opts->rekey_td->secure_pkt.data[tci_off] & + RTE_MACSEC_AN_MASK)) + fill_macsec_sa_conf(opts->rekey_td, &sa_conf, + RTE_SECURITY_MACSEC_DIR_RX, an, tci_off); + else /* For simplicity, using same SA conf for all AN */ - fill_macsec_sa_conf(td[i], &sa_conf, + fill_macsec_sa_conf(td[i], &sa_conf, RTE_SECURITY_MACSEC_DIR_RX, an, tci_off); id = rte_security_macsec_sa_create(ctx, &sa_conf); if (id < 0) { @@ -1054,6 +1060,9 @@ test_macsec(const struct mcs_test_vector *td[], enum mcs_op op, const struct mcs } tx_sa_id[0][0] = (uint16_t)id; break; + case RTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXP: + printf("Received RTE_ETH_EVENT_MACSEC_RX_SA_PN_SOFT_EXP event\n"); + break; default: printf("Received unsupported event\n"); } @@ -1951,6 +1960,41 @@ test_inline_macsec_rekey_tx(const void *data __rte_unused) return all_err; } +static int +test_inline_macsec_rekey_rx(const void *data __rte_unused) +{ + const struct mcs_test_vector *cur_td; + struct mcs_test_opts opts = {0}; + int err, all_err = 0; + int i, size; + + opts.val_frames = RTE_SECURITY_MACSEC_VALIDATE_STRICT; + opts.protect_frames = true; + opts.sa_in_use = 1; + opts.nb_td = 1; + opts.sectag_insert_mode = 1; + opts.mtu = RTE_ETHER_MTU; + opts.rekey_en = 1; + + size = (sizeof(list_mcs_rekey_vectors) / sizeof((list_mcs_rekey_vectors)[0])); + for (i = 0; i < size; i++) { + cur_td = &list_mcs_rekey_vectors[i]; + opts.rekey_td = &list_mcs_rekey_vectors[++i]; + err = test_macsec(&cur_td, MCS_DECAP, &opts); + if (err) { + printf("Rx rekey test case %d failed\n", i); + err = -1; + } else { + printf("Rx rekey test case %d passed\n", i); + err = 0; + } + all_err += err; + } + + printf("\n%s: Success: %d, Failure: %d\n", __func__, size + all_err, -all_err); + return all_err; +} + static int ut_setup_inline_macsec(void) { @@ -2184,6 +2228,10 @@ static struct unit_test_suite inline_macsec_testsuite = { "MACsec re-key Tx", ut_setup_inline_macsec, ut_teardown_inline_macsec, test_inline_macsec_rekey_tx), + TEST_CASE_NAMED_ST( + "MACsec re-key Rx", + ut_setup_inline_macsec, ut_teardown_inline_macsec, + test_inline_macsec_rekey_rx), TEST_CASES_END() /**< NULL terminate unit test array */ }, -- 2.25.1